Click here to Skip to main content
11,412,833 members (73,690 online)
Rate this: bad
good
Please Sign up or sign in to vote.
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 ?

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 30-Nov-12 19:31pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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

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 );
  Permalink  
Comments
AndroidVivek at 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)

  Print Answers RSS
0 OriginalGriff 379
1 Sascha Lefévre 200
2 Maciej Los 150
3 ProgramFOX 130
4 Sergey Alexandrovich Kryukov 110
0 Sergey Alexandrovich Kryukov 9,025
1 OriginalGriff 7,317
2 Maciej Los 3,570
3 Abhinav S 3,298
4 Peter Leow 3,084


Advertise | Privacy | Mobile
Web04 | 2.8.150427.1 | Last Updated 1 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100