Example #1
0
        public static void DeletePeriodicHydroPlant(PeriodicConventionalPlant periodicHydroPlant)
        {
            string query = string.Format("DELETE FROM {0} " +
                                         "WHERE Nombre = '{1}' " +
                                         "AND Periodo = {2} ",
                                         table, periodicHydroPlant.Name, periodicHydroPlant.Period);

            DataBaseManager.ExecuteQuery(query);
        }
Example #2
0
        public static void UpdatePeriodicHydroPlant(PeriodicConventionalPlant periodicHydroPlant)
        {
            string query = string.Format("UPDATE {0} SET " +
                                         "CostoVariable = @VariableCost, " +
                                         "Minimo = @Min, " +
                                         "Maximo = @Max, " +
                                         "Obligatorio = @Mandatory " +
                                         "WHERE Nombre = @Name AND " +
                                         "periodo = @Period AND " +
                                         "escenario = @Case", table);

            using (OleDbCommand command = new OleDbCommand(query, DataBaseManager.DbConnection))
            {
                command.Parameters.Add("@VariableCost", OleDbType.Numeric);
                command.Parameters.Add("@Min", OleDbType.Numeric);
                command.Parameters.Add("@Max", OleDbType.Numeric);
                command.Parameters.Add("@Mandatory", OleDbType.Numeric);
                command.Parameters.Add("@Name", OleDbType.VarChar);
                command.Parameters.Add("@Period", OleDbType.Numeric);
                command.Parameters.Add("@Case", OleDbType.Numeric);

                DataBaseManager.DbConnection.Open();

                command.Parameters["@VariableCost"].Value = periodicHydroPlant.VariableCost;
                command.Parameters["@Min"].Value          = periodicHydroPlant.Min;
                command.Parameters["@Max"].Value          = periodicHydroPlant.Max;
                command.Parameters["@Mandatory"].Value    = periodicHydroPlant.IsMandatory;
                command.Parameters["@Name"].Value         = periodicHydroPlant.Name;
                command.Parameters["@Period"].Value       = periodicHydroPlant.Period;
                command.Parameters["@Case"].Value         = periodicHydroPlant.Case;

                int rowsAffected = command.ExecuteNonQuery();

                DataBaseManager.DbConnection.Close();
            }
        }
Example #3
0
 public PeriodicConventionalPlantsViewModel(PeriodicConventionalPlant periodicHydroPlant) : base(periodicHydroPlant)
 {
     this.periodicHydroPlant = periodicHydroPlant;
 }