private void btnAddCalcAlgs_Click(object sender, System.EventArgs e) { CalcAlg calcAlg = new CalcAlg(); CalcAlgsAddChangeForm form = new CalcAlgsAddChangeForm(calcAlg); if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.Yes) { this.bsCalcAlgs.Add(calcAlg); this.bsCalcAlgs.set_Position(this.bsCalcAlgs.IndexOf(calcAlg)); } }
public ServiceCalcAlgAddForm(ServiceCalcAlg ServiceCalcAlg, ServiceOld serviceOld) : this() { this.m_ServiceCalcAlg = ServiceCalcAlg; this.m_serviceOld = serviceOld; this.m_calcAlg = CalcAlg.FindById(this.m_ServiceCalcAlg.CalcAlgId); this.tbFormula.set_Text(this.m_ServiceCalcAlg.Formula); this.tbProcName.set_Text(this.m_ServiceCalcAlg.ProcName); this.dbFromDate.Value = this.m_ServiceCalcAlg.FromDate; this.bnOk.set_Text("Изменить"); this.set_Text("Изменить алгоритм"); }
public CalcAlgsAddChangeForm(CalcAlg calcAlg) : this() { this.m_CalcAlg = calcAlg; }
private void bnOk_Click(object sender, System.EventArgs e) { if (((CalcAlg) this.bsCalcAlg.get_Current()) == CalcAlg.Null) { System.Windows.Forms.MessageBox.Show("Выберите методику", "Предупреждение", System.Windows.Forms.MessageBoxButtons.OK); } else if (this.dbFromDate.Value == this.dbFromDate.NullDate) { System.Windows.Forms.MessageBox.Show("Веедите дату начала действия", "Предупреждение", System.Windows.Forms.MessageBoxButtons.OK); } else if (this.dbFromDate.Value < Constants.MinDate) { System.Windows.Forms.MessageBox.Show("Дата выбранна не верно", "Предупреждение", System.Windows.Forms.MessageBoxButtons.OK); } else { this.calcAlg = (CalcAlg) this.bsCalcAlg.get_Current(); if (this.bnOk.get_Text() == "Добавить") { ServiceCalcAlg alg = new ServiceCalcAlg { ServiceId = this.m_serviceOld.Id, ServiceName = this.m_serviceOld.ShortName, CalcAlgId = this.calcAlg.Id, CalcAlgName = this.calcAlg.Name, Formula = this.calcAlg.ChargeFormulaFormula, ProcName = this.calcAlg.ChargeProcName, FromDate = this.dbFromDate.Value, Created = System.DateTime.Today }; alg.SaveChanges(); this.m_ServiceCalcAlg = alg; } else { this.m_ServiceCalcAlg.CalcAlgId = this.calcAlg.Id; this.m_ServiceCalcAlg.CalcAlgName = this.calcAlg.Name; this.m_ServiceCalcAlg.Formula = this.calcAlg.ChargeFormulaFormula; this.m_ServiceCalcAlg.ProcName = this.calcAlg.ChargeProcName; this.m_ServiceCalcAlg.FromDate = this.dbFromDate.Value; this.m_ServiceCalcAlg.SaveChanges(); } base.set_DialogResult(System.Windows.Forms.DialogResult.OK); base.Close(); } }
public ServiceCalcAlgAddForm() { this.m_calcAlg = CalcAlg.Null; this.InitializeComponent(); this.set_Font(Manager.WindowFont); }
private void UpdateField() { this.calcAlg = (CalcAlg) this.bsCalcAlg.get_Current(); this.tbFormula.set_Text(this.calcAlg.ChargeFormulaFormula); this.tbProcName.set_Text(this.calcAlg.ChargeProcName); }