|
Sounds to me you'd want to use a Generic Method[^].
Cheers!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
This is ASP.NET ? or Win Forms ? or ... ?
What are the underlying Types of the Tables; are they DataSets ?
“But I don't want to go among mad people,” Alice remarked.
“Oh, you can't help that,” said the Cat: “we're all mad here. I'm mad. You're mad.”
“How do you know I'm mad?” said Alice.
“You must be," said the Cat, or you wouldn't have come here.” Lewis Carroll
|
|
|
|
|
Depending on what the lists contain (any common data members) and what you need to do to them, you might consider using a common base class or an interface. You would then have 5 lists of that base class or interface and pass each one to the same function. As long as you only need to execute common functionality for all lists it should work.
If you need special functionality for some ofthe lists, you could either insert an if like
if (item is listtables1)
{
listtables1 tmp = (listtables1) item;
}
into the common function.
Or you use a different approach: You keep the lists of the special types and create a special function for each type that needs special handling. Then you can call the common function from the special functions passing the base class/interface of the current item. Or you call the common function directly in a loop for the classes without special handling.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
Dear All,
i m new to VS2010, but i know some basic ,
my requirement is to connect oracle database using C#,
and i m able to do that,
i m want to do using with 3/4 tier archi.
just i know the connection string and database connectivity.
how to make my DAL class for oracle ...
any example would be appreciated
|
|
|
|
|
 My advise would be to create a new project as class library. This will be your DAL component.
