private void btnDeleteServiceHall_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (this.IsLockForm == false) { DialogResult result = MessageBox.Show("Xóa dịch vụ hội trường đã sử dụng. Tiếp tục?", "Xóa dịch vụ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { BookingHalls_ServicesBO aBookingHalls_ServicesBO = new BookingHalls_ServicesBO(); int IDBookingService = Convert.ToInt32(viewServicesH.GetFocusedRowCellValue("IDBookingService")); aBookingHalls_ServicesBO.Delete(IDBookingService); MessageBox.Show("Thực hiện thành công!", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Reload(); } } else { MessageBox.Show("Không thực hiện được chức năng này do form đang chế độ khóa"); } }
private void btnDeleteServiceHall_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { DialogResult result = MessageBox.Show("Xóa dịch vụ hội trường đã sử dụng. Tiếp tục?", "Xóa dịch vụ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { BookingHalls_ServicesBO aBookingHalls_ServicesBO = new BookingHalls_ServicesBO(); int IDService = Convert.ToInt32(viewServices.GetFocusedRowCellValue("IDService")); DateTime DateUsed = Convert.ToDateTime(viewServices.GetFocusedRowCellValue("Date")); aBookingHalls_ServicesBO.Delete(IDService, CurrentIDBookingHall, DateUsed); MessageBox.Show("Thực hiện thành công!", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Reload(); } }
private void Save() { BookingHalls_ServicesBO aBookingHalls_ServicesBO = new BookingHalls_ServicesBO(); BookingHalls_Services aBookingHalls_Services; for (int i = 0; i < aListSelected.Count; i++) { aBookingHalls_Services = aBookingHalls_ServicesBO.Select_ByID(aListSelected[i].ID); if (aBookingHalls_Services != null) { aBookingHalls_Services.Cost = aListSelected[i].Cost; aBookingHalls_Services.Quantity = aListSelected[i].Quantity; aBookingHalls_Services.PercentTax = aListSelected[i].PercentTax; aBookingHalls_Services.Date = aListSelected[i].Date; aBookingHalls_ServicesBO.Update(aBookingHalls_Services); } else { aBookingHalls_Services = new BookingHalls_Services(); aBookingHalls_Services.Info = ""; aBookingHalls_Services.Type = 1; aBookingHalls_Services.Status = 1; aBookingHalls_Services.Disable = false; aBookingHalls_Services.IDBookingHall = this.IDBookingHall; aBookingHalls_Services.IDService = aListSelected[i].IDService; aBookingHalls_Services.Cost = aListSelected[i].Cost; aBookingHalls_Services.Date = dtpDate.DateTime; aBookingHalls_Services.CostRef_Services = aListSelected[i].CostRef_Services; aBookingHalls_Services.PercentTax = 10;// de mac dinh aBookingHalls_Services.Quantity = aListSelected[i].Quantity; aBookingHalls_ServicesBO.Insert(aBookingHalls_Services); } } foreach (BookingHalls_Services items in this.aListRemove) { aBookingHalls_ServicesBO.Delete(items.ID); } if (this.afrmTsk_Payment_Step2 != null) { if (aNewPayment.aListBookingHallUsed.Where(a => a.ID == IDBookingHall).ToList().Count > 0) { aNewPayment.aListBookingHallUsed.Where(a => a.ID == IDBookingHall).ToList()[0].aListServiceUsed.Clear(); aNewPayment.aListBookingHallUsed.Where(a => a.ID == IDBookingHall).ToList()[0].aListServiceUsed = aReceptionTaskBO.GetListServiceUsedInHall_ByIDBookingHall(IDBookingHall); } this.afrmTsk_Payment_Step2.Reload(); } if (this.afrmTsk_UpdBookingHall != null) { if (aNewPaymentH.aListBookingHallUsed.Where(a => a.ID == IDBookingHall).ToList().Count > 0) { aNewPaymentH.aListBookingHallUsed.Where(a => a.ID == IDBookingHall).ToList()[0].aListServiceUsed.Clear(); aNewPaymentH.aListBookingHallUsed.Where(a => a.ID == IDBookingHall).ToList()[0].aListServiceUsed = aReceptionTaskBO.GetListServiceUsedInHall_ByIDBookingHall(IDBookingHall); } this.afrmTsk_UpdBookingHall.Reload(this.aNewPaymentH); } MessageBox.Show("Thực hiện thành công!", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); }
private void btnSave_Click(object sender, EventArgs e) { BookingHalls_ServicesBO aBookingHalls_ServicesBO = new BookingHalls_ServicesBO(); BookingHalls_Services aBookingHalls_Services; for (int i = 0; i < aListSelected.Count; i++) { aBookingHalls_Services = aBookingHalls_ServicesBO.Select_ByID(aListSelected[i].ID); if (aBookingHalls_Services != null) { aBookingHalls_Services.Cost = aListSelected[i].Cost; aBookingHalls_Services.Quantity = aListSelected[i].Quantity; aBookingHalls_ServicesBO.Update(aBookingHalls_Services); } else { aBookingHalls_Services = new BookingHalls_Services(); aBookingHalls_Services.Info = ""; aBookingHalls_Services.Type = 1; aBookingHalls_Services.Status = 1; aBookingHalls_Services.Disable = false; aBookingHalls_Services.IDBookingHall = this.IDBookingHall; aBookingHalls_Services.IDService = aListSelected[i].IDService; aBookingHalls_Services.Cost = aListSelected[i].Cost; aBookingHalls_Services.Date = DateTime.Now; aBookingHalls_Services.CostRef_Services = aListSelected[i].CostRef_Services; aBookingHalls_Services.PercentTax = 10;// de mac dinh aBookingHalls_Services.Quantity = aListSelected[i].Quantity; aBookingHalls_ServicesBO.Insert(aBookingHalls_Services); } } foreach (BookingHalls_Services items in this.aListRemove) { aBookingHalls_ServicesBO.Delete(items.IDService, items.IDBookingHall); } if (afrmTsk_PaymentHall != null) { this.afrmTsk_PaymentHall.LoadListHall(); } MessageBox.Show("Thực hiện thành công!", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); }