示例#1
0
 private void btnOk_Click(object sender, System.EventArgs e)
 {
     bool flag = false;
     if (this.addressView.GetName() == "")
     {
         Messages.ShowWarning("Заполните поле наименование");
         base.set_DialogResult(System.Windows.Forms.DialogResult.None);
         return;
     }
     this.addressView.NewApartment = false;
     this.addressView.NewHouse = false;
     AddressLevel level = this.addressView.GetLevel();
     if (level == AddressLevel.None)
     {
         BalloonWindow.Show(this.btnOk, "Выберите уровень");
         return;
     }
     LocalAddress address = (((LocalAddress) this.addressView.ObjectWithId) == null) ? LocalAddress.Null : ((LocalAddress) this.addressView.ObjectWithId);
     if (address != LocalAddress.Null)
     {
         if ((level == AddressLevel.Дом) && (House.FindByAddress(address) == House.Null))
         {
             if (Messages.QuestionYesNo(this, "Паспорт дома по данному адресу не найден. Добавить его?") == System.Windows.Forms.DialogResult.Yes)
             {
                 this.addressView.NewHouse = true;
             }
         }
         else if (((level == AddressLevel.MaxAddress) && (Apartment.FindByAddress(address).get_Count() == 0)) && (Messages.QuestionYesNo(this, "Паспорт квартиры по данному адресу не найден. Добавить его?") == System.Windows.Forms.DialogResult.Yes))
         {
             this.addressView.NewApartment = true;
         }
     }
     else
     {
         switch (level)
         {
             case AddressLevel.MinAddress:
             {
                 LocalAddress address2 = new LocalAddress {
                     Name = this.addressView.GetName(),
                     Level = AddressLevel.MinAddress
                 };
                 address2.SaveChanges();
                 this.EnteredAddress = address2;
                 return;
             }
             case AddressLevel.Дом:
                 if (System.Windows.Forms.MessageBox.Show("Добавить паспорт дома по данному адресу (адресам)?", "Сообщение", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                 {
                     this.addressView.NewHouse = true;
                 }
                 goto Label_01CA;
         }
         if ((level == AddressLevel.MaxAddress) && (System.Windows.Forms.MessageBox.Show("Добавить паспорт квартиры по данному адресу (адресам)?", "Сообщение", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes))
         {
             this.addressView.NewApartment = true;
             if (((this.addressView.tbname.IndexOf("-") == -1) && User.IsMemberOf(RightsEnum.АРМБухгалтерБыстроеЗаполнениеПаспортаЖилья)) && (System.Windows.Forms.MessageBox.Show("Заполнить паспорт квартиры по данному адресу?", "Сообщение", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes))
             {
                 flag = true;
             }
         }
     }
     Label_01CA:
     this.EnteredAddress = (LocalAddress) this.addressView.SaveChanges(false);
     base.set_DialogResult(System.Windows.Forms.DialogResult.OK);
     base.Close();
     if (flag)
     {
         ApartmentFillingForm form = new ApartmentFillingForm();
         form.Fill(Apartment.FindByAddress(this.EnteredAddress).get_Item(0));
         form.ShowDialog();
     }
 }
示例#2
0
 private void AddFillingClick(object sender, System.EventArgs e)
 {
     try
     {
         ApartmentFillingForm form = new ApartmentFillingForm();
         form.Fill((Apartment) base.SelectedNode.get_Tag());
         form.ShowDialog();
     }
     catch (System.Exception exception)
     {
         Messages.ShowException(this, exception);
     }
 }