public static Cycle LoadOpenCycle(int thermostatId) { Cycles cycles = Cycles.LoadCycles("SELECT * FROM Cycles WHERE ThermostatId=@ThermostatId and EndDate IS NULL", CommandType.Text, new SqlParameter[] { new SqlParameter("@ThermostatId", thermostatId) }); if (cycles.Count == 0) { return(null); } else { return(cycles[0]); } }
public static Cycles LoadAllCycles() { return(Cycles.LoadCycles("LoadCyclesAll", CommandType.StoredProcedure, null)); }
public static Cycles LoadCyclesByThermostatId(int thermostatId) { return(Cycles.LoadCycles("cycles_load_by_thermostat_id", CommandType.StoredProcedure, new MySqlParameter[] { new MySqlParameter("@thermostat_id", thermostatId) })); }
public static Cycles LoadRange(System.Int32 thermostatId, DateTime startDate, DateTime endDate) { return(Cycles.LoadCycles("SELECT * FROM Cycles WHERE ThermostatID=@ThermostatId AND StartDate BETWEEN @StartDate and @EndDate", CommandType.Text, new SqlParameter[] { new SqlParameter("@ThermostatId", thermostatId), new SqlParameter("@StartDate", startDate), new SqlParameter("@EndDate", endDate) })); }