Пример #1
0
        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]);
            }
        }
Пример #2
0
 public static Cycles LoadAllCycles()
 {
     return(Cycles.LoadCycles("LoadCyclesAll", CommandType.StoredProcedure, null));
 }
Пример #3
0
 public static Cycles LoadCyclesByThermostatId(int thermostatId)
 {
     return(Cycles.LoadCycles("cycles_load_by_thermostat_id", CommandType.StoredProcedure, new MySqlParameter[] { new MySqlParameter("@thermostat_id", thermostatId) }));
 }
Пример #4
0
 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) }));
 }