public HouseAddService(UjfHouseService Service) { this.serviceTypes = new UjfServiceType(); this.ujfService = new UjfService(); this.InitializeComponent(); this.houseService = Service; this.set_Font(Manager.WindowFont); this.kindFasetData.Faset = FasetsEnum.KindUJF; this.kindFasetData.RefreshValuesWithNull(); this.kindFasetData.SelectedFasetItem = FasetItem.Null; this.bsUjfServices.set_DataSource(this.ujfService.GetAll()); if (!this.houseService.IsNew) { this.datePeriod.DateBegin = this.houseService.FromDate; this.datePeriod.DateEnd = this.houseService.ToDate; this.servicesCB.set_SelectedItem(Mappers.UjfServiceMapper.FindById(this.houseService.ServiceId)); this.kTextBox.set_Text(this.houseService.K.ToString()); if (this.houseService.KindId != 0) { this.kindFasetData.SelectedFasetItem = FasetItem.FindById(this.houseService.KindId); } else { this.kindFasetData.set_SelectedIndex(0); } this.set_Text("Изменить услугу"); this.btnOk.set_Text("Изменить"); } }
private void tsBtnDeleteService_Click(object sender, System.EventArgs e) { UjfHouseService service = new UjfHouseService(); service = this.bsHouseService.get_Current() as UjfHouseService; if (service != null) { if (System.Windows.Forms.MessageBox.Show("Вы действительно хотите удалить? ", "Внимание", System.Windows.Forms.MessageBoxButtons.YesNo) != System.Windows.Forms.DialogResult.No) { service.Delete(); service.SaveChanges(); this.UpdateBindingSourceHouseService(); } } else { System.Windows.Forms.MessageBox.Show("Выберите строку для удаления"); } }
private void tsBtnChangeService_Click(object sender, System.EventArgs e) { UjfHouseService service = new UjfHouseService(); service = this.bsHouseService.get_Current() as UjfHouseService; if (service != null) { new HouseAddService(service).ShowDialog(); this.UpdateBindingSourceHouseService(); } else { System.Windows.Forms.MessageBox.Show("Выберите строку для изменения"); } }
private void tsBtnAddService_Click(object sender, System.EventArgs e) { UjfHouseService service = new UjfHouseService { HouseId = this.house.Id }; new HouseAddService(service).ShowDialog(); this.UpdateBindingSourceHouseService(); }