public AccountServiceTarrifAddChangeForm(AccountServiceTariff accountServiceTariff) : this() { this.m_AccountServiceTariff = accountServiceTariff; if (this.m_AccountServiceTariff.IsNew) { this.set_Text("Добавление индивидуального тарифа"); } else { this.set_Text("Изменение индивидуального тарифа"); } if (this.m_AccountServiceTariff.DocId != OrgDocument.Null.Id) { this.selectOrgDocument.SelectedOrgDocument = this.m_AccountServiceTariff.GetDoc() ?? OrgDocument.Null; } this.bsAccountServiceTarrif.set_DataSource(this.m_AccountServiceTariff); this.m_AccountServiceTariff.BeginEdit(); }
private void tsBtnAdd_Click(object sender, System.EventArgs e) { AccountServiceTariff accountServiceTariff = new AccountServiceTariff { AccountServiceId = this.m_AccountService.Id }; AccountServiceTarrifAddChangeForm form = new AccountServiceTarrifAddChangeForm(accountServiceTariff); form.ShowDialog(this); if (form.DialogResult == System.Windows.Forms.DialogResult.Yes) { this.bsAccountServiceTarrifs.Add(accountServiceTariff); this.bsAccountServiceTarrifs.set_Position(this.bsAccountServiceTarrifs.IndexOf(accountServiceTariff)); } }