Ejemplo n.º 1
0
        private void GetScheduleUnitDetails(List <lfa.pmgmt.data.DTO.Schedule.Unit> scheduleUnits, int scheduleId,
                                            int defaultPort, int status)
        {
            foreach (lfa.pmgmt.data.DTO.Schedule.Unit scheduleUnit in scheduleUnits)
            {
                string address = scheduleUnit.Address;

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

                List <lfa.pmgmt.data.DTO.Schedule.Device> unitDevices = deviceDAO.ListById(scheduleUnit.Id, scheduleId);

                ArrayList parameters = new ArrayList();
                parameters.Add(unitDevices);
                parameters.Add(defaultPort);
                parameters.Add(scheduleUnit);
                parameters.Add(status);

                //AsyncLoadShedUnit(parameters);

                Thread worker = new Thread(new ParameterizedThreadStart(AsyncLoadShedUnit));
                worker.Priority = ThreadPriority.Highest;
                worker.Start(parameters);
            }
        }
Ejemplo n.º 2
0
        private void GetScheduleUnitDetails(List <lfa.pmgmt.data.DTO.Schedule.Unit> scheduleUnits, int scheduleId, int defaultPort)
        {
            foreach (lfa.pmgmt.data.DTO.Schedule.Unit scheduleUnit in scheduleUnits)
            {
                string address = scheduleUnit.Address;

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

                List <lfa.pmgmt.data.DTO.Schedule.Device> unitDevices = deviceDAO.ListById(scheduleUnit.Id, scheduleId);

                LoadShedUnit(unitDevices, defaultPort, scheduleUnit);
            }
        }
Ejemplo n.º 3
0
        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboItem selectedItem = comboBox3.SelectedItem as ComboItem;
            int       unitId       = selectedItem.Id;

            dataGridView1.DataSource = null;

            if (unitId > -1)
            {
                lfa.pmgmt.data.DAO.Schedule.Device scheduleDeviceDAO = new data.DAO.Schedule.Device();
                scheduleDeviceDAO.ConnectionString = _connectionString;

                List <lfa.pmgmt.data.DTO.Schedule.Device> scheduleDevices = scheduleDeviceDAO.ListById(unitId, _scheduleId);

                if (scheduleDevices.Count > 0)
                {
                    dataGridView1.DataSource = scheduleDevices;

                    ComboBox cmbStatus = new ComboBox();
                    cmbStatus.Items.Add("On");
                    cmbStatus.Items.Add("Off");

                    DataGridViewComboBoxColumn comboBoxColumn = new DataGridViewComboBoxColumn();
                    comboBoxColumn.Items.Add("On");
                    comboBoxColumn.Items.Add("Off");
                    dataGridView1.Columns.Add(comboBoxColumn);

                    foreach (DataGridViewRow scheduleRow in dataGridView1.Rows)
                    {
                        if (Convert.ToBoolean(scheduleRow.Cells[3].Value.ToString()))
                        {
                            scheduleRow.Cells[4].Value = "On";
                        }
                        else
                        {
                            scheduleRow.Cells[4].Value = "Off";
                        }
                    }

                    dataGridView1.Columns[0].Visible = false;
                    dataGridView1.Columns[2].Visible = false;
                    dataGridView1.Columns[3].Visible = false;

                    dataGridView1.Columns[1].Width = 273;
                    dataGridView1.Columns[4].Width = 100;
                }
            }
        }
Ejemplo n.º 4
0
        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboItem selectedItem = comboBox3.SelectedItem as ComboItem;
            int unitId = selectedItem.Id;

            dataGridView1.DataSource = null;

            if (unitId > -1)
            {
                lfa.pmgmt.data.DAO.Schedule.Device scheduleDeviceDAO = new data.DAO.Schedule.Device();
                scheduleDeviceDAO.ConnectionString = _connectionString;

                List<lfa.pmgmt.data.DTO.Schedule.Device> scheduleDevices = scheduleDeviceDAO.ListById(unitId, _scheduleId);

                if (scheduleDevices.Count > 0)
                {
                    dataGridView1.DataSource = scheduleDevices;

                    ComboBox cmbStatus = new ComboBox();
                    cmbStatus.Items.Add("On");
                    cmbStatus.Items.Add("Off");

                    DataGridViewComboBoxColumn comboBoxColumn = new DataGridViewComboBoxColumn();
                    comboBoxColumn.Items.Add("On");
                    comboBoxColumn.Items.Add("Off");
                    dataGridView1.Columns.Add(comboBoxColumn);

                    foreach (DataGridViewRow scheduleRow in dataGridView1.Rows)
                    {
                       if (Convert.ToBoolean(scheduleRow.Cells[3].Value.ToString()))
                       {
                          scheduleRow.Cells[4].Value = "On";
                       }
                       else
                       {
                          scheduleRow.Cells[4].Value = "Off";
                       }
                    }

                    dataGridView1.Columns[0].Visible = false;
                    dataGridView1.Columns[2].Visible = false;
                    dataGridView1.Columns[3].Visible = false;

                    dataGridView1.Columns[1].Width = 273;
                    dataGridView1.Columns[4].Width = 100;
                }
            }
        }
