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(); } }
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); }
public PeriodicHydroSystemsViewModel(PeriodicHydroSystem periodicHydroSystem) : base(periodicHydroSystem) { this.periodicHydroSystem = periodicHydroSystem; }