예제 #1
0
 public BenefitDebtAddForm(AccountService accountService)
 {
     this.InitializeComponent();
     this.m_BenefitDebt = new BenefitDebt();
     this.m_AccountService = accountService;
     this.m_IsEdit = false;
 }
예제 #2
0
 public BenefitDebtAddForm(AccountService accountService, BenefitDebt benefitDebt)
     : this(accountService)
 {
     this.set_Text("Редактирование задолженности по льготам");
     this.btnApply.set_Text("Изменить");
     this.m_IsEdit = true;
     this.m_BenefitDebt = benefitDebt;
     this.tbSumm.set_Text(this.m_BenefitDebt.Value.ToString());
     this.periodSelector.Period = this.m_BenefitDebt.Period;
 }
 private void btOK_Click(object sender, System.EventArgs e)
 {
     if (this.m_ApartmentResident == null)
     {
         return;
     }
     if (this.cbServiceType.get_SelectedValue() == null)
     {
         Messages.ShowWarning("Заполнены не все поля");
         return;
     }
     if (this.m_ApartmentResidentBenefitDebt == null)
     {
         if ((this.dtpPeriod.Value < CalcPeriod.GetCurrent().FromDate) || (this.dtpPeriod.Value > CalcPeriod.GetCurrent().FromDate.AddMonths(1)))
         {
             Messages.ShowWarning("Период должен быть либо текущий либо следующий за текущим");
             return;
         }
         if (this.udValue.Value == 0M)
         {
             Messages.ShowWarning("Сальдо, добавленное на новый период не должно быть равным 0");
             return;
         }
         try
         {
             this.m_ApartmentResidentBenefitDebt = new BenefitDebt();
             this.m_ApartmentResidentBenefitDebt.PersonId = this.m_ApartmentResident.PersonId;
             this.m_ApartmentResidentBenefitDebt.ServiceTypeId = (long) ((long) this.cbServiceType.get_SelectedValue());
             this.m_ApartmentResidentBenefitDebt.Period = this.dtpPeriod.Value;
             this.m_ApartmentResidentBenefitDebt.Value = this.udValue.Value;
             this.m_ApartmentResidentBenefitDebt.SaveChanges();
             goto Label_013E;
         }
         catch (System.Exception)
         {
             Messages.ShowWarning("При сохранении возникла ошибка, возможно вы добавляете дублирующий период.");
             return;
         }
     }
     this.m_ApartmentResidentBenefitDebt.Value = this.udValue.Value;
     this.m_ApartmentResidentBenefitDebt.SaveChanges();
     Label_013E:
     base.Close();
 }
 public ApartmentResidentBenefitDebtsForm(ApartmentResident apartmentResident, BenefitDebt benefitDebt)
     : this()
 {
     this.m_ApartmentResident = apartmentResident;
     this.m_ApartmentResidentBenefitDebt = benefitDebt;
 }