private void tsBtnEditResident_Click(object sender, System.EventArgs e) { ApartmentResident apartmentResident = this.bsNewApartmentResidents.get_Current() as ApartmentResident; if (apartmentResident != null) { ApartmentResidentForm form = new ApartmentResidentForm(this.m_OldApartment, apartmentResident, false); if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { ApartmentResident resident2 = form.ApartmentResident; resident2.ApartmentId = Apartment.Null.Id; Person person = Person.FindById(resident2.PersonId); resident2.PersonName = person.FullName; resident2.BirthDate = person.BirthDate; if (resident2.TypeResidents != 0) { resident2.TypeResidentName = FasetItem.FindById(resident2.TypeResidents).Name; } if (resident2.Relative != 0) { resident2.RelativeName = FasetItem.FindById(resident2.Relative).Name; } this.dgvNewApartmentResidents.Refresh(); } } else { Messages.ShowMessage("Выберите объект для изменения"); } }
private void tsBtnAddResident_Click(object sender, System.EventArgs e) { ApartmentResidentForm form = new ApartmentResidentForm(this.m_OldApartment, false); if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { ApartmentResident apartmentResident = form.ApartmentResident; apartmentResident.ApartmentId = Apartment.Null.Id; Person person = Person.FindById(apartmentResident.PersonId); apartmentResident.PersonName = person.FullName; apartmentResident.BirthDate = person.BirthDate; if (apartmentResident.TypeResidents != 0) { apartmentResident.TypeResidentName = FasetItem.FindById(apartmentResident.TypeResidents).Name; } if (apartmentResident.Relative != 0) { apartmentResident.RelativeName = FasetItem.FindById(apartmentResident.Relative).Name; } this.bsNewApartmentResidents.Add(apartmentResident); } }