public void WriteService(Prism650Context context, Type650Header header) { if (!header.HeaderKey.HasValue) { return; } var headerKey = header.HeaderKey.Value; var services = marketDataAccess.ListServices(headerKey); if (services == null || services.Length == 0) { logger.ErrorFormat("No service record for 650 Key {0}.", headerKey); return; } var service = services.First(); var line = string.Format( "10|{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|||||||{9}|{10}|{11}|||||||||||||||||{12}|{13}|{14}|" , context.TradingPartnerId , service.PurposeCode.ToUpper() , service.PriorityCode.ToUpper() , service.EsiId.ToUpper() , service.SpecialProcessCode.ToUpper() , service.ServiceReqDate.ToUpper() , service.NotBeforeDate.ToUpper() , service.CallAhead.ToUpper() , service.PremLocation.ToUpper() , service.ReportRemarks.ToUpper() , service.Directions.ToUpper().ToAscii() , service.MeterNbr.ToUpper() , service.Membership.ToUpper() , service.RemarksPermanentSuspend.ToUpper() , service.DisconnectAuthorization.ToUpper()); context.AppendLine(line); logger.TraceFormat("Wrote 650 \"10\" PRISM line for Header {0}", header.HeaderKey); if (context.TransactionSetPurposeCode.Equals("13")) { WriteServicePole(context, service); WriteServiceChangeReason(context, service); return; } WriteServiceReject(context, service); }
public void WriteHeader(XContainer container, Type650Header header) { if (header == null) { return; } if (!header.HeaderKey.HasValue) { return; } var headerKey = header.HeaderKey.Value; var element = new XElement("Header", new XElement("HeaderKey", headerKey)); element.TryAddElement("TransactionSetId", header.TransactionSetId); element.TryAddElement("TransactionSetControlNbr", header.TransactionSetControlNbr); element.TryAddElement("TransactionSetPurposeCode", header.TransactionSetPurposeCode); element.TryAddElement("TransactionDate", header.TransactionDate); element.TryAddElement("TransactionNbr", header.TransactionNbr); element.TryAddElement("ReferenceNbr", header.ReferenceNbr); element.TryAddElement("TransactionType", header.TransactionType); element.TryAddElement("ActionCode", header.ActionCode); element.TryAddElement("TdspName", header.TdspName); element.TryAddElement("TdspDuns", header.TdspDuns); element.TryAddElement("CrName", header.CrName); element.TryAddElement("CrDuns", header.CrDuns); element.TryAddElement("ProcessedReceivedDateTime", header.ProcessedReceivedDateTime); container.Add(element); logger.TraceFormat("Added 650 \"Header\" XML element for Header {0}", headerKey); var names = exportDataAccess.ListNames(headerKey); WriteName(element, names); var services = exportDataAccess.ListServices(headerKey); WriteService(element, services); }