Click here to Skip to main content
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 381
1 Sergey Alexandrovich Kryukov 265
2 Praneet Nadkar 237
3 Marcin Kozub 225
4 /\jmot 189
0 OriginalGriff 8,284
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,614
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 1 Dec 2012
Copyright © CodeProject, 1999-2014
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