public BenefitNormsForElectricAddChangeForm(BenefitNormsForElectric bnfe)
     : this()
 {
     this.m_BenefitNormsForElectric = bnfe;
     this.sfdApartmentType.Faset = FasetsEnum.HouseApartmentType;
     this.sfdApartmentType.RefreshValuesWithNull();
     this.sfdApartmentType.SelectedFasetItem = (this.m_BenefitNormsForElectric.ApartmentType == FasetItem.Null.Id) ? FasetItem.Null : this.m_BenefitNormsForElectric.GetApartmentType();
     this.bsBenefitNormsForElectric.set_DataSource(this.m_BenefitNormsForElectric);
     this.m_BenefitNormsForElectric.BeginEdit();
     if (this.m_BenefitNormsForElectric.IsNew)
     {
         this.set_Text("Добавление записи");
         this.btnYes.set_Text("Добавить");
     }
     else
     {
         this.set_Text("Изменение записи");
         this.btnYes.set_Text("Изменить");
         if (this.m_BenefitNormsForElectric.BenefitId == 0L)
         {
             this.selectBenefit1.SelectedBenefit = Benefit.Null;
         }
         else
         {
             this.selectBenefit1.SelectedBenefit = this.m_BenefitNormsForElectric.GetBenefit();
         }
     }
 }
 private void tsbAdd_Click(object sender, System.EventArgs e)
 {
     BenefitNormsForElectric bnfe = new BenefitNormsForElectric();
     BenefitNormsForElectricAddChangeForm form = new BenefitNormsForElectricAddChangeForm(bnfe);
     if (form.ShowDialog() == System.Windows.Forms.DialogResult.Yes)
     {
         this.bsBenefitNormsForElectric.Add(bnfe);
         this.bsBenefitNormsForElectric.set_Sort(this.bsBenefitNormsForElectric.get_Sort());
         this.bsBenefitNormsForElectric.set_Sort(this.bsBenefitNormsForElectric.get_Sort());
         this.bsBenefitNormsForElectric.set_Position(this.bsBenefitNormsForElectric.IndexOf(bnfe));
     }
 }