예제 #1
0
        public List <lfa.pmgmt.data.DTO.Schedule.Schedule> ListSchedules()
        {
            lfa.pmgmt.data.DAO.Schedule.Schedule scheduleDAO = new data.DAO.Schedule.Schedule();
            scheduleDAO.ConnectionString = _connectionString;

            List <lfa.pmgmt.data.DTO.Schedule.Schedule> scheduleList = scheduleDAO.List();

            return(scheduleList);
        }
예제 #2
0
        private void BindScheduleData()
        {
            lfa.pmgmt.data.DAO.Schedule.Schedule scheduleDAO = new data.DAO.Schedule.Schedule();
            scheduleDAO.ConnectionString = _connectionString;

            List <lfa.pmgmt.data.DTO.Schedule.Schedule> list = scheduleDAO.List();

            btnGrdMainHeader.Text = "Schedules";
            grdMain.DataSource    = list;

            btnGrdChildOneHeader.Text = "Units";

            btnGrdChildTwoHeader.Text = "Devices";
        }
예제 #3
0
        private void BindSchedules()
        {
            lfa.pmgmt.data.DAO.Schedule.Schedule scheduleDAO = new data.DAO.Schedule.Schedule();
            scheduleDAO.ConnectionString = _connectionString;

            List<lfa.pmgmt.data.DTO.Schedule.Schedule> schedules = scheduleDAO.List();

            foreach (lfa.pmgmt.data.DTO.Schedule.Schedule schedule in schedules)
            {
                ComboItem item = new ComboItem();
                item.Id = schedule.Id;
                item.Name = schedule.Name;

                comboBox1.Items.Add(item);
            }
        }
예제 #4
0
        private void BindSchedules()
        {
            lfa.pmgmt.data.DAO.Schedule.Schedule scheduleDAO = new data.DAO.Schedule.Schedule();
            scheduleDAO.ConnectionString = _connectionString;

            List <lfa.pmgmt.data.DTO.Schedule.Schedule> schedules = scheduleDAO.List();

            foreach (lfa.pmgmt.data.DTO.Schedule.Schedule schedule in schedules)
            {
                ComboItem item = new ComboItem();
                item.Id   = schedule.Id;
                item.Name = schedule.Name;

                comboBox1.Items.Add(item);
            }
        }
