public void WriteServiceStatus(Prism814Context context, Type814Service service) { if (service == null) { return; } var serviceKey = service.ServiceKey ?? 0; if (serviceKey == 0) { return; } var statuses = exportDataAccess.ListServiceStatuses(serviceKey); foreach (var status in statuses) { var line = string.Format("16|{0}|{1}|{2}||", context.TradingPartnerId, status.StatusCode, status.StatusReason); context.AppendLine(line); logger.TraceFormat("Wrote 814 \"16\" PRISM line for Header {0}", service.HeaderKey); } }
public void WriteServiceReinstatement(Prism814Context context, Type814Header header, Type814Service[] services) { var actionCode = context.ActionCode.TrimStart('0'); foreach (var service in services) { if (!service.ServiceKey.HasValue) { continue; } var premiseNumber = IdentifyEsiId(context, service); var line = string.Format("10|{0}|{1}|{2}||1|R|{3}||||||||||||||||||||||||||||||||||||{4}|||||", context.TradingPartnerId, service.ServiceType1, service.ServiceType2, service.ActionCode, premiseNumber); context.AppendLine(line); logger.TraceFormat("Wrote 814 \"10\" PRISM line for Header {0}", header.HeaderKey); if (actionCode.Equals("9")) { WriteServiceReject(context, service); } WriteServiceStatus(context, service); } }
public void WriteServiceChangeResponse(Prism814Context context, Type814Header header, Type814Service[] services) { var actionCode = context.ActionCode.TrimStart('0'); foreach (var service in services) { if (!service.ServiceKey.HasValue) { continue; } var membershipId = IdentifyLdcAccountNumber(context, service); var premiseNumber = IdentifyEsiId(context, service); var serviceActionCode = string.Empty; if (actionCode.Equals("PD", StringComparison.Ordinal)) { serviceActionCode = "A"; } var line = string.Format("10|{0}|{1}|{2}||1|C|{3}||{4}||||||||||||||||||||||||||||||||||{5}|||||", context.TradingPartnerId, service.ServiceType1, service.ServiceType2, serviceActionCode, membershipId, premiseNumber); context.AppendLine(line); logger.TraceFormat("Wrote 814 \"10\" PRISM line for Header {0}", header.HeaderKey); } }
public void WriteServiceByMaintenanceTypeCode(Prism814Context context, Type814Header header, Type814Service[] services) { if (string.IsNullOrWhiteSpace(context.ActionCode)) { return; } var actionCode = context.ActionCode.TrimStart('0'); switch (actionCode) { case "E": WriteServiceEnrollment(context, header, services); break; case "C": WriteServiceChange(context, header, services); break; case "7": case "D": WriteServiceDrop(context, header, services); break; case "HU": WriteServiceHistoricalUsageRequest(context, header, services); break; } }
public void WriteServiceReject(Prism814Context context, Type814Service service) { if (service == null) { return; } var serviceKey = service.ServiceKey ?? 0; if (serviceKey == 0) { return; } var rejects = exportDataAccess.ListServiceRejects(serviceKey); foreach (var reject in rejects) { var line = string.Format("15|{0}|{1}|{2}|", context.TradingPartnerId, reject.RejectCode, reject.RejectReason); context.AppendLine(line); logger.TraceFormat("Wrote 814 \"15\" PRISM line for Header {0}", service.HeaderKey); } }
public void WriteServiceHistoricalUsageRequest(Prism814Context context, Type814Header header, Type814Service[] services) { foreach (var service in services) { if (!service.ServiceKey.HasValue) { continue; } var crDuns = string.Empty; if (context.Market != MarketOptions.Texas) { crDuns = header.CrDuns; } var membershipId = IdentifyLdcAccountNumber(context, service); var line = string.Format( "10|{0}|{1}|{2}|{3}|{4}|E|||{5}|||{11}||||||||||{6}||||||||{7}|{8}|||||||||||{9}|||{10}|||{12}|", context.TradingPartnerId, service.ServiceType1, service.ServiceType2, service.ServiceType3, header.TransactionNbr, membershipId, service.NotificationWaiver, service.BillType, service.BillCalculator, service.ServiceType4, service.PriorityCode, crDuns, service.FundsAuthorization); context.AppendLine(line); logger.TraceFormat("Wrote 814 \"10\" PRISM line for Header {0}", header.HeaderKey); } }
public void ParseServiceRate(Prism814Context context, string[] marketFields) { var current = context.Current; if (current == null || current.ModelType != Type814Types.Service) { throw new InvalidOperationException(); } var service = current as Type814Service; if (service == null) { throw new InvalidOperationException(); } if (context.Market == MarketOptions.Texas) { return; } service.ParticipatingInterest = marketFields.AtIndex(2); service.EligibleLoadPercentage = marketFields.AtIndex(3); service.TaxExceptionPercent = marketFields.AtIndex(4); service.CapacityObligation = marketFields.AtIndex(6); service.TransmissionObligation = marketFields.AtIndex(7); service.TotalKwhHistory = marketFields.AtIndex(8); service.NumberOfMonthsHistory = marketFields.AtIndex(9); service.PeakDemandHistory = marketFields.AtIndex(10); service.AirConditioners = marketFields.AtIndex(13); service.WaterHeaters = marketFields.AtIndex(14); }
public void ParseServiceMeter(Prism814Context context, string[] marketFields) { var current = context.Current; if (current == null || current.ModelType != Type814Types.Service) { throw new InvalidOperationException(); } var service = current as Type814Service; if (service == null) { throw new InvalidOperationException(); } var model = new Type814ServiceMeter { EntityIdCode = marketFields.AtIndex(4), MeterNumber = marketFields.AtIndex(2), MeterType = marketFields.AtIndex(5), LoadProfile = marketFields.AtIndex(8), RateClass = marketFields.AtIndex(6), RateSubClass = marketFields.AtIndex(7), MeterCycle = marketFields.AtIndex(10), MeterCycleDayOfMonth = marketFields.AtIndex(36), SpecialNeedsIndicator = marketFields.AtIndex(21), OldMeterNumber = marketFields.AtIndex(3), MeterOwnerIndicator = marketFields.AtIndex(23), AmsIndicator = marketFields.AtIndex(51), SummaryInterval = marketFields.AtIndex(51), }; service.AddMeter(model); context.PushModel(model); marketFields.TryAtIndex(11, x => context.ProductType = x); marketFields.TryAtIndex(13, x => context.UnmeterQuantity = x); marketFields.TryAtIndex(14, x => context.UnmeterDescription = x); var hasIntervalType = false; var hasProductType = false; marketFields.TryAtIndex(5, x => hasIntervalType = true); marketFields.TryAtIndex(11, x => hasProductType = true); if (hasIntervalType || !hasProductType) { return; } var meterTypeModel = new Type814ServiceMeterType { ProductType = marketFields.AtIndex(11), UnmeteredNumberOfDevices = marketFields.AtIndex(13), UnmeteredDescription = marketFields.AtIndex(37), }; model.AddType(meterTypeModel); }
public void ParseServiceMeterType(Prism814Context context, string[] marketFields) { var current = context.Current; if (current == null || current.ModelType != Type814Types.ServiceMeter) { throw new InvalidOperationException(); } var meter = current as Type814ServiceMeter; if (meter == null) { throw new InvalidOperationException(); } var model = new Type814ServiceMeterType { ProductType = context.ProductType, UnmeteredNumberOfDevices = context.UnmeterQuantity, UnmeteredDescription = context.UnmeterDescription, MeterMultiplier = marketFields.AtIndex(3), MeterType = marketFields.AtIndex(2), TimeOfUse = marketFields.AtIndex(5), TimeOfUse2 = marketFields.AtIndex(6), NumberOfDials = marketFields.AtIndex(4), StartMeterRead = marketFields.AtIndex(10), EndMeterRead = marketFields.AtIndex(11), }; meter.AddType(model); }
public void WriteServiceMeterChange(Prism814Context context, Type814Service service) { if (service == null) { return; } var serviceKey = service.ServiceKey ?? 0; if (serviceKey == 0) { return; } var changes = exportDataAccess.ListServiceMeterChangesByService(serviceKey); foreach (var change in changes) { var line = string.Format("38|{0}|{1}|{2}|", context.TradingPartnerId, change.ChangeReason, change.ChangeDescription); context.AppendLine(line); logger.TraceFormat("Wrote 814 \"38\" PRISM line for Header {0}", service.HeaderKey); } }
public void WriteServiceRateData(Prism814Context context, Type814Service service) { var line = string.Format("12|{0}|1||||||||||||||", context.TradingPartnerId); context.AppendLine(line); logger.TraceFormat("Wrote 814 \"12\" PRISM line for Header {0}", service.HeaderKey); }
public string IdentifyEsiId(Prism814Context context, Type814Service service) { if (context.Market == MarketOptions.Maryland) { return(string.Empty); } return(service.EsiId); }
public string IdentifyLdcAccountNumber(Prism814Context context, Type814Service service) { if (context.Market == MarketOptions.Maryland) { return(service.EsiId); } return(service.MembershipId); }
public void WriteServiceAccountChange(Prism814Context context, Type814Service service, Type814ServiceAccountChange[] changes) { foreach (var change in changes) { var line = string.Format("40|{0}|{1}|{2}|", context.TradingPartnerId, change.ChangeReason, change.ChangeDescription); context.AppendLine(line); logger.TraceFormat("Wrote 814 \"40\" PRISM line for Header {0}", service.HeaderKey); } }
public void WriteService(Prism814Context context, Type814Header header, Type814Service[] services) { if (context.Market == MarketOptions.Maryland) { WriteServiceByMaintenanceTypeCode(context, header, services); return; } var actionCode = context.ActionCode.TrimStart('0'); switch (actionCode) { case "7": case "10": case "19": case "24": WriteServiceDrop(context, header, services); break; case "8": case "9": WriteServiceReinstatement(context, header, services); break; case "12": case "13": case "21": case "PC": WriteServiceChange(context, header, services); break; case "PD": WriteServiceChangeResponse(context, header, services); break; case "18": WriteServiceEnrollment(context, header, services); WriteServiceDrop(context, header, services); break; case "": return; default: WriteServiceEnrollment(context, header, services); break; } }
public string IdentifyServiceEffectiveDate(Prism814Context context, string[] marketFields) { var alias = context.Alias.Trim('0'); var effectiveDateIndex = 0; switch (alias) { case "1": case "10": marketFields.TryAtIndex(11, x => effectiveDateIndex = 11); break; case "6": case "11": case "D": marketFields.TryAtIndex(7, x => effectiveDateIndex = 7); break; case "12": case "13": marketFields.TryAtIndex(15, x => effectiveDateIndex = 15); if (effectiveDateIndex == 0) { marketFields.TryAtIndex(16, x => effectiveDateIndex = 16); } break; case "14": case "25": marketFields.TryAtIndex(16, x => effectiveDateIndex = 16); break; case "20": case "C": marketFields.TryAtIndex(2, x => effectiveDateIndex = 2); break; default: marketFields.TryAtIndex(5, x => effectiveDateIndex = 5); break; } return((effectiveDateIndex != 0) ? marketFields.AtIndex(effectiveDateIndex) : string.Empty); }
public IMarketFileParseResult Parse(Stream stream) { var context = new Prism814Context(); using (var reader = new StreamReader(stream)) { string marketFileLine; while ((marketFileLine = reader.ReadLine()) != null) { ParseLine(context, marketFileLine); } } if (context.ShouldResolve) { logger.Warn("Unresolved data identified after parsing 814. Transactions may not be completed."); context.ResolveToHeader(); } return(context.Results); }
public void WriteAccount(Prism814Context context, Type814Header header) { var ercotName = string.Empty; var ercotDuns = string.Empty; var transactionSetId = string.Empty; var stateId = context.TradingPartnerId.Substring(3, 2); if (context.Market == MarketOptions.Texas) { ercotName = "ERCOT"; ercotDuns = "183529049"; } var actionCode = context.ActionCode; if (context.Market == MarketOptions.Texas) { transactionSetId = (actionCode.StartsWith("0")) ? actionCode.Substring(1) : actionCode; } var line = string.Format("01|{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}||{9}|||||{10}|{11}|{12}|", context.TradingPartnerId, stateId, header.TransactionSetPurposeCode, header.TransactionNbr, header.ReferenceNbr, header.TdspDuns, header.TdspName.ToUpper(), header.CrDuns, header.CrName.ToUpper(), header.TransactionDate, transactionSetId, ercotName, ercotDuns); context.AppendLine(line); logger.TraceFormat("Wrote 814 \"01\" PRISM line for Header {0}", header.HeaderKey); }
public void ParseServiceDate(Prism814Context context, string[] marketFields) { var current = context.Current; if (current == null || current.ModelType != Type814Types.Service) { throw new InvalidOperationException(); } var service = current as Type814Service; if (service == null) { throw new InvalidOperationException(); } var effectiveDate = IdentifyServiceEffectiveDate(context, marketFields); service.SpecialReadSwitchDate = effectiveDate; service.SpecialNeedsExpirationDate = marketFields.AtIndex(7); service.RtoDate = marketFields.AtIndex(2); service.RtoTime = marketFields.AtIndex(3); service.EsiIdEndDate = marketFields.AtIndex(18); service.EsiIdEligbilityDate = marketFields.AtIndex(19); if (context.Market == MarketOptions.Texas) { var alias = context.Alias.TrimStart('0'); var fieldIndex = alias.Equals("14") ? 5 : 17; service.EsiIdStartDate = marketFields.AtIndex(fieldIndex); } if (context.Market == MarketOptions.Maryland || context.Market == MarketOptions.NewYork || context.Market == MarketOptions.Pennsylvania) { service.EsiIdStartDate = marketFields.AtIndex(5); } }
public void ParseHeader(Prism814Context context, string[] marketFields) { var model = new Type814Header { TransactionSetPurposeCode = "11", TransactionSetId = marketFields.AtIndex(16), TransactionNbr = marketFields.AtIndex(4), TransactionDate = marketFields.AtIndex(11), ReferenceNbr = marketFields.AtIndex(5), TdspDuns = marketFields.AtIndex(6), TdspName = marketFields.AtIndex(7), CrDuns = marketFields.AtIndex(8), CrName = marketFields.AtIndex(9), }; marketFields.TryAtIndex(3, x => model.TransactionSetPurposeCode = x); var identifiedMarket = clientDataAccess.IdentifyMarket(model.TdspDuns); if (identifiedMarket.HasValue) { context.SetMarket(identifiedMarket.Value); } else { context.SetMarket((int)MarketOptions.Texas); } model.MarketId = context.MarketId; model.ProviderId = 1; model.ActionCode = context.Alias; if (context.Market == MarketOptions.Texas) { model.ActionCode = marketFields.AtIndex(16); } context.PushModel(model); }
public void WriteServiceMeter(Prism814Context context, Type814Service service) { if (service == null) { return; } var serviceKey = service.ServiceKey ?? 0; if (serviceKey == 0) { return; } var meters = exportDataAccess.ListServiceMeters(serviceKey); for (int index = 0, count = meters.Length; index < count; index++) { var line = string.Format("30|{0}|||||||||||||||||||||||||||||||||||||", context.TradingPartnerId); context.AppendLine(line); logger.TraceFormat("Wrote 814 \"30\" PRISM line for Header {0}", service.HeaderKey); } }
public void ParseServiceReject(Prism814Context context, string[] marketFields) { var current = context.Current; if (current == null || current.ModelType != Type814Types.Service) { throw new InvalidOperationException(); } var service = current as Type814Service; if (service == null) { throw new InvalidOperationException(); } var model = new Type814ServiceReject { RejectCode = marketFields.AtIndex(2), RejectReason = marketFields.AtIndex(3), }; service.AddReject(model); }
public void ParseServiceStatus(Prism814Context context, string[] marketFields) { var current = context.Current; if (current == null || current.ModelType != Type814Types.Service) { throw new InvalidOperationException(); } var service = current as Type814Service; if (service == null) { throw new InvalidOperationException(); } if (context.Market == MarketOptions.Texas) { var statusModel = new Type814ServiceStatus { StatusCode = marketFields.AtIndex(2), StatusReason = marketFields.AtIndex(3), }; service.AddStatus(statusModel); return; } var changeModel = new Type814ServiceAccountChange { ChangeReason = marketFields.AtIndex(2), ChangeDescription = marketFields.AtIndex(3), }; service.AddChange(changeModel); }
public void ParseServiceMeterChange(Prism814Context context, string[] marketFields) { var current = context.Current; if (current == null || current.ModelType != Type814Types.ServiceMeter) { throw new InvalidOperationException(); } var meter = current as Type814ServiceMeter; if (meter == null) { throw new InvalidOperationException(); } var model = new Type814ServiceMeterChange { ChangeReason = marketFields.AtIndex(2), ChangeDescription = marketFields.AtIndex(3), }; meter.AddChange(model); }
public void ParseName(Prism814Context context, string[] marketFields) { var current = context.Current; if (current == null || current.ModelType != Type814Types.Header) { throw new InvalidOperationException(); } var header = current as Type814Header; if (header == null) { throw new InvalidOperationException(); } var model = new Type814Name { EntityIdType = marketFields.AtIndex(2), EntityName2 = marketFields.AtIndex(5), EntityName3 = marketFields.AtIndex(6), Address1 = marketFields.AtIndex(7), Address2 = marketFields.AtIndex(8), City = marketFields.AtIndex(9), State = marketFields.AtIndex(10), PostalCode = marketFields.AtIndex(11), ContactName = marketFields.AtIndex(16), ContactPhoneNbr1 = marketFields.AtIndex(14), CountryCode = marketFields.AtIndex(12), ContactPhoneNbr2 = marketFields.AtIndex(15), }; marketFields.TryAtIndex(3, x => model.EntityName = x); header.AddName(model); }
public void WriteServiceChange(Prism814Context context, Type814Header header, Type814Service[] services) { var actionCode = context.ActionCode.TrimStart('0'); foreach (var service in services) { if (!service.ServiceKey.HasValue) { continue; } var serviceKey = service.ServiceKey.Value; var lineTrackingNumber = "1"; var crDuns = string.Empty; var specialNeedsFlag = string.Empty; if (context.Market != MarketOptions.Texas) { lineTrackingNumber = serviceKey.ToString(); } if (actionCode.Equals("PC", StringComparison.Ordinal)) { specialNeedsFlag = service.SpecialNeedsIndicator; } var membershipId = IdentifyLdcAccountNumber(context, service); var premiseNumber = IdentifyEsiId(context, service); var serviceActionCode = string.Empty; if (actionCode.Equals("C", StringComparison.Ordinal)) { serviceActionCode = "A"; } if (actionCode.Equals("13") || actionCode.Equals("21")) { if (service.ActionCode.Equals("WQ", StringComparison.Ordinal)) { serviceActionCode = "A"; } if (service.ActionCode.Equals("U", StringComparison.Ordinal)) { serviceActionCode = "R"; } } var changes = exportDataAccess.ListServiceAccountChanges(serviceKey); if (context.Market == MarketOptions.Maryland) { crDuns = header.CrDuns; if (changes.Any(x => x.ChangeReason.Equals("REFPC", StringComparison.Ordinal))) { continue; } } var line = string.Format( "10|{0}|{1}|{2}||{3}|C|{4}||{5}|||{9}||||||||||||||||||{6}|{10}||||||{7}||||||{8}|||||||||||{11}|", context.TradingPartnerId, service.ServiceType1, service.ServiceType2, lineTrackingNumber, serviceActionCode, membershipId, service.BillType, service.CsaFlag, premiseNumber, crDuns, service.BillCalculator, specialNeedsFlag); context.AppendLine(line); logger.TraceFormat("Wrote 814 \"10\" PRISM line for Header {0}", header.HeaderKey); if (context.Market == MarketOptions.Maryland) { WriteServiceMeter(context, service); WriteServiceMeterChange(context, service); WriteServiceAccountChange(context, service, changes); continue; } if (actionCode.Equals("12")) { WriteServiceDate(context, service); } if (actionCode.Equals("PC", StringComparison.Ordinal)) { WriteServiceMeter(context, service); } } }
public IMarketFileExportResult[] Export(CancellationToken token) { var cspDunsPorts = clientDataAccess.ListCspDunsPort(); var prismPorts = cspDunsPorts .Where(x => x.ProviderId == 1) .ToArray(); var context = new Prism814Context(); foreach (var prismPort in prismPorts) { if (token.IsCancellationRequested) { break; } var headers = exportDataAccess.ListUnprocessed(prismPort.LdcDuns, prismPort.Duns, 1); if (headers.Length == 0) { logger.TraceFormat("Zero 814 Prism records found to export for TDSP Duns \"{0}\" and CR Duns \"{1}\".", prismPort.LdcDuns, prismPort.Duns); continue; } logger.DebugFormat("Exporting {0} unprocessed 814 record(s) for TDSP Duns \"{1}\" and CR Duns \"{2}\".", headers.Length, prismPort.LdcDuns, prismPort.Duns); foreach (var header in headers) { if (!header.HeaderKey.HasValue) { continue; } if (token.IsCancellationRequested) { break; } var headerKey = header.HeaderKey.Value; context.Initialize(); context.ActionCode = header.ActionCode; var identifiedMarket = clientDataAccess.IdentifyMarket(header.TdspDuns); if (identifiedMarket.HasValue) { context.SetMarket(identifiedMarket.Value); } if (context.ActionCode.Equals("PC", StringComparison.Ordinal) || context.ActionCode.Equals("PD", StringComparison.Ordinal) || context.Market != MarketOptions.Texas) { context.SetFileProperties(prismPort, header.TdspDuns, "ENR"); } else { context.SetFileProperties(prismPort, "183529049", "ENR"); } context.SetHeaderId(headerKey); var services = exportDataAccess.ListServices(headerKey); WriteHeader(context, header, services); WriteAccount(context, header); WriteName(context, header); WriteService(context, header, services); } } return(context.Models); }
public void WriteServiceDrop(Prism814Context context, Type814Header header, Type814Service[] services) { var actionCode = context.ActionCode.TrimStart('0'); foreach (var service in services) { if (!service.ServiceKey.HasValue) { continue; } var serviceKey = service.ServiceKey.Value; var lineTrackingNumber = "1"; var crDuns = string.Empty; var dropCode = string.Empty; var specialNeedsFlag = string.Empty; if (context.Market != MarketOptions.Texas) { lineTrackingNumber = serviceKey.ToString(); } if (actionCode.Equals("29")) { dropCode = "09"; } if (actionCode.Equals("10")) { specialNeedsFlag = service.SpecialNeedsIndicator; } var membershipId = IdentifyLdcAccountNumber(context, service); var premiseNumber = IdentifyEsiId(context, service); var serviceActionCode = service.ActionCode; switch (actionCode) { case "18": if (!service.MaintenanceTypeCode.Equals("002")) { return; } break; case "D": dropCode = "P"; break; } if (context.Market == MarketOptions.Maryland) { crDuns = header.CrDuns; if (serviceActionCode.Equals("Q", StringComparison.Ordinal)) { serviceActionCode = string.Empty; } } var line = string.Format( "10|{0}|{1}|{2}|{3}|{4}|D|{5}|{6}|{7}|||{12}||||||||||||||||||{8}|||||||{9}||||||{10}|||{11}||||||||{14}||||{13}|", context.TradingPartnerId, service.ServiceType1, service.ServiceType2, service.ServiceType3, lineTrackingNumber, serviceActionCode, dropCode, membershipId, service.BillType, service.CsaFlag, premiseNumber, service.EnergizedFlag, crDuns, service.MeterAccessNote, specialNeedsFlag); context.AppendLine(line); logger.TraceFormat("Wrote 814 \"10\" PRISM line for Header {0}", header.HeaderKey); if (actionCode.Equals("10") || actionCode.Equals("24")) { WriteServiceDate(context, service); } WriteServiceReject(context, service); WriteServiceStatus(context, service); if (actionCode.Equals("7") || actionCode.Equals("19")) { continue; } WriteServiceMeter(context, service); } }
public void WriteServiceDate(Prism814Context context, Type814Service service) { if (service == null) { return; } var serviceKey = service.ServiceKey ?? 0; if (serviceKey == 0) { return; } var nextDate = string.Empty; var moveInDate = string.Empty; var moveOutDate = string.Empty; var switchDate = string.Empty; var statuses = exportDataAccess.ListServiceStatuses(serviceKey); var statusCode = string.Empty; if (statuses.Any()) { statusCode = statuses[0].StatusCode; } var actionCode = context.ActionCode.TrimStart('0'); switch (actionCode) { case "7": case "10": switchDate = service.SpecialReadSwitchDate; break; case "24": moveOutDate = service.SpecialReadSwitchDate; break; case "8": case "9": nextDate = service.SpecialReadSwitchDate; break; case "12": case "13": if (statusCode.Equals("DTM375")) { moveInDate = service.SpecialReadSwitchDate; } if (statusCode.Equals("DTM376")) { moveOutDate = service.SpecialReadSwitchDate; } break; case "": if (service.MaintenanceTypeCode.Equals("E")) { moveInDate = service.SpecialReadSwitchDate; } if (service.MaintenanceTypeCode.Equals("D")) { moveOutDate = service.SpecialReadSwitchDate; } break; default: if (service.ServiceType3.Equals("SW", StringComparison.Ordinal)) { switchDate = service.SpecialReadSwitchDate; } else { moveInDate = service.SpecialReadSwitchDate; } break; } var agreementDate = DateTime.Now.ToString("yyyyMMdd"); var agreementTime = DateTime.Now.ToString("hhmmss"); if (context.Market == MarketOptions.Texas) { agreementDate = service.RtoDate; agreementTime = service.RtoTime; } var line = string.Format("11|{0}|{1}|{2}||{3}||||||{4}||||{5}|{6}||||", context.TradingPartnerId, agreementDate, agreementTime, nextDate, switchDate, moveInDate, moveOutDate); context.AppendLine(line); logger.TraceFormat("Wrote 814 \"11\" PRISM line for Header {0}", service.HeaderKey); }
public void WriteServiceEnrollment(Prism814Context context, Type814Header header, Type814Service[] services) { var actionCode = context.ActionCode.TrimStart('0'); foreach (var service in services) { if (!service.ServiceKey.HasValue) { continue; } var serviceKey = service.ServiceKey.Value; var lineTrackingNumber = "1"; var specialNeedsFlag = string.Empty; if (context.Market != MarketOptions.Texas) { lineTrackingNumber = serviceKey.ToString(); } if (actionCode.Equals("1") || actionCode.Equals("16")) { specialNeedsFlag = service.SpecialNeedsIndicator; } var membershipId = IdentifyLdcAccountNumber(context, service); var premiseNumber = IdentifyEsiId(context, service); var serviceActionCode = string.Empty; var serviceTransactionTypeCode = string.Empty; switch (actionCode) { case "15": serviceActionCode = service.ActionCode; serviceTransactionTypeCode = service.MaintenanceTypeCode; break; case "18": if (!service.MaintenanceTypeCode.Equals("021")) { return; } serviceActionCode = service.ActionCode; break; case "29": serviceActionCode = service.ActionCode; serviceTransactionTypeCode = service.MaintenanceTypeCode; break; case "26": if (context.Market == MarketOptions.Texas) { membershipId = string.Empty; } break; default: serviceActionCode = service.ActionCode; break; } var priorityCode = service.PriorityCode; if (priorityCode.Length >= 2) { priorityCode = priorityCode.Substring(0, 2); } if (context.Market != MarketOptions.Texas) { serviceActionCode = string.Empty; } var line = string.Format( "10|{0}|{1}|{2}|{3}|{4}|E|{5}|{6}|{7}|||||||||||||{8}||||||||{9}|{10}|||||||||||{11}|{12}||{13}|||||||||{15}||||{14}|||||||||||", context.TradingPartnerId, service.ServiceType1, service.ServiceType2, service.ServiceType3, lineTrackingNumber, serviceActionCode, serviceTransactionTypeCode, membershipId, service.NotificationWaiver, service.BillType, service.BillCalculator, service.ServiceType4, premiseNumber, priorityCode, service.MeterAccessNote, specialNeedsFlag); context.AppendLine(line); logger.TraceFormat("Wrote 814 \"10\" PRISM line for Header {0}", header.HeaderKey); if (!actionCode.Equals("23") && !actionCode.Equals("29")) { if (service.ServiceType3.Equals("SW", StringComparison.Ordinal) || service.ServiceType3.Equals("MVI", StringComparison.Ordinal)) { WriteServiceDate(context, service); } } if (context.Market == MarketOptions.Maryland && actionCode.Equals("E")) { WriteServiceDate(context, service); WriteServiceRateData(context, service); } if (actionCode.Equals("29") || actionCode.Equals("15")) { if (serviceActionCode.Equals("R", StringComparison.Ordinal)) { WriteServiceReject(context, service); } } if (!actionCode.Equals("18") && !actionCode.Equals("21") && !actionCode.Equals("23") && !actionCode.Equals("26") && !actionCode.Equals("29")) { WriteServiceMeter(context, service); } } }