public void InsertNonIntervalSummaryQty(Type867NonIntervalSummaryQty model) { using (var connection = new SqlConnection(_connectionString)) using (var command = connection.CreateCommand("csp867NonIntervalSummaryQtyInsert")) { command.AddWithValue("@NonIntervalSummary_Key", model.NonIntervalSummaryKey) .AddIfNotEmptyOrDbNull("@Qualifier", model.Qualifier) .AddIfNotEmptyOrDbNull("@Quantity", model.Quantity) .AddIfNotEmptyOrDbNull("@MeasurementSignificanceCode", model.MeasurementSignificanceCode) .AddIfNotEmptyOrDbNull("@ServicePeriodStart", model.ServicePeriodStart) .AddIfNotEmptyOrDbNull("@ServicePeriodEnd", model.ServicePeriodEnd) .AddWithValue("@RangeMin", model.RangeMin) .AddWithValue("@RangeMax", model.RangeMax) .AddWithValue("@ThermFactor", model.ThermFactor) .AddWithValue("@DegreeDayFactor", model.DegreeDayFactor) .AddWithValue("@CompositeUOM", model.CompositeUom); if (connection.State != ConnectionState.Open) { connection.Open(); } command.ExecuteNonQuery(); } }
public Type867NonIntervalSummaryQty ParseNonIntervalSummaryQty(XElement element, IDictionary <string, XNamespace> namespaces) { XNamespace empty; if (!namespaces.TryGetValue(string.Empty, out empty)) { empty = XNamespace.None; } var model = new Type867NonIntervalSummaryQty { Qualifier = element.GetChildText(empty + "Qualifier"), Quantity = element.GetChildText(empty + "Quantity"), MeasurementSignificanceCode = element.GetChildText(empty + "MeasurementSignificanceCode"), ServicePeriodStart = element.GetChildText(empty + "ServicePeriodStart"), ServicePeriodEnd = element.GetChildText(empty + "ServicePeriodEnd"), RangeMin = element.GetChildText(empty + "RangeMin"), RangeMax = element.GetChildText(empty + "RangeMax"), ThermFactor = element.GetChildText(empty + "ThermFactor"), DegreeDayFactor = element.GetChildText(empty + "DegreeDayFactor"), CompositeUom = element.GetChildText(empty + "CompositeUOM") }; return(model); }
private void ParseNonIntervalSummaryQty(Prism867Context context, string[] marketFields) { // If Market is Maryland then we need to add the detail model first // as it was not done with ParseNonIntervalSummary call earlier if (context.Market == MarketOptions.Maryland) { //This will also put the correct detail model in context Stack ParseNonIntervalSummaryForMaryland(context, marketFields); } var current = context.Current; if (current == null || current.ModelType != Type867Types.NonIntervalSummary) { throw new InvalidOperationException(); } var detail = current as Type867NonIntervalSummary; if (detail == null) { throw new InvalidOperationException(); } var model = new Type867NonIntervalSummaryQty(); if (context.Market == MarketOptions.Maryland) { // MD does not provide 09 records in 867 transactions so we are parsing these as 08 records // 08 records do not contain begin/end date so we are using dates from the preceeding 07 record // We aren't getting any TOU usage in MD model.Qualifier = context.Qualifier; model.Quantity = context.Quantity; model.MeasurementSignificanceCode = "51"; model.ServicePeriodStart = context.R07ServicePeriodBeginDate; model.ServicePeriodEnd = context.R07ServicePeriodEndDate; } else { model.Qualifier = context.Qualifier; model.Quantity = marketFields.AtIndex(2); model.MeasurementSignificanceCode = marketFields.AtIndex(3); model.ServicePeriodStart = marketFields.AtIndex(4); model.ServicePeriodEnd = marketFields.AtIndex(5); } detail.AddQuantity(model); }