Пример #1
0
        private void btngrdChildOne_AddNew_Click(object sender, EventArgs e)
        {
            try
            {
                _selectedItemDataId = int.Parse(grdMain.SelectedRows[0].Cells[0].Value.ToString());

                switch (_currentModule)
                {
                    case "Configuration":
                        if (grdMain.SelectedRows.Count <= 0)
                        {
                            Exception ex = new Exception("Please select a zone from the panel on the left!");
                            HandleException(ex);
                        }
                        else
                        {
                            if (_selectedItemDataId > 0)
                            {
                                Forms.Frm_AddNew_Unit frmAddNewUnit = new Forms.Frm_AddNew_Unit(_selectedItemDataId);
                                frmAddNewUnit.ShowDialog();
                            }
                            else
                            {
                                Exception ex = new Exception("Please select a zone from the panel on the left!");
                                HandleException(ex);
                            }
                        }
                        break;
                    case "Schedule":
                        if (grdMain.SelectedRows.Count <= 0)
                        {
                            Exception ex = new Exception("Please select a schedule from the panel on the left!");
                            HandleException(ex);
                        }
                        else
                        {
                            if (_selectedItemDataId > 0)
                            {
                                Forms.Frm_AddNew_ScheduleUnit frmAddNewScheduleUnit = new Forms.Frm_AddNew_ScheduleUnit(_selectedItemDataId);
                                frmAddNewScheduleUnit.ShowDialog();
                            }
                            else
                            {
                                Exception ex = new Exception("Please select a schedule from the panel on the left!");
                                HandleException(ex);
                            }
                        }
                        break;
                    case "LoadShed":
                        HandleInformationMesssage("Load shedding data can not be saved! Data is only for control purposes!");
                        break;
                    case "Rules":
                        HandleInformationMesssage("This action is disabled for power management rules!");
                        break;
                }
            }
            catch
            {
                Exception ex = new Exception("There are either no item selected in the previous grid, or there are no data available to allow this action!");
                HandleException(ex);
            }
        }
Пример #2
0
        private void btngrdChildOne_AddNew_Click(object sender, EventArgs e)
        {
            try
            {
                _selectedItemDataId = int.Parse(grdMain.SelectedRows[0].Cells[0].Value.ToString());

                switch (_currentModule)
                {
                case "Configuration":
                    if (grdMain.SelectedRows.Count <= 0)
                    {
                        Exception ex = new Exception("Please select a zone from the panel on the left!");
                        HandleException(ex);
                    }
                    else
                    {
                        if (_selectedItemDataId > 0)
                        {
                            Forms.Frm_AddNew_Unit frmAddNewUnit = new Forms.Frm_AddNew_Unit(_selectedItemDataId);
                            frmAddNewUnit.ShowDialog();
                        }
                        else
                        {
                            Exception ex = new Exception("Please select a zone from the panel on the left!");
                            HandleException(ex);
                        }
                    }
                    break;

                case "Schedule":
                    if (grdMain.SelectedRows.Count <= 0)
                    {
                        Exception ex = new Exception("Please select a schedule from the panel on the left!");
                        HandleException(ex);
                    }
                    else
                    {
                        if (_selectedItemDataId > 0)
                        {
                            Forms.Frm_AddNew_ScheduleUnit frmAddNewScheduleUnit = new Forms.Frm_AddNew_ScheduleUnit(_selectedItemDataId);
                            frmAddNewScheduleUnit.ShowDialog();
                        }
                        else
                        {
                            Exception ex = new Exception("Please select a schedule from the panel on the left!");
                            HandleException(ex);
                        }
                    }
                    break;

                case "LoadShed":
                    HandleInformationMesssage("Load shedding data can not be saved! Data is only for control purposes!");
                    break;

                case "Rules":
                    HandleInformationMesssage("This action is disabled for power management rules!");
                    break;
                }
            }
            catch
            {
                Exception ex = new Exception("There are either no item selected in the previous grid, or there are no data available to allow this action!");
                HandleException(ex);
            }
        }