private void btnDeleteService_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (this.IsLockForm == false) { DialogResult result = MessageBox.Show("Xóa dịch vụ phòng đã sử dụng. Tiếp tục?", "Xóa dịch vụ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { BookingRooms_ServicesBO aBookingRooms_ServicesBO = new BookingRooms_ServicesBO(); int IDBookingService = Convert.ToInt32(viewServicesR.GetFocusedRowCellValue("IDBookingService")); aBookingRooms_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 Save() { BookingRooms_ServicesBO aBookingRooms_ServicesBO = new BookingRooms_ServicesBO(); BookingRooms_Services aBookingRooms_Services; List<string> aList = aListSelected.Where(p => p.Tag == null || p.Tag == string.Empty).Select(p => p.Tag).ToList(); if (aList.Count > 0) { MessageBox.Show("Có dịch vụ nào đó chưa được chọn người trả tiền"); } else { for (int i = 0; i < aListSelected.Count; i++) { aBookingRooms_Services = aBookingRooms_ServicesBO.Select_ByID(aListSelected[i].ID); if (aBookingRooms_Services != null) { aBookingRooms_Services.Cost = aListSelected[i].Cost; aBookingRooms_Services.Quantity = aListSelected[i].Quantity; aBookingRooms_Services.PercentTax = aListSelected[i].PercentTax; aBookingRooms_Services.Date = aListSelected[i].Date; aBookingRooms_Services.Tag = aListSelected[i].Tag; aBookingRooms_ServicesBO.Update(aBookingRooms_Services); } else { aBookingRooms_Services = new BookingRooms_Services(); aBookingRooms_Services.Info = ""; aBookingRooms_Services.Type = 1; aBookingRooms_Services.Status = 1; aBookingRooms_Services.Disable = false; aBookingRooms_Services.IDBookingRoom = this.IDBookingRoom; aBookingRooms_Services.IDService = aListSelected[i].IDService; aBookingRooms_Services.Cost = aListSelected[i].Cost; aBookingRooms_Services.Date = dtpDate.DateTime; aBookingRooms_Services.CostRef_Services = aListSelected[i].CostRef_Services; aBookingRooms_Services.PercentTax = 10;// de mac dinh aBookingRooms_Services.Quantity = aListSelected[i].Quantity; aBookingRooms_Services.Tag = aListSelected[i].Tag; aBookingRooms_ServicesBO.Insert(aBookingRooms_Services); } } foreach (BookingRooms_Services items in this.aListRemove) { aBookingRooms_ServicesBO.Delete(items.ID); } if (this.afrmTsk_Payment_Step2 != null) { this.afrmTsk_Payment_Step2.Reload(); } MessageBox.Show("Thực hiện thành công!", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } }
private void btnDeleteService_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { DialogResult result = MessageBox.Show("Xóa dịch vụ phòng đã sử dụng. Tiếp tục?", "Xóa dịch vụ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { BookingRooms_ServicesBO aBookingRooms_ServicesBO = new BookingRooms_ServicesBO(); int IDService = Convert.ToInt32(viewServices.GetFocusedRowCellValue("IDService")); DateTime DateUsed = Convert.ToDateTime(viewServices.GetFocusedRowCellValue("DateUsed")); aBookingRooms_ServicesBO.Delete(IDService, CurrentIDBookingRoom, DateUsed); MessageBox.Show("Thực hiện thành công!", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Reload(); } }