//Заменить в проекте private void itemReplace_Click(object sender, EventArgs e) { string connectionNumber; using (frmInputBox frm = new frmInputBox(_project, 2 /*замена*/)) { if (frm.ShowDialog() == DialogResult.OK) { connectionNumber = frm.GetTxtValue; ProjectEquipment pe = EquipServices.ReplaceProjectCbr(_project, connectionNumber, bs_Cbr.Current as CurrentBreaker); bs_CbrPrj.DataSource = EquipServices.GetProjectCbr(_project, false); if (EquipServices.GetCbrAnalog(pe, bs_Cbr.Current as CurrentBreaker)) { AnalogDataSourceLoad(DefaultForeColor, bs_CbrAn.Count.ToString()); } else { AnalogDataSourceLoad(Color.Red, "не найдено"); } } else { return; } } }
//Редактировать (наименование присоединения) private void itemEdit_Click(object sender, EventArgs e) { using (frmInputBox frm = new frmInputBox(_project, 1 /*добавление или редактирование*/)) { if (frm.ShowDialog() == DialogResult.OK) { bs_EquipNote.DataSource = EquipServices.UpdateTable(bs_CbrEquip.Current as ProjectEquipment, frm.GetTxtValue); bs_CbrEquip.DataSource = EquipServices.GetAllEquipCbr(_project, false); bs_AnalogEquip.DataSource = EquipServices.GetAllEquipCbr(_project, true); } } }
//загрузка формы private void frmConfigurator_Load(object sender, EventArgs e) { using (frmInputBox frm = new frmInputBox(1 /*введите номер проекта*/)) { if (frm.ShowDialog() == DialogResult.Yes) { Project pr = ProjectServices.GetByNumber(frm.GetTxtValue); if (pr != null) { _project = pr; } } } rbtnGeneral.Checked = true; _blockNameMask = txtResult.Text; bs_ProjectCbr.DataSource = ConfigServices.GetProjectCbr(_project, false); bs_cbrCCbrPrj.DataSource = EquipServices.GetAllCbCur(); bs_disCCbrPrj.DataSource = EquipServices.GetAllDisCur(); bs_disMCbrPrj.DataSource = EquipServices.GetAllDisModel(); bs_icuLCbrPrj.DataSource = EquipServices.GetAllIcuLiteral(); bs_seriaCbrPrj.DataSource = EquipServices.GetAllSeria(); bs_Schema.DataSource = ConfigServices.GetAllSchema(); bs_BaseHeight.DataSource = ConfigServices.GetBaseSizes("H"); bs_BaseWidth.DataSource = ConfigServices.GetBaseSizes("B"); foreach (Control ctr in this.Controls) { if (ctr.GetType() == typeof(ComboBox)) { ctr.ResetText(); } } if (_project.IdNumber != 0) { tsProjectNumber.Text = ProjectServices.GetProjectNumber(_project); } else { tsProjectNumber.Text = "тестовый проект"; } }
//Добавить в проект private void itemAdd_Click(object sender, EventArgs e) { string _connectionNumber; using (frmInputBox frm = new frmInputBox(_project, 1 /*добавление или редактирование*/)) { if (frm.ShowDialog() == DialogResult.Yes) { _connectionNumber = frm.GetTxtValue; switch (tabControl.SelectedTab.Name) { case "tbpCurBreaker": InsertCbr(_connectionNumber); break; case "tbpContactor": break; case "tbpMotorProtect": break; case "tbpTransformerCurrent": break; case "tbpModulCurBr": break; default: break; } } else { return; } } }
private void button1_Click(object sender, EventArgs e) { string number; using (frmInputBox frm = new frmInputBox(1)) { if (frm.ShowDialog() == DialogResult.OK) { number = frm.GetTxtValue; Project pr = ProjectServices.GetByNumber(number); if (pr != null) { textBox1.Text = pr.Description; } else { textBox1.ResetText(); } } } }