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;
这是我之前尝试过的事情
现在我的问题是 我希望合并从 ExportDataToCSV.GetLedgerReportData();
返回 ReportDataInfo我被困在这里从 ExportDataToCSV.GetLedgerReportData(); 返回的任何值 我想合并为单个 ReportDataInfo ,然后传递给 CurrentSessionInfo.ReportData = RdiMerge;
ReportDataInfolooks喜欢
[Serializable]
public class ReportDataInfo
{
public string ReportHeading { get; set; }
public List<ReportColumnInfo> Rows { get; set; }
}
答案 0 :(得分:1)
它只是使用Automapper
AutoMapper是一个对象到对象的映射器,它允许您解决将一种类型的一个对象中的相同属性映射到另一种类型的另一个对象的问题。例如,可以使用AutoMapper自动将重型实体Customer对象映射到CustomerDTO