public static void UpdatePeriodicZone(PeriodicZone periodicZone) { string query = string.Format("UPDATE {0} SET " + "tipo = @Type, " + "valor = @Value " + "WHERE nombre = @Name AND " + "periodo = @Period", table); using (OleDbCommand command = new OleDbCommand(query, DataBaseManager.DbConnection)) { command.Parameters.Add("@Type", OleDbType.VarChar); command.Parameters.Add("@Value", OleDbType.Numeric); command.Parameters.Add("@Name", OleDbType.VarChar); command.Parameters.Add("@Period", OleDbType.Numeric); DataBaseManager.DbConnection.Open(); command.Parameters["@Type"].Value = periodicZone.Type; command.Parameters["@Value"].Value = periodicZone.Value; command.Parameters["@Name"].Value = periodicZone.Name; command.Parameters["@Period"].Value = periodicZone.Period; int rowsAffected = command.ExecuteNonQuery(); DataBaseManager.DbConnection.Close(); } }
public static void DeletePeriodicZone(PeriodicZone periodicZone) { string query = string.Format("DELETE FROM {0} " + "WHERE nombre = '{1}' " + "AND Periodo = {2} ", table, periodicZone.Name, periodicZone.Period); DataBaseManager.ExecuteQuery(query); }
public PeriodicZonesViewModel(PeriodicZone periodicZone) : base(periodicZone) { this.periodicZone = periodicZone; }