Beispiel #1
0
        private void ParseScheduleDeterminants(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 Type867ScheduleDeterminants
            {
                CapacityObligation     = marketFields.AtIndex(2),
                TransmissionObligation = marketFields.AtIndex(3),
                LoadProfile            = marketFields.AtIndex(4),
                LDCRateClass           = marketFields.AtIndex(5),
                SpecialMeterConfig     = marketFields.AtIndex(12),
                MaximumGeneration      = marketFields.AtIndex(13),
                LDCRateSubClass        = marketFields.AtIndex(14)
            };

            header.AddScheduledDeterminant(model);
        }
Beispiel #2
0
        public Type867ScheduleDeterminants ParseScheduledDeterminant(XElement element, IDictionary <string, XNamespace> namespaces)
        {
            XNamespace empty;

            if (!namespaces.TryGetValue(string.Empty, out empty))
            {
                empty = XNamespace.None;
            }

            var model = new Type867ScheduleDeterminants
            {
                CapacityObligation     = element.GetChildText(empty + "CapacityObligation"),
                TransmissionObligation = element.GetChildText(empty + "TransmissionObligation"),
                LoadProfile            = element.GetChildText(empty + "LoadProfile"),
                LDCRateClass           = element.GetChildText(empty + "LDCRateClass"),
                Zone               = element.GetChildText(empty + "Zone"),
                BillCycle          = element.GetChildText(empty + "BillCycle"),
                MeterNumber        = element.GetChildText(empty + "MeterNumber"),
                EffectiveDate      = element.GetChildText(empty + "EffectiveDate"),
                LossFactor         = element.GetChildText(empty + "LossFactor"),
                ServiceVoltage     = element.GetChildText(empty + "ServiceVoltage"),
                SpecialMeterConfig = element.GetChildText(empty + "SpecialMeterConfig"),
                MaximumGeneration  = element.GetChildText(empty + "MaximumGeneration"),
                LDCRateSubClass    = element.GetChildText(empty + "LDCRateSubClass")
            };

            return(model);
        }
Beispiel #3
0
        public int InsertScheduleDeterminants(Type867ScheduleDeterminants model)
        {
            using (var connection = new SqlConnection(_connectionString))
                using (var command = connection.CreateCommand("csp867ScheduleDeterminantsInsert"))
                {
                    SqlParameter keyParameter;

                    command.AddWithValue("@867_Key", model.HeaderKey)
                    .AddWithValue("@Capacity_Obligation", model.CapacityObligation)
                    .AddWithValue("@Transmission_Obligation", model.TransmissionObligation)
                    .AddWithValue("@Load_Profile", model.LoadProfile)
                    .AddWithValue("@LDC_Rate_Class", model.LDCRateClass)
                    .AddWithValue("@Zone", model.Zone)
                    .AddWithValue("@BillCycle", model.BillCycle)
                    .AddWithValue("@MeterNumber", model.MeterNumber)
                    .AddWithValue("@EffectiveDate", model.EffectiveDate)
                    .AddWithValue("@LossFactor", model.LossFactor)
                    .AddWithValue("@ServiceVoltage", model.ServiceVoltage)
                    .AddWithValue("@SpecialMeterConfig", model.SpecialMeterConfig)
                    .AddWithValue("@MaximumGeneration", model.MaximumGeneration)
                    .AddWithValue("@LDC_Rate_Sub_Class", model.LDCRateSubClass)
                    .AddOutParameter("@ScheduleDeterminants_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.ScheduleDeterminantsKey = key;

                    return(key);
                }
        }