private void btnAddChange_Click(object sender, System.EventArgs e)
 {
     if (this.dbDate.IsNull)
     {
         BalloonWindow window = new BalloonWindow("Не введена дата начала действия!");
         window.Show(this.btnAddChange);
     }
     else if (this.selectAccountPropertyFaset.SelectedFasetItem == FasetItem.Null)
     {
         new BalloonWindow("Не выбран параметр!").Show(this.btnAddChange);
     }
     else if ((this.dbDate.Value > this.dbDateEnd.Value) && (this.dbDateEnd.Value > Constants.MinDate))
     {
         System.Windows.Forms.MessageBox.Show("Дата окончания не должна быть меньше даты начала.");
     }
     else
     {
         this.m_AccountProperty.FromDate = this.dbDate.Value;
         this.m_AccountProperty.PropertyValue = true;
         this.m_AccountProperty.ToDate = this.dbDateEnd.Value;
         this.m_AccountProperty.PropertyId = this.selectAccountPropertyFaset.SelectedFasetItem.Id;
         this.m_AccountProperty.SaveChanges();
         base.set_DialogResult(System.Windows.Forms.DialogResult.OK);
         base.Close();
     }
 }
 private void btnAddType_Click(object sender, System.EventArgs e)
 {
     if (this.dbFromDateType.IsNull || string.IsNullOrEmpty(this.selectType.get_Text()))
     {
         BalloonWindow window = new BalloonWindow("Введите дату начала действия");
         window.Show(this.btnAddChangeType);
     }
     else if (this.selectType.SelectedFasetItem == FasetItem.Null)
     {
         new BalloonWindow("Выберите тип").Show(this.btnAddChangeType);
     }
     else
     {
         if (this.m_ApartmentType == null)
         {
             this.m_ApartmentType = new ApartmentType();
             this.m_ApartmentType.Id = -1L;
         }
         if (!this.dbFromDateType.IsNull)
         {
             this.m_ApartmentType.FromDate = this.dbFromDateType.Value;
         }
         this.m_ApartmentType.FasetItemName = this.selectType.SelectedFasetItem.ToString();
         this.m_ApartmentType.FasetItemId = this.selectType.SelectedFasetItem.Id;
         this.m_ApartmentType.SaveChanges();
         base.set_DialogResult(System.Windows.Forms.DialogResult.OK);
         base.Close();
     }
 }
 private void btnAdd_Click(object sender, System.EventArgs e)
 {
     if (this.dbFromDateArea.IsNull)
     {
         BalloonWindow window = new BalloonWindow("Не введена дата начала действия.");
         window.Show(this.btnAddChange);
     }
     else
     {
         if (this.m_ApartmentArea == null)
         {
             this.m_ApartmentArea = new ApartmentArea();
             this.m_ApartmentArea.Id = -1L;
             this.m_ApartmentArea.ApartmentId = this.m_Apartment.Id;
         }
         if ((this.nudTotalArea.Value < this.nudLivingArea.Value) || (this.nudTotalArea.Value < this.nudHeatingArea.Value))
         {
             new BalloonWindow("Несоответствие. Измените данные.").Show(this.btnAddChange);
         }
         else
         {
             this.m_ApartmentArea.FromDate = this.dbFromDateArea.Value;
             this.m_ApartmentArea.Total = System.Convert.ToDecimal(this.nudTotalArea.Value);
             this.m_ApartmentArea.Living = System.Convert.ToDecimal(this.nudLivingArea.Value);
             this.m_ApartmentArea.Heating = System.Convert.ToDecimal(this.nudHeatingArea.Value);
             this.m_ApartmentArea.Balcony = System.Convert.ToDecimal(this.nudBalconyArea.Value);
             if ((this.selectOrgDocument.SelectedOrgDocument == OrgDocument.Null) || (this.selectOrgDocument.SelectedOrgDocument == null))
             {
                 this.selectOrgDocument.SelectedOrgDocument = OrgDocument.Null;
             }
             this.m_ApartmentArea.DocId = this.selectOrgDocument.SelectedOrgDocument.Id;
             this.m_ApartmentArea.SaveChanges();
             base.set_DialogResult(System.Windows.Forms.DialogResult.OK);
             base.Close();
         }
     }
 }
 private void btnAddChange_Click(object sender, System.EventArgs e)
 {
     if ((this.selectPersonBenefitOwner.SelectedPerson == null) || (this.selectPersonBenefitOwner.SelectedPerson == Person.Null))
     {
         BalloonWindow window = new BalloonWindow("Выберите собственника льготы");
         window.Show(this.btnAddChange);
     }
     else if ((this.bsBenefits.get_Current() == null) || (((Benefit) this.bsBenefits.get_Current()) == Benefit.Null))
     {
         new BalloonWindow("Выберите льготу").Show(this.btnAddChange);
     }
     else
     {
         if (this.m_JnBenefit == null)
         {
             this.m_JnBenefit = new JnBenefit();
             this.m_JnBenefit.Id = -1L;
         }
         this.m_JnBenefit.BenefitOwnerId = this.selectPersonBenefitOwner.SelectedPerson.Id;
         this.m_JnBenefit.ExploitingPersonId = this.selectPersonExploitingPerson.SelectedPerson.Id;
         this.m_JnBenefit.BenefitId = ((Benefit) this.bsBenefits.get_Current()).Id;
         this.m_JnBenefit.Summ = this.nudSumm.Value;
         this.m_JnBenefit.SaveChanges();
         base.set_DialogResult(System.Windows.Forms.DialogResult.OK);
         base.Close();
     }
 }
 private void btnAddChange_Click(object sender, System.EventArgs e)
 {
     BalloonWindow window;
     ServiceTypeOld old = (this.bsServiceTypes.get_Current() as ServiceTypeOld) ?? ServiceTypeOld.Null;
     if (string.IsNullOrEmpty(this.selectType.get_Text()) || string.IsNullOrEmpty(this.tbCounterName.get_Text()))
     {
         window = new BalloonWindow("Не все поля заполнены.");
         window.Show(this.btnAddChange);
     }
     else if (this.dbFromDate.IsNull)
     {
         window = new BalloonWindow("Не введена дата открытия.");
         window.Show(this.btnAddChange);
     }
     else if (((int) this.nudCapacity.Value) <= 0)
     {
         window = new BalloonWindow("Разрядность должна быть больше 0.");
         window.Show(this.btnAddChange);
     }
     else if (old == ServiceTypeOld.Null)
     {
         window = new BalloonWindow("Выберите тип услуги");
         window.Show(this.btnAddChange);
     }
     else
     {
         long num;
         if (!string.IsNullOrEmpty(this.tbCodeASKUPE.get_Text()) && !long.TryParse(this.tbCodeASKUPE.get_Text(), ref num))
         {
             new BalloonWindow("Код АСКУПЭ должен содержать только цифры").Show(this.btnAddChange);
         }
         else
         {
             if ((this.m_HouseCounter == null) || (this.m_HouseCounter == HouseCounter.Null))
             {
                 this.m_HouseCounter = new HouseCounter();
                 this.m_HouseCounter.HouseId = this.m_HouseId;
             }
             bool flag1 = this.m_HouseCounter.FromDate != this.dbFromDate.Value;
             bool flag2 = this.m_HouseCounter.ToDate != this.dbToDate.Value;
             this.m_HouseCounter.FromDate = this.dbFromDate.Value;
             if (!this.dbToDate.IsNull)
             {
                 this.m_HouseCounter.ToDate = this.dbToDate.Value;
             }
             this.m_HouseCounter.TypeCounterName = this.selectType.SelectedFasetItem.ToString();
             this.m_HouseCounter.TypeCounterId = this.selectType.SelectedFasetItem.Id;
             this.m_HouseCounter.CounterName = this.tbCounterName.get_Text();
             this.m_HouseCounter.CounterNumber = this.tbCounterNumber.get_Text();
             this.m_HouseCounter.Capacity = (int) this.nudCapacity.Value;
             this.m_HouseCounter.MarkId = (this.cbMark.get_SelectedItem() as CounterMark).Id;
             this.m_HouseCounter.FromDate = this.dbFromDate.Value;
             this.m_HouseCounter.ToDate = this.dbToDate.Value;
             this.m_HouseCounter.ServiceTypeId = old.Id;
             this.m_HouseCounter.Factor = this.nudFactor.Value;
             this.m_HouseCounter.StatusAscupe = (this.cbStatusASKUPE.get_SelectedItem() as FasetItem).Id;
             this.m_HouseCounter.PointAccounting = this.tbCodeASKUPE.get_Text();
             this.m_HouseCounter.IsInternal = this.chbIsInternal.get_Checked();
             bool isNew = this.m_HouseCounter.IsNew;
             this.m_HouseCounter.Note = this.tbNote.get_Text();
             this.m_HouseCounter.SaveChanges();
             this.m_HouseCounter.ServiceTypeCode = (int) ((int) old.Code);
             this.m_HouseCounter.ServiceTypeName = old.ShortName;
             if (isNew)
             {
                 this.m_HouseCounterFromIndication.CounterId = this.m_HouseCounter.Id;
                 this.m_HouseCounterFromIndication.ValDate = this.dbFromDate.Value;
                 this.m_HouseCounterFromIndication.ValTypeName = "Начальное";
                 HomeCountersIndicationAddChangeForm form = new HomeCountersIndicationAddChangeForm(this.m_HouseCounter, this.m_HouseCounterFromIndication, true);
                 form.ShowDialog(this);
             }
             else if (!this.m_HouseCounterFromIndication.IsNew && (this.m_HouseCounterFromIndication.ValDate != this.dbFromDate.Value))
             {
                 this.m_HouseCounterFromIndication.ValDate = this.dbFromDate.Value;
                 this.m_HouseCounterFromIndication.SaveChanges();
             }
             if (!this.dbToDate.IsNull)
             {
                 this.m_HouseCounterToIndication.CounterId = this.m_HouseCounter.Id;
                 this.m_HouseCounterToIndication.ValDate = this.dbToDate.Value;
                 this.m_HouseCounterToIndication.ValTypeName = "Конечное";
                 new HomeCountersIndicationAddChangeForm(this.m_HouseCounter, this.m_HouseCounterToIndication, true).ShowDialog(this);
             }
             else if ((this.m_HouseCounterToIndication != null) && (this.m_HouseCounterToIndication != HouseCounterIndication.Null))
             {
                 this.m_HouseCounterToIndication.Delete();
             }
             base.set_DialogResult(System.Windows.Forms.DialogResult.OK);
             base.Close();
         }
     }
 }
 private void RefreshCurrentAccount()
 {
     Account account = this.m_AccountsBS.get_Current() as Account;
     bool flag = (bool) (account != null);
     this.m_ChangeAccountButton.set_Enabled(flag & User.IsMemberOf(RightsEnum.АРМБухгалтерЛСЛицевыеРедактирование));
     this.m_DeleteAccountButton.set_Enabled(flag & User.IsMemberOf(RightsEnum.АРМБухгалтерЛСЛицевыеРедактирование));
     this.tsAccountReportMenu.set_Enabled(flag);
     if (account == null)
     {
         this.m_CurrentAccount = Account.Null;
         this.m_Tabs.set_Visible(false);
     }
     else
     {
         this.m_Tabs.set_Visible(true);
         if (this.m_CurrentAccount.Id != account.Id)
         {
             this.m_CurrentAccount = account;
             if (!account.isClose)
             {
                 if (User.IsMemberOf(RightsEnum.АРМБухгалтерЛСПросмотрРедактированиеОткрытыхЛС))
                 {
                     this.RefreshTabControl();
                 }
                 else
                 {
                     this.m_Tabs.set_Visible(false);
                     BalloonWindow window = new BalloonWindow("У вас нет права просмотра и редактирования открытых ЛС!");
                     window.Show(this.topToolStrip);
                 }
             }
             else if (User.IsMemberOf(RightsEnum.АРМБухгалтерЛСПросмотрРедактированиеЗакрытыхЛС))
             {
                 this.RefreshTabControl();
             }
             else
             {
                 this.m_Tabs.set_Visible(false);
                 new BalloonWindow("У вас нет права просмотра и редактирования закрытых ЛС!").Show(this.topToolStrip);
             }
         }
     }
 }