示例#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) }));
 }