public NormsForElectricAddChangeForm(NormsForElectric bnfe) : this() { this.m_NormsForElectric = bnfe; this.sfdApartmentType.Faset = FasetsEnum.HouseApartmentType; this.sfdApartmentType.RefreshValuesWithNull(); this.sfdApartmentType.SelectedFasetItem = (this.m_NormsForElectric.ApartmentTypeId == FasetItem.Null.Id) ? FasetItem.Null : this.m_NormsForElectric.GetApartmentType(); this.bsNormsForElectric.set_DataSource(this.m_NormsForElectric); this.m_NormsForElectric.BeginEdit(); if (this.m_NormsForElectric.IsNew) { this.set_Text("Добавление записи"); this.btnYes.set_Text("Добавить"); } else { this.set_Text("Изменение записи"); this.btnYes.set_Text("Изменить"); } }
private void tsbAdd_Click(object sender, System.EventArgs e) { NormsForElectric bnfe = new NormsForElectric(); NormsForElectricAddChangeForm form = new NormsForElectricAddChangeForm(bnfe); if (form.ShowDialog() == System.Windows.Forms.DialogResult.Yes) { this.bsNormsForElectric.Add(bnfe); this.bsNormsForElectric.set_Sort(this.bsNormsForElectric.get_Sort()); this.bsNormsForElectric.set_Sort(this.bsNormsForElectric.get_Sort()); this.bsNormsForElectric.set_Position(this.bsNormsForElectric.IndexOf(bnfe)); } }