public void WriteCustInvDetail(Prism810Context context, CustomerInvoiceConfigModel configModel, Type810Header header) { if (!context.IsCustomerInvoice) { return; } if (!header.HeaderKey.HasValue) { return; } var headerKey = header.HeaderKey.Value; var details = marketDataAccess.ListDetails(headerKey); if (details == null || details.Length == 0) { logger.ErrorFormat("No detail record found for 810 Key {0}.", headerKey); return; } var detail = details.First(); var premiseInfo = clientDataAccess.LoadPremiseByEsiId(header.EsiId); if (premiseInfo == null) { logger.ErrorFormat("Could not load Premise information for EsiId {0}", header.EsiId); return; } var line = string.Format("10|{0}|1|ELECTRIC|{1}||||{2}|{3}|{4}|{5}|{6}||{7}||{8}|{9}|{10}|{11}|{12}|||||||{13}|{14}|", context.TradingPartnerId, detail.ServiceClass, detail.ServicePeriodStartDate, detail.ServicePeriodEndDate, header.EsiId, premiseInfo.MeterNo, detail.RateClass, premiseInfo.CustName.ToAscii(), premiseInfo.Addr1.ToAscii(), premiseInfo.Addr2.ToAscii(), premiseInfo.City.ToAscii(), premiseInfo.State, premiseInfo.Zip, premiseInfo.EdiInfo1, premiseInfo.EdiInfo2); context.AppendLine(line); logger.TraceFormat("Wrote 810 \"10\" PRISM line for Header {0}", header.HeaderKey); }