public Type820Detail ParseDetail(XElement element, IDictionary <string, XNamespace> namespaces) { XNamespace empty; if (!namespaces.TryGetValue(string.Empty, out empty)) { empty = XNamespace.None; } var model = new Type820Detail { AdjustmentAmount = element.GetChildText(empty + "AdjustmentAmount"), AdjustmentReasonCode = element.GetChildText(empty + "AdjustmentReasonCode"), AssignedId = element.GetChildText(empty + "AssignedId"), CommodityCode = element.GetChildText(empty + "CommodityCode"), CrossReferenceNbr = element.GetChildText(empty + "CrossReferenceNbr"), CustomerName = element.GetChildText(empty + "CustomerName"), DatePosted = element.GetChildText(empty + "DatePosted"), DiscountAmount = element.GetChildText(empty + "DiscountAmount"), EsiId = element.GetChildText(empty + "EsiId"), ESPAccountNumber = element.GetChildText(empty + "ESPAccountNumber"), InvoiceAmount = element.GetChildText(empty + "InvoiceAmount"), PaymentActionCode = element.GetChildText(empty + "PaymentActionCode"), PaymentAmount = element.GetChildText(empty + "PaymentAmount"), PrevUtilityAccountNumber = element.GetChildText(empty + "PrevUtilityAccountNumber"), ReferenceId = element.GetChildText(empty + "ReferenceId"), ReferenceNbr = element.GetChildText(empty + "ReferenceNbr"), UnmeteredServiceDesignator = element.GetChildText(empty + "UnmeteredServiceDesignator"), }; return(model); }
public int InsertDetail(Type820Detail model) { using (var connection = new SqlConnection(connectionString)) using (var command = connection.CreateCommand("csp820DetailInsert")) { command.AddWithValue("@820_Key", model.HeaderKey) .AddWithValue("@AssignedId", model.AssignedId) .AddWithValue("@ReferenceId", model.ReferenceId) .AddWithValue("@ReferenceNbr", model.ReferenceNbr) .AddWithValue("@CrossReferenceNbr", model.CrossReferenceNbr) .AddWithValue("@PaymentActionCode", model.PaymentActionCode) .AddIfNotEmptyOrDbNull("@PaymentAmount", model.PaymentAmount) .AddWithValue("@AdjustmentReasonCode", model.AdjustmentReasonCode) .AddWithValue("@AdjustmentAmount", model.AdjustmentAmount) .AddIfNotEmptyOrDbNull("@EsiId", model.EsiId) .AddWithValue("@CommodityCode", model.CommodityCode) .AddWithValue("@InvoiceAmount", model.InvoiceAmount) .AddWithValue("@DiscountAmount", model.DiscountAmount) .AddWithValue("@PrevUtilityAccountNumber", model.PrevUtilityAccountNumber) .AddWithValue("@ESPAccountNumber", model.ESPAccountNumber) .AddWithValue("@CustomerName", model.CustomerName) .AddWithValue("@DatePosted", model.DatePosted) .AddWithValue("@UnmeteredServiceDesignator", model.UnmeteredServiceDesignator); if (connection.State != ConnectionState.Open) { connection.Open(); } command.ExecuteNonQuery(); model.DetailKey = 1; return(1); } }
public int InsertDetail(Type820Detail model) { using (var connection = new SqlConnection(connectionString)) using (var command = connection.CreateCommand("csp820DetailInsert")) { command.AddWithValue("@820_Key", model.HeaderKey) .AddWithValue("@AssignedId", model.AssignedId) .AddWithValue("@ReferenceNbr", model.ReferenceNbr) .AddWithValue("@CrossReferenceNbr", model.CrossReferenceNbr) .AddWithValue("@PaymentActionCode", model.PaymentActionCode) .AddIfNotEmptyOrDbNull("@PaymentAmount", model.PaymentAmount) .AddWithValue("@AdjustmentReasonCode", model.AdjustmentReasonCode) .AddWithValue("@AdjustmentAmount", model.AdjustmentAmount) .AddIfNotEmptyOrDbNull("@EsiId", model.EsiId); if (connection.State != ConnectionState.Open) { connection.Open(); } command.ExecuteNonQuery(); model.DetailKey = 1; return(1); } }
public Type820Detail[] ListDetails(int headerKey) { using (var connection = new SqlConnection(connectionString)) using (var command = connection.CreateCommand("csp820ExportListDetailRecords")) { command.AddWithValue("@820Key", headerKey); if (connection.State != ConnectionState.Open) { connection.Open(); } var collection = new List <Type820Detail>(); using (var reader = command.ExecuteReader()) { while (reader.Read()) { var item = new Type820Detail { HeaderKey = headerKey, DetailKey = reader.GetInt32("Detail_Key"), }; reader.TryGetString("ReferenceNbr", x => item.ReferenceNbr = x); reader.TryGetString("CrossReferenceNbr", x => item.CrossReferenceNbr = x); reader.TryGetString("PaymentAmount", x => item.PaymentAmount = x); reader.TryGetString("EsiId", x => item.EsiId = x); collection.Add(item); } return(collection.ToArray()); } } }
public string IdentifyEsiId(Prism820Context context, Type820Detail detail) { if (context.Market == MarketOptions.Maryland) { return(string.Empty); } return(detail.EsiId); }
public Type820Detail[] ListDetails(int headerKey) { using (var connection = new SqlConnection(connectionString)) using (var command = connection.CreateCommand("esp_820DetailList")) { command.AddWithValue("@HeaderKey", headerKey); if (connection.State != ConnectionState.Open) { connection.Open(); } var collection = new List <Type820Detail>(); using (var reader = command.ExecuteReader()) { while (reader.Read()) { var item = new Type820Detail { HeaderKey = headerKey, DetailKey = reader.GetInt32("Detail_Key"), ProcessFlag = reader.GetInt32("ProcessFlag"), }; reader.TryGetString("AssignedId", x => item.AssignedId = x); reader.TryGetString("ReferenceId", x => item.ReferenceId = x); reader.TryGetString("ReferenceNbr", x => item.ReferenceNbr = x); reader.TryGetString("CrossReferenceNbr", x => item.CrossReferenceNbr = x); reader.TryGetString("PaymentActionCode", x => item.PaymentActionCode = x); reader.TryGetString("PaymentAmount", x => item.PaymentAmount = x); reader.TryGetString("AdjustmentReasonCode", x => item.AdjustmentReasonCode = x); reader.TryGetString("AdjustmentAmount", x => item.AdjustmentAmount = x); reader.TryGetString("EsiId", x => item.EsiId = x); reader.TryGetDateTime("ProcessDate", x => item.ProcessDate = x); reader.TryGetString("CommodityCode", x => item.CommodityCode = x); reader.TryGetString("InvoiceAmount", x => item.InvoiceAmount = x); reader.TryGetString("DiscountAmount", x => item.DiscountAmount = x); reader.TryGetString("PrevUtilityAccountNumber", x => item.PrevUtilityAccountNumber = x); reader.TryGetString("ESPAccountNumber", x => item.ESPAccountNumber = x); reader.TryGetString("CustomerName", x => item.CustomerName = x); reader.TryGetString("DatePosted", x => item.DatePosted = x); reader.TryGetString("UnmeteredServiceDesignator", x => item.UnmeteredServiceDesignator = x); collection.Add(item); } return(collection.ToArray()); } } }
public string IdentifyLdcAccountNumber(Prism820Context context, Type820Detail detail) { if (context.Market == MarketOptions.Maryland) { return(detail.EsiId); } // original code has Util.GetString(dr, "MembershipID") // which is a column that was not found in the 820 Detail table // the "Util" call would result in an empty string being // returned return(string.Empty); }
public void ParseDetail(Prism820Context context, string[] marketFields) { var current = context.Current; if (current == null || current.ModelType != Type820Types.Header) { throw new InvalidOperationException(); } var header = current as Type820Header; if (header == null) { throw new InvalidOperationException(); } var model = new Type820Detail { ReferenceNbr = marketFields.AtIndex(2), PaymentActionCode = marketFields.AtIndex(3), PaymentAmount = marketFields.AtIndex(4), AdjustmentReasonCode = marketFields.AtIndex(5), AdjustmentAmount = marketFields.AtIndex(6), }; if (context.Market == MarketOptions.Maryland) { marketFields.TryAtIndex(11, x => model.CrossReferenceNbr = x); marketFields.TryAtIndex(2, x => model.EsiId = x); } else { marketFields.TryAtIndex(9, x => model.CrossReferenceNbr = x); marketFields.TryAtIndex(16, x => model.EsiId = x); } header.AddDetail(model); }