private void ParseNetIntervalSummary(Prism867Context context, string[] marketFields) { var current = context.Current; if (current == null || current.ModelType != Type867Types.Header) { throw new InvalidOperationException(); } var header = current as Type867Header; if (header == null) { throw new InvalidOperationException(); } var model = new Type867NetIntervalSummary { MeterUom = marketFields.AtIndex(6), MeterInterval = marketFields.AtIndex(7), TypeCode = context.RecordType }; context.PushModel(model); header.AddNetInervalSummary(model); }
public int InsertNetIntervalSummary(Type867NetIntervalSummary model) { using (var connection = new SqlConnection(_connectionString)) using (var command = connection.CreateCommand("csp867NetIntervalSummaryInsert")) { SqlParameter keyParameter; command.AddWithValue("@867_Key", model.HeaderKey) .AddIfNotEmptyOrDbNull("@TypeCode", model.TypeCode) .AddIfNotEmptyOrDbNull("@MeterUOM", model.MeterUom) .AddIfNotEmptyOrDbNull("@MeterInterval", model.MeterInterval) .AddOutParameter("@NetIntervalSummary_Key", SqlDbType.Int, out keyParameter); if (connection.State != ConnectionState.Open) { connection.Open(); } command.ExecuteNonQuery(); if (keyParameter.Value == null) { throw new Exception(); } var key = (int)keyParameter.Value; model.NetIntervalSummaryKey = key; return(key); } }
public int InsertNetIntervalSummary(Type867NetIntervalSummary model) { return(-1); }