} // CsvTitles public string ToCsv(TCrLoans crLoans, SortedSet <string> sources) { List <LoanMetaData> lst = crLoans.ContainsKey(CashRequestID) ? crLoans[CashRequestID] : new List <LoanMetaData>(); var bySource = new SortedDictionary <string, LoanSummaryData>(); foreach (var s in sources) { bySource[s] = new LoanSummaryData(); } foreach (var lmd in lst) { bySource[lmd.LoanSourceName].Add(lmd); } var os = new List <string>(); foreach (var s in sources) { os.Add(bySource[s].ToString()); } return(string.Join(";", CashRequestID.ToString(CultureInfo.InvariantCulture), CustomerID.ToString(CultureInfo.InvariantCulture), BrokerID.ToString(CultureInfo.InvariantCulture), IsDefault, Manual.ToCsv(), IsAutoRejected ? "Rejected" : "Manual", AutoThen.ToCsv(), AutoNow.ToCsv(), string.Join(";", os) )); } // ToCsv
public void ToRow(DataTable tbl) { tbl.Rows.Add( CustomerID.ToString("G0", gb), CashRequestID.ToString("G0", gb), CreationDate.ToString("d/MMM/yyyy H:mm:ss", gb), ManualDecisionTime.ToString("d/MMM/yyyy H:mm:ss", gb), ApprovedAmount.ToString("C0", gb), InterestRate.ToString("P2", gb), RepaymentPeriod.ToString("G0", gb), ManualSetupFeePercent.ToString("P2", gb), BrokerSetupFeePercent.ToString("P2", gb), SpreadSetupFee ? "spread" : "deduced", string.Empty, string.Empty, string.Empty, "total" ); var first = GetFirstTrail(); var main = GetMainTrail(); var last = GetLastTrail(); if (first.IsEmpty && main.IsEmpty && last.IsEmpty) { return; } tbl.Rows.Add( string.Empty, first.GetTrailID("First"), first.DecisionTimeStr, first.StatusStr, first.TagStr, main.GetTrailID("Main"), main.DecisionTimeStr, main.StatusStr, main.TagStr, last.GetTrailID("Last"), last.DecisionTimeStr, last.StatusStr, last.TagStr, string.Empty ); var firstTraces = first.Traces; var mainTraces = main.Traces; var lastTraces = last.Traces; int maxLen = Math.Max(firstTraces.Length, Math.Max(mainTraces.Length, lastTraces.Length)); for (int i = 0; i < maxLen; i++) { NotAutoApprovedTrace f = i < firstTraces.Length ? firstTraces[i] : new NotAutoApprovedTrace(); NotAutoApprovedTrace m = i < mainTraces.Length ? mainTraces[i] : new NotAutoApprovedTrace(); NotAutoApprovedTrace l = i < lastTraces.Length ? lastTraces[i] : new NotAutoApprovedTrace(); tbl.Rows.Add( string.Empty, string.Empty, f.TraceNameStr, f.CommentStr, string.Empty, string.Empty, m.TraceNameStr, m.Comment, string.Empty, string.Empty, l.TraceNameStr, l.CommentStr, string.Empty, string.Empty ); } // for i } // ToRow