Then you need to build it with some things in mind:
* You want reusability. I created an interface and inhereted for different providers (mysql, oracle, odbc connectors etc...)
* You need some operations that are able to perform select, update, ... etc. But maybe also less convenient queries (Create table, alter table, ...) Personally I create ExecuteSelect, ExecuteUpdate, ... that takes a string (the sql) and another set ExecuteSelectSafe, ExecuteUpdateSafe, ... that takes the SQL and a list of parameternames and objectvalues.
* I included support for transactions
* I created a class that holds the result. eg the ExecuteXXX class returns that result which holds: a status (OK, FAILED, ...), an exception (if status is failed), the SQL query itself, A dataset, ... etc...
Note that for some providers you'll need the dll.
When built you can or strong-name it and install to the GAC or just reference the dll in any project you want to use it. Don't be lazy on this one, because it will become your bottleneck.
This is the Interface I wrote... Don't blindly copy/paste it. Start from scratch and try to understand what you're doing. (Note: this is an older version, I actually changed the "ENUM return values" into returning a result object containing the status, exception, dataset, ...
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Text;
namespace Framework.Dal
{
public static class DBResult
{
public enum DB_STATUS
{
UNDEFINED = 0,
CONNECTION_FAILED = 1,
CONNECTION_OK = 2,
EXECUTE_FAILED = 3,
EXECUTE_OK = 4,
}
}
public interface IDataBaseConnector
{
void SetConnection_String(string connection_string);
bool TestConnection();
DBResult.DB_STATUS ExecuteSelect(string stmnt);
DBResult.DB_STATUS ExecuteSelectSafe(string command, string[] paramnames, object[] paramvals);
DBResult.DB_STATUS ExecuteUpdate(string stmnt);
DBResult.DB_STATUS ExecuteUpdateSafe(string command, string[] paramnames, object[] paramvals);
DBResult.DB_STATUS ExecuteInsert(string stmnt);
DBResult.DB_STATUS ExecuteInsertSafe(string command, string [] paramnames, object [] paramvals);
DBResult.DB_STATUS ExecuteDelete(string stmnt);
DBResult.DB_STATUS ExecuteDeleteSafe(string command, string[] paramnames, object[] paramvals);
DBResult.DB_STATUS ExecuteStoredProcedure(string sp_name, ArrayList param_names, ArrayList param_values);
DBResult.DB_STATUS ExecuteNonQuery(string stmnt);
DataSet GetDataSet();
string GetLastErrorMessage();
string[] GetTables();
DataColumnCollection GetColumnInformation(string tablename);
int GetNrOfRowsAffected();
}
}
hope this helps.
|
|
|
|
|
I was been working on multiple desktop app. and would like to Screen shot of a desktop using the handle of the specific desktop.. I was using the blow code, but this always makes the the screenshort of current desktop.. as the Handle of "MyNewDesktop" was not supplyed. could you please tell me how to make use of hdesk to capture the screen short of the "MyNewDesktop". The below code is of utility app which captures desk top
hwinsta = OpenWindowStation("WinSta0", false, WINDOWS_STATION_ACCESS_MASK.WINSTA_ALL_ACCESS);
hwinsta2 = SetProcessWindowStation(hwinsta);
hdesk = OpenDesktop("MyNewDesktop", 0, false, DESKTOP_ACCESS_MASK.GENERIC_ALL);
bool thset = SetThreadDesktop(hdesk);
EnumDelegate delEnumfunc = new EnumDelegate(EnumWindowsProc);
IntPtr DesktopWindow = GetDesktopWindow();
bool bSuccessful = EnumDesktopWindows(hdesk, delEnumfunc, DesktopWindow);
if (bSuccessful)
{
string filename = string.Format("ScreenCap-{0:yyyy-MM-dd_hh-mm-ss-tt}", DateTime.Now);
var bounds = Screen.GetBounds(Point.Empty);
using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
{
using (Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size);
}
bitmap.Save(@"C:\" + filename + ".jpg", ImageFormat.Jpeg);
}
}
else
{
int nErrorCode = Marshal.GetLastWin32Error();
string strErrMsg = String.Format("EnumDesktopWindows failed with code {0}.", nErrorCode);
throw new Exception(strErrMsg);
}
thanks
|
|
|
|
|
Just to clarify, you are expecting to run a utility on YOUR machine and capture the image of someone else desktop?
I would think you would need to deploy your utility on the target desktop, have it take the screenshot and send it to your app.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
No, it is windowsstation.. on the same PC you will have different desktop ie.. you can created and access
|
|
|
|
|
EnumDelegate delEnumfunc = new EnumDelegate(EnumWindowsProc);
IntPtr DesktopWindow = GetDesktopWindow();
bool bSuccessful = EnumDesktopWindows(hdesk, delEnumfunc, DesktopWindow);
And? What does the delegate do?
var bounds = Screen.GetBounds(Point.Empty);
Well, that Screen is the main screen, isn't it?
|
|
|
|
|
Thanks for response, Yes screen is the main screen, But how to capture the Screenshort of it... pls suggest
|
|
|
|
|
Dear All,
I am on the beginning stage on C# development. Currently I am developing an Voucher based Accounting Software with following:
1- Visual Studio 2010
2- Programming Language: C#
3- Database: MySql 5
At present, Database structure is as follows:
1.accAccounts (For holding information about Chart of Accounts like Account Code, Name, Subsidiary or Detail, Opening Balance etc)
2.vMaster (For Vouhcer Master information, Like Voucher Number, Date, Voucher Type (i.e Payment/Receipt/Journal), Payee Name, Remarks, Debit Account, Credit Account, Amount)
3. vDetails (For Voucher Detail information, used for further allocation of Expenses/Assets uses AccCode, Debit Amount, Credit Amount)
4. TranPost (All transactions from vMaster and vDetails will be posted in this table)
The General idea is this: User create new Voucher, enter transactions for Payment/receipt/journal etc. Then save the voucher. After approval of supervisor, Voucher will post and all transactions were copied to TransPost, once posted vMaster and vDetails were restricted to further editing.
Ofcourse when data is available in TransPost table, generation of Trial Balance, Balance Sheet & Income Statement will be based upon it.
Now my Question is: Is this the correct approach for development of Accounting Software? I am mainly concern about Year end closing process. Should I use same vMaster/vDetails/TransPost tables for every Accounting period or should I create new tables for each period? Assuming 50-80k transactions per year. What is the recommended way? For accMaster I think it should be the global table for All accounting periods, if yes, then it needs also in Master/Detail structure for holding different Opening balances for each year.
As mentioned, I am a beginner and what I've learned so far is by 'learn-by-doing' approach and guidance of all experience programmers in the forums like this. So I am in need of guidance again.
Looking forward for suggestions from all Masters specially those who are in development of Accounting Softwares.
Thanks in advance
Ahmed
|
|
|
|
|
As a beginner taking on a project of this scope I think you are nuts. I'd look for a smaller more defined project (probably business based but not the underlying accounting system).
If you are serious then you need to talk to an accountant conversant with various accounting systems, then nail down the scope of what you want to attempt and start getting some specs together working with the accountant.
On the other hand if you are attempting to create a simplistic invoicing system then talk to an accountant AND the business user - your client.
If this is for a business you should consider buying an existing system and bolting on your customised front end.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks for your reply, I haven't take this project for business purpose. It's a practice project for my self. Once mastering the important areas, I will move on to more advance topics.
Your suggestion to consult with accountant is already followed, as I am an Accountant , and learning programming as an hobby.
As an accountant I can assure you we can only provide information about Accounting policies not how a programmer map it to business logic in application, hence I am here.
So back to my original question: What is the recommended way to design Tables to record accounting transactions? Is it same transactions table to records multiple financial year data or multiple Tables for multiple year.
Regards
Ahmed
|
|
|
|
|
I am not an accountant nor have I ever worked on any accounting software, but I have dealt with database applications a lot. Your suggested records per year of 50-80K will definitely not be an issue for a database table on platforms like MySQL or MSSQL or Oracle or the likes, unless you are running wide open queries such as (select * from table) without any filter or limitation on rows returned.
Database design can become complicated if you want a very efficient means of storing your data. You may look over your required data several times and see if there are relations to break out into separate tables as much as possible and use primary keys, foreign keys and joins to bring your data together. Such as your "year" you could create a table that contains a primary key, year identifier and other year associated data and then that primary key would be a foreign key in your transaction table to match those transactions to that year etc.
Hopefully that kind of makes some sense and helps in some way.
|
|
|
|
|
 Trak4Net wrote: I am not an accountant nor have I ever worked on any accounting software, but I have dealt with database applications a lot. Your suggested records per year of 50-80K will definitely not be an issue for a database table on platforms like MySQL or MSSQL or Oracle or the likes, unless you are running wide open queries such as (select * from table) without any filter or limitation on rows returned.
Database design can become complicated if you want a very efficient means of storing your data. You may look over your required data several times and see if there are relations to break out into separate tables as much as possible and use primary keys, foreign keys and joins to bring your data together. Such as your "year" you could create a table that contains a primary key, year identifier and other year associated data and then that primary key would be a foreign key in your transaction table to match those transactions to that year etc.
Hopefully that kind of makes some sense and helps in some way.
Very nice guidelines, I will definitely follow them, thanks a lot.
|
|
|
|
|
Hi,
i created with visual studio 2012 a windows class library. After the execution of my Stack.cs i have found Stack.dll in debug folder.
I tried to use my dll in a windows console application importing my .dll (using system; using Name_Space_In_Stack.dll) but it doesn't work.
Anyone can help me?
Thanks
|
|
|
|
|
queenB&S wrote: but it doesn't work. Please explain the exact details of the problem, including code extracts and error messages.
Veni, vidi, abiit domum
|
|
|
|
|
Without seeing the code in the .DLL, it's pretty much impossible to tell you EXACTLY what you need to put in the user statement.
But, basically, it's going to be the name supplied in the namespace line in your .DLL code. But, since you can define multiple namespaces and namespaces as children of namespaces, you have to be sure you're importing the correct namespace for the classes you want to use in your library.
|
|
|
|
|
Can i show an image of the code? i don't see how add
attachments...
|
|
|
|
|
No images allowed and no attachments.
Paste the code between HTML <pre> tags.
|
|
|
|
|
Open your original question above and click on the Edit link at the bottom of the message. you can then add your code sample, remembering to surround it with <pre> tags as beolow; you can use the code button at the top of the edit window to do this.
public void method()
{
}
Veni, vidi, abiit domum
|
|
|
|
|
In your new project, right click on the References folder and select Add Reference. Then browse to the location of your DLL and select it.
Then you can use:
using dll_namespace;
Notice without the .dll at the end, the namespace in the DLL has nothing to do with the file name.
|
|
|
|
|
Hi Ron, I note that there's a long delay before answers to questions are being updated on the site; this is resulting in, as in this case, my not seeing some other replies, like yours, before I post my own.
Which leaves me feeling a bit strange, but, at the same time, if my reply was on the same track as replies from you, and OriginalGriff, and a few others, that my soul has felt the winds in the wake of angels' wings as they flew past
But, perhaps these inadvertent me-too's will serve as bait for my mystery down-voter.
“But I don't want to go among mad people,” Alice remarked.
“Oh, you can't help that,” said the Cat: “we're all mad here. I'm mad. You're mad.”
“How do you know I'm mad?” said Alice.
“You must be," said the Cat, or you wouldn't have come here.” Lewis Carroll
|
|
|
|
|
Great minds think alike my friend.
Everybody gets a down voter once in a while, usually they are ones who's votes only count as -1 point, so they think they are doing harm when they are just annoying. Eventually they get tired of following you around and clicking, I got your back and gave you some points here 
|
|
|
|
|
Hi Ron, that's very thoughtful of you, but I wasn't really kvetching.
Please wait to administer "mercy points" until you hear I'm in an ICU
I do believe in "paying the iron price," as the Ironborn would say.
cheers, Bill
“But I don't want to go among mad people,” Alice remarked.
“Oh, you can't help that,” said the Cat: “we're all mad here. I'm mad. You're mad.”
“How do you know I'm mad?” said Alice.
“You must be," said the Cat, or you wouldn't have come here.” Lewis Carroll
|
|
|
|
|