예제 #5
0
        public void Execute(int defaultPort)
        {
            _switchStates = new Dictionary <string, string>();

            _executed = new List <string>();
            int ruleCount = 0;

            lfa.pmgmt.data.DAO.Schedule.Schedule scheduleDAO = new data.DAO.Schedule.Schedule();
            scheduleDAO.ConnectionString = _connectionString;

            List <lfa.pmgmt.data.DTO.Schedule.Schedule> scheduleList = scheduleDAO.List();

            foreach (lfa.pmgmt.data.DTO.Schedule.Schedule schedule in scheduleList)
            {
                if (schedule.IsActive)
                {
                    string scheduleStartTime = schedule.StartTime;
                    string scheduleEndTime   = schedule.EndTime;

                    DateTime currentTime   = DateTime.Now;
                    DateTime scheduleStart = Convert.ToDateTime(scheduleStartTime);
                    DateTime scheduleEnd   = Convert.ToDateTime(scheduleEndTime);

                    if (scheduleStart > scheduleEnd)
                    {
                        scheduleEnd = scheduleEnd.AddDays(1);
                    }

                    if (currentTime <= scheduleEnd)
                    {
                        if (currentTime >= scheduleStart)
                        {
                            lfa.pmgmt.data.DAO.Schedule.Schedule DAO = new data.DAO.Schedule.Schedule();
                            DAO.ConnectionString = _connectionString;

                            string priorityValue = DAO.GetPriority(schedule.Id);

                            if (string.IsNullOrEmpty(priorityValue))
                            {
                                int status = 0;
                                lfa.pmgmt.data.DAO.Schedule.Unit unitDAO = new data.DAO.Schedule.Unit();
                                unitDAO.ConnectionString = _connectionString;
                                List <lfa.pmgmt.data.DTO.Schedule.Unit> scheduleUnits = unitDAO.List(schedule.Id);

                                GetScheduleUnitDetails(scheduleUnits, schedule.Id, defaultPort, status);
                            }
                            else
                            {
                                int status = 0;
                                lfa.pmgmt.data.DAO.Schedule.Unit unitDAO = new data.DAO.Schedule.Unit();
                                unitDAO.ConnectionString = _connectionString;
                                List <lfa.pmgmt.data.DTO.Schedule.Unit> scheduleUnits = unitDAO.List(schedule.Id);

                                if (ExecutePriority(_connectionString, priorityValue, out status, out ruleCount))
                                {
                                    GetScheduleUnitDetails(scheduleUnits, schedule.Id, defaultPort, status);

                                    _executed.Add("true");
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #6
0
        private void BindScheduleData()
        {
            lfa.pmgmt.data.DAO.Schedule.Schedule scheduleDAO = new data.DAO.Schedule.Schedule();
            scheduleDAO.ConnectionString = _connectionString;

            List<lfa.pmgmt.data.DTO.Schedule.Schedule> list = scheduleDAO.List();

            btnGrdMainHeader.Text = "Schedules";
            grdMain.DataSource = list;

            btnGrdChildOneHeader.Text = "Units";

            btnGrdChildTwoHeader.Text = "Devices";
        }
예제 #7
0
        public void Execute(int defaultPort)
        {
            _executed = new List <string>();

            lfa.pmgmt.data.DAO.Schedule.Schedule scheduleDAO = new data.DAO.Schedule.Schedule();
            scheduleDAO.ConnectionString = _connectionString;

            List <lfa.pmgmt.data.DTO.Schedule.Schedule> scheduleList = scheduleDAO.List();

            foreach (lfa.pmgmt.data.DTO.Schedule.Schedule schedule in scheduleList)
            {
                if (schedule.IsActive)
                {
                    string scheduleStartTime = schedule.StartTime;
                    string scheduleEndTime   = schedule.EndTime;

                    DateTime currentTime   = DateTime.Now;
                    DateTime scheduleStart = Convert.ToDateTime(scheduleStartTime);
                    DateTime scheduleEnd   = Convert.ToDateTime(scheduleEndTime);

                    if (currentTime <= scheduleEnd)
                    {
                        if (currentTime >= scheduleStart)
                        {
                            lfa.pmgmt.data.DAO.Schedule.Schedule DAO = new data.DAO.Schedule.Schedule();
                            DAO.ConnectionString = _connectionString;

                            string priorityValue = DAO.GetPriority(schedule.Id);

                            if (string.IsNullOrEmpty(priorityValue))
                            {
                                lfa.pmgmt.data.DAO.Schedule.Unit unitDAO = new data.DAO.Schedule.Unit();
                                unitDAO.ConnectionString = _connectionString;
                                List <lfa.pmgmt.data.DTO.Schedule.Unit> scheduleUnits = unitDAO.List(schedule.Id);

                                GetScheduleUnitDetails(scheduleUnits, schedule.Id, defaultPort);
                            }
                            else
                            {
                                lfa.pmgmt.data.DAO.Schedule.Unit unitDAO = new data.DAO.Schedule.Unit();
                                unitDAO.ConnectionString = _connectionString;
                                List <lfa.pmgmt.data.DTO.Schedule.Unit> scheduleUnits = unitDAO.List(schedule.Id);

                                if (ExecutePriority(_connectionString, priorityValue))
                                {
                                    GetScheduleUnitDetails(scheduleUnits, schedule.Id, defaultPort);

                                    _executed.Add("true");
                                }

                                #region OBSOLETE
                                //if (priorityValue.ToLower().Equals("low"))
                                //{
                                //    ExecutePriority(connectionString,priority)
                                //    {
                                //      GetScheduleUnitDetails(scheduleUnits, schedule.Id, defaultPort);
                                //    }
                                //}

                                //if (priorityValue.ToLower().Equals("medium"))
                                //{
                                //    GetScheduleUnitDetails(scheduleUnits, schedule.Id, defaultPort);

                                //    lfa.pmgmt.data.DAO.Schedule.Schedule dao = new data.DAO.Schedule.Schedule();

                                //    dao.ConnectionString = _connectionString;
                                //    int zoneid = dao.GetLinkedZone(schedule.Id);

                                //    List<int> scheduleIds = dao.ListPrioritySchedules(zoneid, "Low");

                                //    foreach (int id in scheduleIds)
                                //    {
                                //        List<lfa.pmgmt.data.DTO.Schedule.Unit> i_scheduleUnits = unitDAO.List(id);

                                //        GetScheduleUnitDetails(i_scheduleUnits, id, defaultPort);
                                //    }

                                //}

                                //if (priorityValue.ToLower().Equals("high"))
                                //{
                                //    GetScheduleUnitDetails(scheduleUnits, schedule.Id, defaultPort);

                                //    lfa.pmgmt.data.DAO.Schedule.Schedule dao = new data.DAO.Schedule.Schedule();

                                //    dao.ConnectionString = _connectionString;
                                //    int zoneid = dao.GetLinkedZone(schedule.Id);

                                //    List<int> scheduleIds = dao.ListPrioritySchedules(zoneid, "Medium");

                                //    foreach (int id in scheduleIds)
                                //    {
                                //        List<lfa.pmgmt.data.DTO.Schedule.Unit> i_scheduleUnits = unitDAO.List(id);

                                //        GetScheduleUnitDetails(i_scheduleUnits, id, defaultPort);
                                //    }

                                //    List<int> lowscheduleIds = dao.ListPrioritySchedules(zoneid, "Low");

                                //    foreach (int id in lowscheduleIds)
                                //    {
                                //        List<lfa.pmgmt.data.DTO.Schedule.Unit> i_scheduleUnits = unitDAO.List(id);

                                //        GetScheduleUnitDetails(i_scheduleUnits, id, defaultPort);
                                //    }
                                //}
                                #endregion
                            }
                        }
                    }
                }
            }
        }
예제 #8
0
        public void Execute(int defaultPort)
        {
            try
            {
                Dictionary<string, string>  _switchStates = new Dictionary<string, string>();

                List<string> _executed = new List<string>();

                int ruleCount = 0;

                lfa.pmgmt.data.DAO.Schedule.Schedule scheduleDAO = new data.DAO.Schedule.Schedule();
                scheduleDAO.ConnectionString = _connectionString;

                List<lfa.pmgmt.data.DTO.Schedule.Schedule> scheduleList = scheduleDAO.List();

                foreach (lfa.pmgmt.data.DTO.Schedule.Schedule schedule in scheduleList)
                {
                    if (schedule.IsActive)
                    {
                        string scheduleStartTime = schedule.StartTime;
                        string scheduleEndTime = schedule.EndTime;

                        DateTime currentTime = DateTime.Now;
                        DateTime scheduleStart = Convert.ToDateTime(scheduleStartTime);
                        DateTime scheduleEnd = Convert.ToDateTime(scheduleEndTime);

                        if (scheduleStart > scheduleEnd)
                        {
                            scheduleEnd = scheduleEnd.AddDays(1);
                        }

                        if (currentTime <= scheduleEnd)
                        {
                            if (currentTime >= scheduleStart)
                            {
                                lfa.pmgmt.data.DAO.Schedule.Schedule DAO = new data.DAO.Schedule.Schedule();
                                DAO.ConnectionString = _connectionString;

                                string priorityValue = DAO.GetPriority(schedule.Id);

                                if (string.IsNullOrEmpty(priorityValue))
                                {
                                    int status = 0;
                                    lfa.pmgmt.data.DAO.Schedule.Unit unitDAO = new data.DAO.Schedule.Unit();
                                    unitDAO.ConnectionString = _connectionString;
                                    List<lfa.pmgmt.data.DTO.Schedule.Unit> scheduleUnits = unitDAO.List(schedule.Id);

                                    GetScheduleUnitDetails(scheduleUnits, schedule.Id, defaultPort, status);
                                }
                                else
                                {
                                    int status = 0;
                                    lfa.pmgmt.data.DAO.Schedule.Unit unitDAO = new data.DAO.Schedule.Unit();
                                    unitDAO.ConnectionString = _connectionString;
                                    List<lfa.pmgmt.data.DTO.Schedule.Unit> scheduleUnits = unitDAO.List(schedule.Id);

                                    if (ExecutePriority(_connectionString, priorityValue, out status, out ruleCount))
                                    {
                                        GetScheduleUnitDetails(scheduleUnits, schedule.Id, defaultPort, status);

                                        _executed.Add("true");
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                //File.AppendAllText(@"c:\smartpower\logerr2.txt", ex.ToString());
            }
        }
예제 #9
0
        public List<lfa.pmgmt.data.DTO.Schedule.Schedule> ListSchedules()
        {
            lfa.pmgmt.data.DAO.Schedule.Schedule scheduleDAO = new data.DAO.Schedule.Schedule();
            scheduleDAO.ConnectionString = _connectionString;

            List<lfa.pmgmt.data.DTO.Schedule.Schedule> scheduleList = scheduleDAO.List();

            return scheduleList;
        }
예제 #10
0
        public void Execute(int defaultPort)
        {
            _executed = new List<string>();

            lfa.pmgmt.data.DAO.Schedule.Schedule scheduleDAO = new data.DAO.Schedule.Schedule();
            scheduleDAO.ConnectionString = _connectionString;

            List<lfa.pmgmt.data.DTO.Schedule.Schedule> scheduleList = scheduleDAO.List();

            foreach (lfa.pmgmt.data.DTO.Schedule.Schedule schedule in scheduleList)
            {
                if (schedule.IsActive)
                {
                    string scheduleStartTime = schedule.StartTime;
                    string scheduleEndTime = schedule.EndTime;

                    DateTime currentTime = DateTime.Now;
                    DateTime scheduleStart = Convert.ToDateTime(scheduleStartTime);
                    DateTime scheduleEnd = Convert.ToDateTime(scheduleEndTime);

                    if (currentTime <= scheduleEnd)
                    {
                        if (currentTime >= scheduleStart)
                        {
                            lfa.pmgmt.data.DAO.Schedule.Schedule DAO = new data.DAO.Schedule.Schedule();
                            DAO.ConnectionString = _connectionString;

                            string priorityValue = DAO.GetPriority(schedule.Id);

                            if (string.IsNullOrEmpty(priorityValue))
                            {
                                lfa.pmgmt.data.DAO.Schedule.Unit unitDAO = new data.DAO.Schedule.Unit();
                                unitDAO.ConnectionString = _connectionString;
                                List<lfa.pmgmt.data.DTO.Schedule.Unit> scheduleUnits = unitDAO.List(schedule.Id);

                                GetScheduleUnitDetails(scheduleUnits, schedule.Id, defaultPort);
                            }
                            else
                            {
                                    lfa.pmgmt.data.DAO.Schedule.Unit unitDAO = new data.DAO.Schedule.Unit();
                                    unitDAO.ConnectionString = _connectionString;
                                    List<lfa.pmgmt.data.DTO.Schedule.Unit> scheduleUnits = unitDAO.List(schedule.Id);

                                    if (ExecutePriority(_connectionString, priorityValue))
                                    {
                                        GetScheduleUnitDetails(scheduleUnits, schedule.Id, defaultPort);

                                        _executed.Add("true");
                                    }

                                #region OBSOLETE
                                //if (priorityValue.ToLower().Equals("low"))
                                    //{
                                    //    ExecutePriority(connectionString,priority)
                                    //    {
                                    //      GetScheduleUnitDetails(scheduleUnits, schedule.Id, defaultPort);
                                    //    }
                                    //}

                                    //if (priorityValue.ToLower().Equals("medium"))
                                    //{
                                    //    GetScheduleUnitDetails(scheduleUnits, schedule.Id, defaultPort);

                                    //    lfa.pmgmt.data.DAO.Schedule.Schedule dao = new data.DAO.Schedule.Schedule();

                                    //    dao.ConnectionString = _connectionString;
                                    //    int zoneid = dao.GetLinkedZone(schedule.Id);

                                    //    List<int> scheduleIds = dao.ListPrioritySchedules(zoneid, "Low");

                                    //    foreach (int id in scheduleIds)
                                    //    {
                                    //        List<lfa.pmgmt.data.DTO.Schedule.Unit> i_scheduleUnits = unitDAO.List(id);

                                    //        GetScheduleUnitDetails(i_scheduleUnits, id, defaultPort);
                                    //    }

                                    //}

                                    //if (priorityValue.ToLower().Equals("high"))
                                    //{
                                    //    GetScheduleUnitDetails(scheduleUnits, schedule.Id, defaultPort);

                                    //    lfa.pmgmt.data.DAO.Schedule.Schedule dao = new data.DAO.Schedule.Schedule();

                                    //    dao.ConnectionString = _connectionString;
                                    //    int zoneid = dao.GetLinkedZone(schedule.Id);

                                    //    List<int> scheduleIds = dao.ListPrioritySchedules(zoneid, "Medium");

                                    //    foreach (int id in scheduleIds)
                                    //    {
                                    //        List<lfa.pmgmt.data.DTO.Schedule.Unit> i_scheduleUnits = unitDAO.List(id);

                                    //        GetScheduleUnitDetails(i_scheduleUnits, id, defaultPort);
                                    //    }

                                    //    List<int> lowscheduleIds = dao.ListPrioritySchedules(zoneid, "Low");

                                    //    foreach (int id in lowscheduleIds)
                                    //    {
                                    //        List<lfa.pmgmt.data.DTO.Schedule.Unit> i_scheduleUnits = unitDAO.List(id);

                                    //        GetScheduleUnitDetails(i_scheduleUnits, id, defaultPort);
                                    //    }
                                //}
                                #endregion
                             }
                           }
                        }
                    }
               }
        }