Reputation: 13801
List<ReportDataInfo> Lrdi = new List<ReportDataInfo>();
ReportDataInfo rdi = new ReportDataInfo();
ReportDataInfo RdiMerge=new ReportDataInfo();
string[] AccountTypeCodeCustomArray =
AccountCodeTypeCustom.Split(",".ToCharArray());
string[] SubTypeCodeCustomArray =
SubAccountTypeCodeCustom.Split(",".ToCharArray());
string[] AccountCodeCustomArray = AccountCodeCustom.Split(",".ToCharArray());
for (int i = 0; i < AccountCodeTypeCustom.Length; i++)
{
rdi = ExportDataToCSV.GetLedgerReportData(Globals.GetInt(
AccountTypeCodeCustomArray[i],0),Globals.GetInt(
SubTypeCodeCustomArray[i],0),Globals.GetInt( AccountCodeCustomArray[i],0),
this.CurrentSessionInfo.Company.CompanyCode,
this.CurrentSessionInfo.FinancialYear.StartDate,
this.CurrentSessionInfo.FinancialYear.EndDate);
// Lrdi.Add(rdi);
RdiMerge.Rows.Concat(rdi.Rows);
//RdiMerge.ReportHeading = rdi.ReportHeading;
//RdiMerge.Rows = rdi.Rows;
}
CurrentSessionInfo.ReportData = RdiMerge;
This is the things i have tried before
Now my question is i want merge returned ReportDataInfo from ExportDataToCSV.GetLedgerReportData();
I am stuck here whatever values returned from ExportDataToCSV.GetLedgerReportData(); I want to merge into single ReportDataInfo and then pass to CurrentSessionInfo.ReportData = RdiMerge;
ReportDataInfolooks like
[Serializable]
public class ReportDataInfo
{
public string ReportHeading { get; set; }
public List<ReportColumnInfo> Rows { get; set; }
}
Upvotes: 4
Views: 1576
Reputation: 406
it simply use Automapper
AutoMapper is an object-to-object mapper, which allows you to solve issues with mapping of the same properties in one object of one type to another object of another type. For example, mapping a heavy entity Customer object to the CustomerDTO could be done with AutoMapper automatically
Upvotes: 1