Click here to Skip to main content
15,880,796 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to make an object from which i can set that object in one result set and the all data will set ...i made here mistake to make arrays of all types rather i had to make one array object any helps ?

C#
String DOC_no = "9EMP11ROUTE112102012_132143";
String date = "23/11/2012";
String salesman = "EMP11-Ankit";
String route = "ROUTE1-Vaniya area";
String total_cash = "350";
String total_cheque_amt = "000";
String total_cc_amt = "200";
String total_collection = "550";

String[] pay_type = new String[] { "Cash", "Credit" };
String[] amt = new String[] { "100", "200" };
String[] chDate = new String[] { " ", " " };
String[] bName = new String[] { "ICICI", " " };
String[] ccNo = new String[] { "123", " " };
String[] refno = new String[] { "5677", " " };

// method to make file in sd card
fileGenOnSD.generateOnSDForReceiptReport("ReceiptReport.txt",
        DOC_no, date, salesman, route, pay_type, amt, chDate,
        bName, ccNo, refno, total_cash, total_cc_amt,
        total_cheque_amt, total_collection);


this is my code i just need to put all arrays in one result set which i need to pass in method , its urgent any help please ??
Posted

1 solution

You can create the Dictionary of that object and send the Dictionary object to you method and inside the method you can access the values from the Dictionary object
as below mentioned in the code

XML
Dictionary<string,string> lstString = new Dictionary<string, string>();
            lstString.Add( "DOC_no", "9EMP11ROUTE112102012_132143" );
            lstString.Add( "date", "23/11/2012" );
            //.... other values
            //....
            //....

            Dictionary<string,string[]> lstStringArray = new Dictionary<string, string []>();
            lstStringArray.Add( "pay_type ", new String [] { "Cash", "Credit" } );
            lstStringArray.Add( "amt", new String [] { "100", "200" } );
            //.... other values
            //....
            //....

            //Now to get the value from dictionary in side your method pass the parameter and get the value

            string DOC_no = null;
            lstString.TryGetValue( "DOC_no", out DOC_no );


            string[] pay_type = null;
            lstStringArray.TryGetValue( "pay_type", out pay_type );
 
Share this answer
 
Comments
AndroidVivek 3-Dec-12 7:35am    
thanks for your answer , its good option and also new for me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900