예제 #1
0
        public static void UpdatePeriodicHydroSystem(PeriodicHydroSystem periodicHydroSystem)
        {
            string query = string.Format("UPDATE {0} SET " +
                                         "turbinamientoMinimo = @MinTurbinedOutflow, " +
                                         "turbinamientoMaximo = @MaxTurbinedOutflow " +
                                         "WHERE sistema = @Name AND " +
                                         "periodo = @Period", table);

            using (OleDbCommand command = new OleDbCommand(query, DataBaseManager.DbConnection))
            {
                command.Parameters.Add("@MinTurbinedOutflow", OleDbType.Numeric);
                command.Parameters.Add("@MaxTurbinedOutflow", OleDbType.Numeric);
                command.Parameters.Add("@Name", OleDbType.VarChar);
                command.Parameters.Add("@Period", OleDbType.Numeric);

                DataBaseManager.DbConnection.Open();

                command.Parameters["@MinTurbinedOutflow"].Value = periodicHydroSystem.MinTurbinedOutflow;
                command.Parameters["@MaxTurbinedOutflow"].Value = periodicHydroSystem.MaxTurbinedOutflow;
                command.Parameters["@Name"].Value   = periodicHydroSystem.Name;
                command.Parameters["@Period"].Value = periodicHydroSystem.Period;

                int rowsAffected = command.ExecuteNonQuery();

                DataBaseManager.DbConnection.Close();
            }
        }
예제 #2
0
        public static void DeletePeriodicHydroSystem(PeriodicHydroSystem periodicHydroSystem)
        {
            string query = string.Format("DELETE FROM {0} " +
                                         "WHERE sistema = '{1}' " +
                                         "AND Periodo = {2} ",
                                         table, periodicHydroSystem.Name, periodicHydroSystem.Period);

            DataBaseManager.ExecuteQuery(query);
        }
예제 #3
0
 public PeriodicHydroSystemsViewModel(PeriodicHydroSystem periodicHydroSystem) : base(periodicHydroSystem)
 {
     this.periodicHydroSystem = periodicHydroSystem;
 }