public System.Collections.Generic.List<LocalAddress> AddLocalAddressRange(LocalAddressDTO dto) { int num = System.Convert.ToInt32(dto.Name); int num2 = System.Convert.ToInt32(dto.NameTo); System.Collections.Generic.List<LocalAddress> list = new System.Collections.Generic.List<LocalAddress>(); for (int i = num; i <= num2; i = (int) (i + 1)) { LocalAddress address = new LocalAddress(); dto.Name = ((int) i).ToString(); address.SaveChanges(dto); list.Add(address); AddHouseAndApartment(dto, address); } return list; }
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(); } }
public LocalAddress AddLocalAddress(LocalAddressDTO dto) { LocalAddress address = new LocalAddress(); address.SaveChanges(dto); AddHouseAndApartment(dto, address); return address; }