Ejemplo n.º 5
0
        private void grdChildOne_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            if (_loadComplete)
            {
                switch (_currentModule)
                {
                case "Configuration":
                    _loadComplete = false;

                    DataGridViewRow selectedRow = grdChildOne.SelectedRows[0];
                    _selectedItemDataId = int.Parse(selectedRow.Cells[0].Value.ToString());

                    lfa.pmgmt.data.DAO.Configuration.Device deviceDAO = new data.DAO.Configuration.Device();
                    deviceDAO.ConnectionString = _connectionString;
                    List <lfa.pmgmt.data.DTO.Configuration.Device> list = deviceDAO.List(_selectedItemDataId);

                    grdChildTwo.DataSource = list;

                    grdChildTwo.Columns[0].Visible = false;
                    grdChildTwo.Columns[1].Visible = false;

                    grdChildTwo.Columns[5].ReadOnly = true;

                    _loadComplete = true;
                    break;

                case "Schedule":
                    _loadComplete = false;

                    DataGridViewRow s_selectedRow = grdChildOne.SelectedRows[0];
                    _selectedItemDataId = int.Parse(s_selectedRow.Cells[0].Value.ToString());

                    int selectedSchedule = int.Parse(grdMain.SelectedRows[0].Cells[0].Value.ToString());

                    lfa.pmgmt.data.DAO.Schedule.Device s_deviceDAO = new data.DAO.Schedule.Device();
                    s_deviceDAO.ConnectionString = _connectionString;
                    List <lfa.pmgmt.data.DTO.Schedule.Device> s_list = s_deviceDAO.ListById(_selectedItemDataId, selectedSchedule);

                    grdChildTwo.Columns.Clear();

                    grdChildTwo.DataSource = s_list;

                    grdChildTwo.Columns[0].Visible = false;

                    _loadComplete = true;
                    break;

                case "LoadShed":
                    _loadComplete = false;

                    DataGridViewRow ls_selectedRow = grdChildOne.SelectedRows[0];
                    _selectedItemDataId = int.Parse(ls_selectedRow.Cells[0].Value.ToString());

                    lfa.pmgmt.data.DAO.Configuration.Device ls_deviceDAO = new data.DAO.Configuration.Device();
                    ls_deviceDAO.ConnectionString = _connectionString;
                    List <lfa.pmgmt.data.DTO.Configuration.LoadShedDevice> ls_list = ls_deviceDAO.ListLoadShed(_selectedItemDataId);

                    grdChildTwo.Columns.Clear();

                    grdChildTwo.DataSource = ls_list;

                    grdChildTwo.Columns[0].Visible = false;
                    grdChildTwo.Columns[2].Visible = false;
                    grdChildTwo.Columns[3].Visible = false;
                    grdChildTwo.Columns[4].Visible = false;

                    ComboBox cmbStatus = new ComboBox();
                    cmbStatus.Items.Add("On");
                    cmbStatus.Items.Add("Off");

                    DataGridViewComboBoxColumn comboBoxColumn = new DataGridViewComboBoxColumn();
                    comboBoxColumn.Items.Add("On");
                    comboBoxColumn.Items.Add("Off");
                    grdChildTwo.Columns.Add(comboBoxColumn);

                    foreach (DataGridViewRow dgvRow in grdChildTwo.Rows)
                    {
                        dgvRow.Cells[5].Value = dgvRow.Cells[4].Value;
                    }

                    btnLoadShed.Visible = true;

                    _loadComplete = true;
                    break;
                }
            }
        }
Ejemplo n.º 6
0
        private void grdChildOne_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            if (_loadComplete)
            {
                switch (_currentModule)
                {
                    case "Configuration":
                        _loadComplete = false;

                         DataGridViewRow selectedRow = grdChildOne.SelectedRows[0];
                        _selectedItemDataId = int.Parse(selectedRow.Cells[0].Value.ToString());

                         lfa.pmgmt.data.DAO.Configuration.Device deviceDAO = new data.DAO.Configuration.Device();
                        deviceDAO.ConnectionString = _connectionString;
                        List<lfa.pmgmt.data.DTO.Configuration.Device> list = deviceDAO.List(_selectedItemDataId);

                        grdChildTwo.DataSource = list;

                        grdChildTwo.Columns[0].Visible = false;
                        grdChildTwo.Columns[1].Visible = false;

                        grdChildTwo.Columns[5].ReadOnly = true;

                        _loadComplete = true;
                        break;
                    case "Schedule":
                         _loadComplete = false;

                         DataGridViewRow s_selectedRow = grdChildOne.SelectedRows[0];
                        _selectedItemDataId = int.Parse(s_selectedRow.Cells[0].Value.ToString());

                        int selectedSchedule = int.Parse(grdMain.SelectedRows[0].Cells[0].Value.ToString());

                         lfa.pmgmt.data.DAO.Schedule.Device s_deviceDAO = new data.DAO.Schedule.Device();
                        s_deviceDAO.ConnectionString = _connectionString;
                        List<lfa.pmgmt.data.DTO.Schedule.Device> s_list = s_deviceDAO.ListById(_selectedItemDataId,selectedSchedule);

                        grdChildTwo.Columns.Clear();

                        grdChildTwo.DataSource = s_list;

                        grdChildTwo.Columns[0].Visible = false;

                        _loadComplete = true;
                        break;
                    case "LoadShed":
                        _loadComplete = false;

                        DataGridViewRow ls_selectedRow = grdChildOne.SelectedRows[0];
                        _selectedItemDataId = int.Parse(ls_selectedRow.Cells[0].Value.ToString());

                        lfa.pmgmt.data.DAO.Configuration.Device ls_deviceDAO = new data.DAO.Configuration.Device();
                        ls_deviceDAO.ConnectionString = _connectionString;
                        List<lfa.pmgmt.data.DTO.Configuration.LoadShedDevice> ls_list = ls_deviceDAO.ListLoadShed(_selectedItemDataId);

                        grdChildTwo.Columns.Clear();

                        grdChildTwo.DataSource = ls_list;

                        grdChildTwo.Columns[0].Visible = false;
                        grdChildTwo.Columns[2].Visible = false;
                        grdChildTwo.Columns[3].Visible = false;
                        grdChildTwo.Columns[4].Visible = false;

                        ComboBox cmbStatus = new ComboBox();
                        cmbStatus.Items.Add("On");
                        cmbStatus.Items.Add("Off");

                        DataGridViewComboBoxColumn comboBoxColumn = new DataGridViewComboBoxColumn();
                        comboBoxColumn.Items.Add("On");
                        comboBoxColumn.Items.Add("Off");
                        grdChildTwo.Columns.Add(comboBoxColumn);

                        foreach(DataGridViewRow dgvRow in grdChildTwo.Rows)
                        {
                            dgvRow.Cells[5].Value = dgvRow.Cells[4].Value;
                        }

                        btnLoadShed.Visible = true;

                        _loadComplete = true;
                        break;
                }
            }
        }
Ejemplo n.º 7
0
        private void GetScheduleUnitDetails(List<lfa.pmgmt.data.DTO.Schedule.Unit> scheduleUnits, int scheduleId,
                                            int defaultPort, int status)
        {
            foreach (lfa.pmgmt.data.DTO.Schedule.Unit scheduleUnit in scheduleUnits)
            {
                string address = scheduleUnit.Address;

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

                List<lfa.pmgmt.data.DTO.Schedule.Device> unitDevices = deviceDAO.ListById(scheduleUnit.Id, scheduleId);

                ArrayList parameters = new ArrayList();
                parameters.Add(unitDevices);
                parameters.Add(defaultPort);
                parameters.Add(scheduleUnit);
                parameters.Add(status);

                //AsyncLoadShedUnit(parameters);

                 Thread worker = new Thread(new ParameterizedThreadStart(AsyncLoadShedUnit));
                 worker.Start(parameters);

            }
        }
Ejemplo n.º 8
0
        private void GetScheduleUnitDetails(List<lfa.pmgmt.data.DTO.Schedule.Unit> scheduleUnits, int scheduleId,int defaultPort)
        {
            foreach (lfa.pmgmt.data.DTO.Schedule.Unit scheduleUnit in scheduleUnits)
            {
                string address = scheduleUnit.Address;

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

                List<lfa.pmgmt.data.DTO.Schedule.Device> unitDevices = deviceDAO.ListById(scheduleUnit.Id, scheduleId);

                LoadShedUnit(unitDevices,defaultPort, scheduleUnit);
            }
        }