public frmRpt_UnSelectMenus(int IDBookingHall) { InitializeComponent(); this.IDBookingHall = IDBookingHall; FoodsBO aFoodsBO = new FoodsBO(); MenusBO aMenusBO = new MenusBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); // Thông tin buổi tiệc BookingHallsBO aBookingHallsBO = new BookingHallsBO(); BookingHalls aTemp = aBookingHallsBO.Select_ByID(IDBookingHall); lblStartTime.Text = aTemp.StartTime.ToString(); lblEndTime.Text = aTemp.EndTime.ToString(); HallsBO aHallsBO = new HallsBO(); lblHallSku.Text = aHallsBO.Select_ByCodeHall(aTemp.CodeHall, 1).Sku; BookingHsBO aBookingHsBO = new BookingHsBO(); lblSubject.Text = aBookingHsBO.Select_ByID(aTemp.IDBookingH).Subject; this.LoadMenus(); //danh sach cac mon an co trong thuc don 1 DetailReport.DataSource = aListFood1; picImage1Food.DataBindings.Add("Image", this.DataSource, "Image1"); colNameFood.DataBindings.Add("Text", this.DataSource, "Name"); colName1Food.DataBindings.Add("Text", this.DataSource, "Name1"); colName2Food.DataBindings.Add("Text", this.DataSource, "Name2"); colName3Food.DataBindings.Add("Text", this.DataSource, "Name3"); }
//Hiennv public List<BookingHEN> LoadData() { try { BookingHsBO aBookingHsBO = new BookingHsBO(); List<BookingHEN> aListBookedHs = new List<BookingHEN>(); List<BookingHs> aListTemp = new List<BookingHs>(); aListTemp = aBookingHsBO.Select_ByDate_byStatus(dtpFrom.DateTime, dtpTo.DateTime); BookingHEN aBookingHEN; for (int i = 0; i < aListTemp.Count; i++) { aBookingHEN = new BookingHEN(); aBookingHEN.SetValue(aListTemp[i]); aBookingHEN.StatusPayDisplay = CORE.CONSTANTS.SelectedStatusPay(Convert.ToInt16(aBookingHEN.StatusPay)).Name; aBookingHEN.CustomerTypeDisplay = CORE.CONSTANTS.SelectedCustomerType(Convert.ToInt16(aBookingHEN.CustomerType)).Name; if (aBookingHEN.Type == 1) { aBookingHEN.TypeDisplay = "Tiệc không thuộc phạm trù nhà bếp"; } else { aBookingHEN.TypeDisplay = "Tiệc thuộc phạm trù nhà bếp"; } aListBookedHs.Add(aBookingHEN); } return aListBookedHs; } catch (Exception ex) { return null; MessageBox.Show("frmTsk_ListBookingHs.LoadData\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public frmRpt_UnSelectMenus(int IDBookingHall,int IDMenu) { InitializeComponent(); this.IDBookingHall = IDBookingHall; FoodsBO aFoodsBO = new FoodsBO(); MenusBO aMenusBO = new MenusBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); // Thông tin buổi tiệc BookingHallsBO aBookingHallsBO = new BookingHallsBO(); BookingHalls aTemp = aBookingHallsBO.Select_ByID(IDBookingHall); lblStartTime.Text = aTemp.StartTime.ToString(); lblEndTime.Text = aTemp.EndTime.ToString(); HallsBO aHallsBO = new HallsBO(); lblHallSku.Text = aHallsBO.Select_ByCodeHall(aTemp.CodeHall, 1).Sku; BookingHsBO aBookingHsBO = new BookingHsBO(); lblSubject.Text = aBookingHsBO.Select_ByID(aTemp.IDBookingH).Subject; // Load Menu Menus_FoodsBO aMenus_FoodsBO = new Menus_FoodsBO(); Menus aMenus = aMenusBO.Select_ByID(IDMenu); if (aMenus != null) { List<Foods> aListTemp1 = aMenus_FoodsBO.SelectListFoods_ByIDMenu(aMenus.ID); foreach (Foods item in aListTemp1) { if (item.Image1 != null) { if (item.Image1.Length <= 0) { Image image = RoomManager.Properties.Resources.logo_nkcp_small; image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero); Byte[] aImageByte = this.ConvertImageToByteArray(image); item.Image1 = aImageByte; } } else { Image image = RoomManager.Properties.Resources.logo_nkcp_small; image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero); Byte[] aImageByte = this.ConvertImageToByteArray(image); item.Image1 = aImageByte; } aListFood1.Add(item); } } //danh sach cac mon an co trong thuc don 1 DetailReport.DataSource = aListFood1; picImage1Food.DataBindings.Add("Image", this.DataSource, "Image1"); colNameFood.DataBindings.Add("Text", this.DataSource, "Name"); colName1Food.DataBindings.Add("Text", this.DataSource, "Name1"); colName2Food.DataBindings.Add("Text", this.DataSource, "Name2"); colName3Food.DataBindings.Add("Text", this.DataSource, "Name3"); }
//Author: Linhting public void AutoChangeStatusBookingHalls(int IDBookingH) { BookingHsBO aBookingHsBO = new BookingHsBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookigH(IDBookingH); int Status = Convert.ToInt32( aBookingHsBO.Select_ByID(IDBookingH).Status); for (int i = 0; i < aListBookingHalls.Count; i++) { aListBookingHalls[i].Status = Status; aBookingHallsBO.UpdateUnSync(aListBookingHalls[i]); } }
public void AutoChangeStatusBookingH(int IDBookingH) { BookingHsBO aBookingHsBO = new BookingHsBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookigH(IDBookingH); List<int> ListStatusHall = new List<int>(); int MinHallStatus; MinHallStatus = Convert.ToInt32( aListBookingHalls[0].Status); for (int i = 0; i < aListBookingHalls.Count; i++) { if (MinHallStatus > aListBookingHalls[i].Status) { MinHallStatus = Convert.ToInt32(aListBookingHalls[i].Status); } } BookingHs aBookingHs = aBookingHsBO.Select_ByID(IDBookingH); aBookingHs.Status = MinHallStatus; aBookingHsBO.UpdateUnSync(aBookingHs); }
public void InitData(int IDBookingH) { CompaniesBO aCompaniesBO = new CompaniesBO(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); SystemUsersBO aSystemUsersBO = new SystemUsersBO(); BookingHsBO aBookingHsBO = new BookingHsBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); HallsBO aHallsBO = new HallsBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); FoodsBO aFoodsBO = new FoodsBO(); List<int> aListIndexTemp = new List<int>(); BookingHs aBookingHs = aBookingHsBO.Select_ByID(IDBookingH); if (aBookingHs != null) { aNewPaymentHEN.IDCustomer = aBookingHs.IDCustomer; Customers aCustomers = aCustomersBO.Select_ByID(aBookingHs.IDCustomer); if (aCustomers != null) { aNewPaymentHEN.NameCustomer = aCustomers.Name; } aNewPaymentHEN.IDSystemUser = aBookingHs.IDSystemUser; SystemUsers aSystemUsers = aSystemUsersBO.Select_ByID(aBookingHs.IDSystemUser); if (aSystemUsers != null) { aNewPaymentHEN.NameSystemUser = aSystemUsers.Name; } aNewPaymentHEN.IDCustomerGroup = aBookingHs.IDCustomerGroup; CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingHs.IDCustomerGroup); if (aCustomerGroups != null) { aNewPaymentHEN.NameCustomerGroup = aCustomerGroups.Name; aNewPaymentHEN.IDCompany = aCustomerGroups.IDCompany; Companies aCompanies = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany); if (aCompanies != null) { aNewPaymentHEN.NameCompany = aCompanies.Name; aNewPaymentHEN.TaxNumberCodeCompany = aCompanies.TaxNumberCode; aNewPaymentHEN.AddressCompany = aCompanies.Address; } } aNewPaymentHEN.Subject = aBookingHs.Subject; aNewPaymentHEN.PayMenthodH = aBookingHs.PayMenthod; aNewPaymentHEN.CreatedDate_BookingH = aBookingHs.CreatedDate; aNewPaymentHEN.CustomerType = aBookingHs.CustomerType; aNewPaymentHEN.Status_BookingH = aBookingHs.Status; aNewPaymentHEN.StatusPay = aBookingHs.StatusPay; aNewPaymentHEN.BookingHMoney = aBookingHs.BookingMoney; aNewPaymentHEN.AcceptDate = aBookingHs.AcceptDate; aNewPaymentHEN.InvoiceDate = aBookingHs.InvoiceDate; aNewPaymentHEN.InvoiceNumber = aBookingHs.InvoiceNumber; this.aNewPaymentHEN.IDBookingH = aBookingHs.ID; this.aNewPaymentHEN.PayMenthodH = aBookingHs.PayMenthod; this.aNewPaymentHEN.CreatedDate_BookingH = aBookingHs.CreatedDate; this.aNewPaymentHEN.CustomerType = aBookingHs.CustomerType; this.aNewPaymentHEN.Status_BookingH = aBookingHs.Status; this.aNewPaymentHEN.BookingHMoney = aBookingHs.BookingMoney; // Truyen du lieu cho List BookingHall cua NewPayment List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookigH(this.IDBookingH); if (aListBookingHalls != null) { BookingHallUsedEN aBookingHallUsedEN; foreach (BookingHalls item in aListBookingHalls) { aBookingHallUsedEN = new BookingHallUsedEN(); aBookingHallUsedEN.SetValue(item); Halls aHalls = aHallsBO.Select_ByCodeHall(item.CodeHall, 1); if (aHalls != null) { aBookingHallUsedEN.HallSku = aHalls.Sku; } else { aBookingHallUsedEN.HallSku = string.Empty; } aBookingHallUsedEN.CustomerType = aBookingHs.CustomerType; aBookingHallUsedEN.BookingTypeBookingH = aBookingHs.BookingType; aBookingHallUsedEN.StatusPayBookingH = aBookingHs.StatusPay; aBookingHallUsedEN.LevelBookingH = aBookingHs.Level; aBookingHallUsedEN.aListMenuEN = aReceptionTaskBO.GetListMenus_ByIDBookingHall(item.ID); aListIndexTemp.Add(Convert.ToInt32(aBookingHallUsedEN.IndexSubPayment)); List<ServiceUsedEN> aListServiceTemp = aReceptionTaskBO.GetListServiceUsedInHall_ByIDBookingHall(item.ID); foreach (ServiceUsedEN aTemp in aListServiceTemp) { aBookingHallUsedEN.aListServiceUsed.Add(aTemp); aListIndexTemp.Add(Convert.ToInt32(aTemp.IndexSubPayment)); } aNewPaymentHEN.aListBookingHallUsed.Add(aBookingHallUsedEN); } } } aNewPaymentHEN.ListIndex = aListIndexTemp.Distinct().ToList(); }
//Hiennv private void btnPayment_Click(object sender, EventArgs e) { try { if (String.IsNullOrEmpty(lueIndexSub.Text) == true) { lueIndexSub.Focus(); MessageBox.Show("Vui lòng chọn phiếu thanh toán!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { BookingHalls_ServicesBO aBookingHalls_ServicesBO = new BookingHalls_ServicesBO(); foreach (ServicesHallsEN aServicesHallsEN in this.aListServices) { BookingHalls_Services aBookingHalls_Services = aBookingHalls_ServicesBO.Select_ByID(aServicesHallsEN.IDBookingHallService); if (aBookingHalls_Services != null && aBookingHalls_Services.Status != 8) { aBookingHalls_Services.ID = aServicesHallsEN.IDBookingHallService; aBookingHalls_Services.Quantity = aServicesHallsEN.Quantity; aBookingHalls_Services.PercentTax = aServicesHallsEN.PercentTax; aBookingHalls_Services.Cost = aServicesHallsEN.Cost; aBookingHalls_Services.Status = 8;// da thanh toan aBookingHalls_ServicesBO.Update(aBookingHalls_Services); } } BookingHallsBO aBookingHallsBO = new BookingHallsBO(); foreach (HallsEN aHallsEN in this.aListHalls) { BookingHalls aBookingHalls = aBookingHallsBO.Select_ByID(aHallsEN.IDBookingHall); if (aBookingHalls != null && aBookingHalls.Status != 8) { aBookingHalls.ID = aHallsEN.IDBookingHall; aBookingHalls.PercentTax = aHallsEN.PercentTax; aBookingHalls.Cost = aHallsEN.Cost; aBookingHalls.Status = 8;//da thanh toan aBookingHallsBO.Update(aBookingHalls); } } BookingHsBO aBookingHsBO = new BookingHsBO(); BookingHs aBookingHs = aBookingHsBO.Select_ByID(this.aPaymentHallsEN.IDBookingH); List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookingH_ByStatus(this.aPaymentHallsEN.IDBookingH,8); if (aListBookingHalls.Count < 1) { aBookingHs.ID = aPaymentHallsEN.IDBookingH; aBookingHs.PayMenthod = this.aPaymentHallsEN.PayMenthod; aBookingHs.StatusPay = 3; aBookingHs.Status = 8; btnPayment.Enabled = false; } aBookingHs.BookingMoney = this.aPaymentHallsEN.GetBookingMoney(); aBookingHsBO.Update(aBookingHs); MessageBox.Show("Thanh toán thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show("frmTsk_SplitBillHalls_Step2_Load.btnPayment_Click\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//Hiennv 31/08/2014 Thanh toan le cho hoi truong public void SplitPaymentForBookingH(NewPaymentEN aNewPaymentEN, List<BookingHallUsedEN> aListHalls, List<ServiceUsedEN> aListServicesH) { try { foreach (ServiceUsedEN aServicesEN in aListServicesH) { aServicesEN.StatusPay = 8; aServicesEN.Save(2); } BookingHallsBO aBookingHallsBO = new BookingHallsBO(); foreach (BookingHallUsedEN aHallsEN in aListHalls) { aHallsEN.Status = 8; aHallsEN.Save(); } BookingHsBO aBookingHsBO = new BookingHsBO(); BookingHs aBookingHs = aBookingHsBO.Select_ByID(Convert.ToInt32(aNewPaymentEN.IDBookingH)); List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookingH_ByStatus(Convert.ToInt32(aNewPaymentEN.IDBookingH), 8); if (aListBookingHalls.Count < 1) { aBookingHs.ID = Convert.ToInt32(aNewPaymentEN.IDBookingH); aBookingHs.PayMenthod = aNewPaymentEN.PayMenthodH; aBookingHs.StatusPay = 3; aBookingHs.Status = 8; aBookingHs.DatePay = DateTime.Now; } aBookingHs.BookingMoney = aNewPaymentEN.BookingHMoney; aBookingHsBO.Update(aBookingHs); } catch (Exception ex) { throw new Exception("ReceptionTaskBO.SplitPaymentForBookingH \n" + ex.ToString()); } }
public void ReloadData() { BookingHsBO aBookingHsBO = new BookingHsBO(); BookingHs aBookingHs = aBookingHsBO.Select_ByID(IDBookingH); if (aBookingHs.Type == 1) { cbbType.Text = "Tiệc không thuộc phạm trù nhà bếp"; } else { cbbType.Text = "Tiệc thuộc phạm trù nhà bếp"; } lueBookingStatus.Properties.DataSource = CORE.CONSTANTS.ListBookingHallStatus; lueBookingStatus.Properties.DisplayMember = "Name"; lueBookingStatus.Properties.ValueMember = "ID"; lueBookingStatus.EditValue = aBookingHs.Status; lueBookingType.Properties.DataSource = CORE.CONSTANTS.ListBookingTypes; lueBookingType.Properties.DisplayMember = "Name"; lueBookingType.Properties.ValueMember = "ID"; lueBookingType.EditValue = aBookingHs.BookingType; lueStatusPay.Properties.DataSource = CORE.CONSTANTS.ListStatusPays; lueStatusPay.Properties.DisplayMember = "Name"; lueStatusPay.Properties.ValueMember = "ID"; lueStatusPay.EditValue = aBookingHs.StatusPay; if (aBookingHs.CustomerType == 1) { lueLevel.Properties.DataSource = CORE.CONSTANTS.ListLevels; lueLevel.Properties.DisplayMember = "Name"; lueLevel.Properties.ValueMember = "ID"; lueLevel.EditValue = aBookingHs.Level; lueCompany.Properties.DataSource = aCompaniesBO.Select_ByType(1);// [Company] Type = 1 : Nha nuoc, 1; lueCompany.Properties.DisplayMember = "Name"; lueCompany.Properties.ValueMember = "ID"; lueCompany.EditValue = aCustomerGroupsBO.Select_ByID(aBookingHs.IDCustomerGroup).IDCompany; } else if (aBookingHs.CustomerType == 2) { lueLevel.Visible = false; lueCompany.Properties.DataSource = aCompaniesBO.Select_ByType(2); lueCompany.Properties.DisplayMember = "Name"; lueCompany.Properties.ValueMember = "ID"; lueCompany.EditValue = aCustomerGroupsBO.Select_ByID(aBookingHs.IDCustomerGroup).IDCompany; } else { lueLevel.Visible = false; lueCompany.Properties.DataSource = aCompaniesBO.Select_ByType(3); lueCompany.Properties.DisplayMember = "Name"; lueCompany.Properties.ValueMember = "ID"; lueCompany.EditValue = aCustomerGroupsBO.Select_ByID(aBookingHs.IDCustomerGroup).IDCompany; } lueCustomer.Properties.DataSource = aCustomersBO.Select_All(); lueCustomer.Properties.DisplayMember = "Name"; lueCustomer.Properties.ValueMember = "ID"; lueCustomer.EditValue = aBookingHs.IDCustomer; lueCustomerGroup.Properties.DataSource = aCustomerGroupsBO.Select_All(); lueCustomerGroup.Properties.DisplayMember = "Name"; lueCustomerGroup.Properties.ValueMember = "ID"; lueCustomerGroup.EditValue = aBookingHs.IDCustomerGroup; lueGuest.Properties.DataSource = aGuestsBO.Select_All(); lueGuest.Properties.DisplayMember = "Name"; lueGuest.Properties.ValueMember = "ID"; lueGuest.EditValue = aBookingHs.IDGuest; LoadData(); LoadCompanies(); }
private void btnDone_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { BookingHsBO aBookingHsBO = new BookingHsBO(); int IDBookingH = Convert.ToInt32(grvBookingRs.GetFocusedRowCellValue("ID")); BookingHs aBookingHs = aBookingHsBO.Select_ByID(IDBookingH); aBookingHs.Status = 7; aBookingHsBO.Update(aBookingHs); MessageBox.Show("Đã chuyển sang trạng thái 'Hoàn thành' ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void frmTsk_ListBookingHs_Load(object sender, EventArgs e) { dtpFrom.DateTime = DateTime.Now.Date; dtpTo.DateTime = DateTime.Now.AddDays(7); dgvBookingRs.DataSource = this.LoadData(); dgvBookingRs.RefreshDataSource(); if (afrmTsk_ManageBookingHs != null) { tableLayoutPanel3.Visible = false; BookingHsBO aBookingHsBO = new BookingHsBO(); List<BookingHEN> aListBookedHs = new List<BookingHEN>(); BookingHs aTemp = aBookingHsBO.Select_ByID(this.IDBookingH); List<BookingHs> aListTemp = new List<BookingHs>(); aListTemp.Add(aTemp); BookingHEN aBookingHEN; for (int i = 0; i < aListTemp.Count; i++) { aBookingHEN = new BookingHEN(); aBookingHEN.SetValue(aListTemp[i]); aBookingHEN.StatusPayDisplay = CORE.CONSTANTS.SelectedStatusPay(Convert.ToInt16(aBookingHEN.StatusPay)).Name; aBookingHEN.CustomerTypeDisplay = CORE.CONSTANTS.SelectedCustomerType(Convert.ToInt16(aBookingHEN.CustomerType)).Name; if (aBookingHEN.Type == 1) { aBookingHEN.TypeDisplay = "Tiệc không thuộc phạm trù nhà bếp"; } else { aBookingHEN.TypeDisplay = "Tiệc thuộc phạm trù nhà bếp"; } aListBookedHs.Add(aBookingHEN); } dgvBookingRs.DataSource = aListBookedHs; dgvBookingRs.RefreshDataSource(); } }
// Author : Linhting public void InitData( int IDBookingH) { try { CompaniesBO aCompaniesBO = new CompaniesBO(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); SystemUsersBO aSystemUsersBO = new SystemUsersBO(); BookingHsBO aBookingHsBO = new BookingHsBO(); CustomersBO aCustomersBO = new CustomersBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); HallsBO aHallsBO = new HallsBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); FoodsBO aFoodsBO = new FoodsBO(); BookingHs aBookingHs = aBookingHsBO.Select_ByID(IDBookingH); // Truyen du lieu cho List BookingRoom cua NewPayment if (aBookingHs != null) { aNewPaymentEN.IDCustomer = aBookingHs.IDCustomer; Customers aCustomers = aCustomersBO.Select_ByID(aBookingHs.IDCustomer); if (aCustomers != null) { aNewPaymentEN.NameCustomer = aCustomers.Name; } aNewPaymentEN.IDSystemUser = aBookingHs.IDSystemUser; SystemUsers aSystemUsers = aSystemUsersBO.Select_ByID(aBookingHs.IDSystemUser); if (aSystemUsers != null) { aNewPaymentEN.NameSystemUser = aSystemUsers.Name; } aNewPaymentEN.IDCustomerGroup = aBookingHs.IDCustomerGroup; CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingHs.IDCustomerGroup); if (aCustomerGroups != null) { aNewPaymentEN.NameCustomerGroup = aCustomerGroups.Name; aNewPaymentEN.IDCompany = aCustomerGroups.IDCompany; Companies aCompanies = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany); if (aCompanies != null) { aNewPaymentEN.NameCompany = aCompanies.Name; aNewPaymentEN.TaxNumberCodeCompany = aCompanies.TaxNumberCode; aNewPaymentEN.AddressCompany = aCompanies.Address; } } aNewPaymentEN.IDBookingH = aBookingHs.ID; aNewPaymentEN.CreatedDate_BookingH = aBookingHs.CreatedDate; aNewPaymentEN.CustomerType = aBookingHs.CustomerType; aNewPaymentEN.Status_BookingH = aBookingHs.Status; aNewPaymentEN.BookingHMoney = aBookingHs.BookingMoney; // Truyen du lieu cho List BookingHall cua NewPayment List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookigH(this.IDBookingH); if (aListBookingHalls != null) { BookingHallUsedEN aBookingHallUsedEN; foreach (BookingHalls item in aListBookingHalls) { aBookingHallUsedEN = new BookingHallUsedEN(); aBookingHallUsedEN.SetValue(item); Halls aHalls = aHallsBO.Select_ByCodeHall(item.CodeHall, 1); if (aHalls != null) { aBookingHallUsedEN.HallSku = aHalls.Sku; } else { aBookingHallUsedEN.HallSku = string.Empty; } aBookingHallUsedEN.CustomerType = aBookingHs.CustomerType; aBookingHallUsedEN.BookingTypeBookingH = aBookingHs.BookingType; aBookingHallUsedEN.StatusPayBookingH = aBookingHs.StatusPay; aBookingHallUsedEN.LevelBookingH = aBookingHs.Level; aBookingHallUsedEN.aListMenuEN = aReceptionTaskBO.GetListMenus_ByIDBookingHall(item.ID); List<ServiceUsedEN> aListServiceTemp = aReceptionTaskBO.GetListServiceUsedInHall_ByIDBookingHall(item.ID); foreach (ServiceUsedEN aTemp in aListServiceTemp) { aBookingHallUsedEN.aListServiceUsed.Add(aTemp); } aNewPaymentEN.aListBookingHallUsed.Add(aBookingHallUsedEN); } } } } catch (Exception ex) { MessageBox.Show("frmTsk_PaymentHall.InitData\n" + ex.ToString()); } }
//hiennv public void InitData(PaymentHallsEN aPaymentHallsEN, int IDBookingH) { try { HallsBO aHallsBO = new HallsBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); FoodsBO aFoodsBO = new FoodsBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); CustomersBO aCustomersBO = new CustomersBO(); BookingHsBO aBookingHsBO = new BookingHsBO(); CompaniesBO aCompaniesBO = new CompaniesBO(); SystemUsersBO aSystemUsersBO = new SystemUsersBO(); BookingHs aBookingHs = aBookingHsBO.Select_ByID(IDBookingH); if (aBookingHs != null) { aPaymentHallsEN.IDBookingH = aBookingHs.ID; aPaymentHallsEN.IDCustomerGroup = aBookingHs.IDCustomerGroup; CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingHs.IDCustomerGroup); if (aCustomerGroups != null) { aPaymentHallsEN.NameCustomerGroup = aCustomerGroups.Name; aPaymentHallsEN.IDCompany = aCustomerGroups.IDCompany; Companies aCompanies = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany); if (aCompanies != null) { aPaymentHallsEN.NameCompany = aCompanies.Name; aPaymentHallsEN.TaxNumberCodeCompany = aCompanies.TaxNumberCode; } } aPaymentHallsEN.IDCustomer = aBookingHs.IDCustomer; Customers aCustomers = aCustomersBO.Select_ByID(aBookingHs.IDCustomer); if (aCustomers != null) { aPaymentHallsEN.NameCustomer = aCustomers.Name; } aPaymentHallsEN.IDSystemUser = aBookingHs.IDSystemUser; SystemUsers aSystemUsers = aSystemUsersBO.Select_ByID(aBookingHs.IDSystemUser); if (aSystemUsers != null) { aPaymentHallsEN.NameSystemUser = aSystemUsers.Name; } aPaymentHallsEN.CreatedDate_BookingH = aBookingHs.CreatedDate; aPaymentHallsEN.CustomerType = aBookingHs.CustomerType; aPaymentHallsEN.BookingType = aBookingHs.BookingType; aPaymentHallsEN.PayMenthod = aBookingHs.PayMenthod; aPaymentHallsEN.StatusPay = aBookingHs.StatusPay; aPaymentHallsEN.Status_BookingH = aBookingHs.Status; aPaymentHallsEN.ExchangeRate = aBookingHs.ExchangeRate; aPaymentHallsEN.Level = aBookingHs.Level; aPaymentHallsEN.BookingMoney = aBookingHs.BookingMoney; } List<BookingHalls> aListBookingHalls = new List<BookingHalls>(); aListBookingHalls = aBookingHallsBO.Select_ByIDBookigH(IDBookingH); InfoDetailPaymentHallsEN aInfoDetailPaymentHallsEN; for (int i = 0; i < aListBookingHalls.Count; i++) { aInfoDetailPaymentHallsEN = new InfoDetailPaymentHallsEN(); Halls aHalls = aHallsBO.Select_ByCodeHall(aListBookingHalls[i].CodeHall, 1); if (aHalls != null) { aInfoDetailPaymentHallsEN.Sku = aHalls.Sku; } else { aInfoDetailPaymentHallsEN.Sku = string.Empty; } aInfoDetailPaymentHallsEN.aBookingHalls = aListBookingHalls[i]; aInfoDetailPaymentHallsEN.aMenusEN = aReceptionTaskBO.GetDetailMenu_ByIDBookingHall(aListBookingHalls[i].ID); aInfoDetailPaymentHallsEN.aListServicesHallsEN = aReceptionTaskBO.GetListServicesHallsEN_ByIDBookingHall(aListBookingHalls[i].ID); aPaymentHallsEN.aListInfoDetailPaymentHallsEN.Insert(i, aInfoDetailPaymentHallsEN); } } catch (Exception ex) { MessageBox.Show("frmTsk_PaymentHall.InitData\n" + ex.ToString()); } }
//Author: Linhting public int CheckIn(BookingHs BookingHs, List<BookingHalls> ListBookingHalls) { try { BookingHs aBookingHs = new BookingHs(); aBookingHs.CreatedDate = BookingHs.CreatedDate; aBookingHs.CustomerType = BookingHs.CustomerType; aBookingHs.BookingType = BookingHs.BookingType; aBookingHs.Note = BookingHs.Note; aBookingHs.IDGuest = BookingHs.IDGuest; aBookingHs.StatusPay = BookingHs.StatusPay; aBookingHs.BookingMoney = BookingHs.BookingMoney; aBookingHs.Status = BookingHs.Status; aBookingHs.Type = BookingHs.Type; aBookingHs.Disable = BookingHs.Disable; aBookingHs.Level = BookingHs.Level; aBookingHs.Subject = BookingHs.Subject; aBookingHs.IDCustomerGroup = BookingHs.IDCustomerGroup; aBookingHs.IDCustomer = BookingHs.IDCustomer; aBookingHs.IDSystemUser = BookingHs.IDSystemUser; aBookingHs.Description = BookingHs.Description; //add new bookingRs BookingHsBO aBookingHsBO = new BookingHsBO(); int IDBookingH = aBookingHsBO.InsertUnSync(aBookingHs); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); BookingHalls aBookingHall; for (int i = 0; i < ListBookingHalls.Count; i++) { aBookingHall = new BookingHalls(); aBookingHall.IDBookingH = IDBookingH; aBookingHall.CodeHall = ListBookingHalls[i].CodeHall; aBookingHall.Cost = ListBookingHalls[i].Cost; aBookingHall.PercentTax = ListBookingHalls[i].PercentTax; aBookingHall.CostRef_Halls = ListBookingHalls[i].CostRef_Halls; aBookingHall.Date = ListBookingHalls[i].Date; aBookingHall.LunarDate = ListBookingHalls[i].LunarDate; aBookingHall.BookingStatus = ListBookingHalls[i].BookingStatus; aBookingHall.Unit = ListBookingHalls[i].Unit; aBookingHall.TableOrPerson = ListBookingHalls[i].TableOrPerson; aBookingHall.Note = ListBookingHalls[i].Note; aBookingHall.Status = ListBookingHalls[i].Status; aBookingHall.StartTime = ListBookingHalls[i].StartTime; aBookingHall.EndTime = ListBookingHalls[i].EndTime; aBookingHall.Location = ListBookingHalls[i].Location; aBookingHall.Color = ListBookingHalls[i].Color; aBookingHallsBO.InsertUnSync(aBookingHall); } return IDBookingH; } catch (Exception ex) { throw new Exception("ReceptionTaskBO.CheckIn\n" + ex.ToString()); } }
private void txtSubject_Leave(object sender, EventArgs e) { int IDBookingR = Convert.ToInt32(grvPaymentViewAll.GetFocusedRowCellValue("BookingRs_ID")); string ObjectType = grvPaymentViewAll.GetFocusedRowCellValue("ObjectType").ToString(); string Subject = grvPaymentViewAll.GetFocusedRowCellValue("Subject").ToString(); if (ObjectType == "Phòng") { BookingRs aItem = new BookingRs(); BookingRsBO aBookingRsBO = new BookingRsBO(); aItem = aBookingRsBO.Select_ByID(IDBookingR); aItem.Subject = Subject; aBookingRsBO.Update(aItem); this.LoadData(); } else { BookingHs aItem = new BookingHs(); BookingHsBO aBookingHsBO = new BookingHsBO(); BookingRs_BookingHsBO aBookingRs_BookingHsBO = new BookingRs_BookingHsBO(); int IDBookingH = aBookingRs_BookingHsBO.Select_ByIDBookingR(IDBookingR).IDBookingH.GetValueOrDefault(0); aItem = aBookingHsBO.Select_ByID(IDBookingH); aItem.Subject = Subject; aBookingHsBO.Update(aItem); this.LoadData(); } }
public void LoadData() { //Load dữ liệu công ty if (this.CustomerType == 1) { this.Text = "Đặt tiệc cho khách nhà nước"; Companies aDefault = new Companies(); List<Companies> aList = new List<Companies>(); aDefault.Name = "[Tạo mới cty]"; aDefault.ID = 0; aList = aCompaniesBO.Select_ByType(1);// [Company] Type = 1 : khách nhà nước aList.Add(aDefault); lueCompany.Properties.DataSource = aList; lueCompany.Properties.DisplayMember = "Name"; lueCompany.Properties.ValueMember = "ID"; if (this.IDCompany > 0) { lueCompany.EditValue = this.IDCompany; } else { lueCompany.EditValue = 0; } } if (this.CustomerType == 2) { this.Text = "Đặt tiệc cho khách đoàn"; Companies aDefault = new Companies(); List<Companies> aList = new List<Companies>(); aDefault.Name = "[Tạo mới cty]"; aDefault.ID = 0; aList = aCompaniesBO.Select_ByType(2);// [Company] Type = 2 : khách đoàn aList.Add(aDefault); lueCompany.Properties.DataSource = aList; lueCompany.Properties.DisplayMember = "Name"; lueCompany.Properties.ValueMember = "ID"; if (this.IDCompany > 0) { lueCompany.EditValue = this.IDCompany; } else { lueCompany.EditValue = 0; } } if (this.CustomerType == 3) { this.Text = "Đặt tiệc cho khách lẻ"; Companies aDefault = new Companies(); List<Companies> aList = new List<Companies>(); aDefault.Name = "[Tạo mới cty]"; aDefault.ID = 0; aList = aCompaniesBO.Select_ByType(3);// [Company] Type = 3 : khách lẻ aList.Add(aDefault); lueCompany.Properties.DataSource = aList; lueCompany.Properties.DisplayMember = "Name"; lueCompany.Properties.ValueMember = "ID"; if (this.IDCompany > 0) { lueCompany.EditValue = this.IDCompany; } else { lueCompany.EditValue = 0; } } //Load dữ liệu khách Customers aDefaultCustomers = new Customers(); List<Customers> aListCustomers = new List<Customers>(); aDefaultCustomers.Name = "[Tạo mới người đại diện]"; aDefaultCustomers.ID = 0; aListCustomers = aCustomersBO.Select_All();// [Company] Type = 3 : khách lẻ aListCustomers.Add(aDefaultCustomers); lueCustomer.Properties.DataSource = aListCustomers; lueCustomer.Properties.DisplayMember = "Name"; lueCustomer.Properties.ValueMember = "ID"; if (this.IDCustomer > 0) { lueCustomer.EditValue = this.IDCustomer; } else { lueCustomer.EditValue = 0; } // Load khách mời GuestsBO aGuestsBO = new GuestsBO(); lueGuest.Properties.DataSource = aGuestsBO.Select_All(); lueGuest.Properties.DisplayMember = "Name"; lueGuest.Properties.ValueMember = "ID"; //LoadDataListFoods(); if (this.IsEditForm == true) { BookingHsBO aBookingHsBO = new BookingHsBO(); aBookingHsBO.Select_ByID(this.IDBookingH); } }
private List<BookingHEN> LoadData(int Status) { BookingHsBO aBookingHsBO = new BookingHsBO(); List<BookingHEN> aListBookedHs = new List<BookingHEN>(); List<BookingHs> aListTemp = new List<BookingHs>(); aListTemp = aBookingHsBO.SelectBookingHs_ByTime_ByStatus(dtpFrom.DateTime, dtpTo.DateTime, Status); BookingHEN aBookingHEN; for (int i = 0; i < aListTemp.Count; i++) { aBookingHEN = new BookingHEN(); aBookingHEN.SetValue(aListTemp[i]); aBookingHEN.StatusPayDisplay = CORE.CONSTANTS.SelectedStatusPay(Convert.ToInt16(aBookingHEN.StatusPay)).Name; aBookingHEN.CustomerTypeDisplay = CORE.CONSTANTS.SelectedCustomerType(Convert.ToInt16(aBookingHEN.CustomerType)).Name; aBookingHEN.StatusDisplay = CORE.CONSTANTS.SelectedBookingHStatus(Convert.ToInt16(aBookingHEN.Status)).Name; if (aBookingHEN.Type == 1) { aBookingHEN.TypeDisplay = "Tiệc không thuộc phạm trù nhà bếp"; } else { aBookingHEN.TypeDisplay = "Tiệc thuộc phạm trù nhà bếp"; } aListBookedHs.Add(aBookingHEN); } return aListBookedHs; }
public CustomerGroups Select_ByIDBookingH(int IDBookingH) { try { BookingHsBO aBookingHsBO = new BookingHsBO(); BookingHs aBookingHs = aBookingHsBO.Select_ByID(IDBookingH); List<int> aListIDCustomerGroups = new List<int>(); int aIDCustomerGroups; aIDCustomerGroups = new int(); aIDCustomerGroups = aBookingHs.IDCustomerGroup; return this.Select_ByID(aIDCustomerGroups); } catch (Exception ex) { throw new Exception(string.Format("CustomerGroupBO.Select_ByIDBookingR :" + ex.Message.ToString())); } }
//Author: Linhting public int Insert(BookingHalls bookingHalls) { try { BookingHsBO aBookingHsBO = new BookingHsBO(); aDatabaseDA.BookingHalls.Add(bookingHalls); aBookingHsBO.AutoChangeStatusBookingH(bookingHalls.IDBookingH); return aDatabaseDA.SaveChanges(); } catch (Exception ex) { throw new Exception("BookingHallsBO.Insert:" + ex.ToString()); } }
private void btnDone_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { BookingHsBO aBookingHsBO = new BookingHsBO(); int IDBookingH = Convert.ToInt32(grvBookingHs.GetFocusedRowCellValue("ID")); frmTsk_ListBookingHs afrmTsk_ListBookingHs = new frmTsk_ListBookingHs(this, IDBookingH); afrmTsk_ListBookingHs.ShowDialog(); } catch (Exception ex) { MessageBox.Show("frmTsk_ManageBookingHs.btnDone_ButtonClick \n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// Author : Linhting public void LoadCustomerInfo() { try { BookingHsBO aBookingHsBO = new BookingHsBO(); CustomersBO aCustomersBO = new CustomersBO(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); CompaniesBO aCompaniesBO = new CompaniesBO(); int IDCustomer = aBookingHsBO.Select_ByID(this.IDBookingH).IDCustomer; int IDCustomerGroup = aBookingHsBO.Select_ByID(this.IDBookingH).IDCustomerGroup; lblCompany.Text = aCompaniesBO.Select_ByIDCustomerGroup(IDCustomerGroup).Name; lblNameCustomerGroup.Text = aCustomerGroupsBO.Select_ByID(IDCustomerGroup).Name; lblNameCustomer.Text = aCustomersBO.Select_ByID(IDCustomer).Name; } catch (Exception ex) { MessageBox.Show("frmTsk_PaymentHall.LoadCustomerInfo\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnWaitingConfirm_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { BookingHsBO aBookingHsBO = new BookingHsBO(); int IDBookingH = Convert.ToInt32(grvBookingHs.GetFocusedRowCellValue("ID")); BookingHs aBookingHs = aBookingHsBO.Select_ByID(IDBookingH); aBookingHs.Status = 3; aBookingHsBO.Update(aBookingHs); MessageBox.Show("Đã chuyển sang trạng thái 'Chờ bếp accept' ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); ReloadData(); } catch (Exception ex) { MessageBox.Show("frmTsk_ManageBookingHs.btnWaitingConfirm_ButtonClick\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//Hiennv private void btnPrepay_Click(object sender, EventArgs e) { try { BookingHsBO aBookingHsBO = new BookingHsBO(); BookingHs aBookingHs = aBookingHsBO.Select_ByID(this.IDBookingH); if (aBookingHs !=null) { aBookingHs.BookingMoney = this.aNewPaymentEN.BookingHMoney; aBookingHs.PayMenthod = 2; // tam ung aBookingHsBO.Update(aBookingHs); MessageBox.Show("Thực hiện thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } catch (Exception ex) { MessageBox.Show("frmTsk_PaymentHall.btnPrepay_Click\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void ReloadData() { try { BookingHsBO aBookingHsBO = new BookingHsBO(); List<BookingHEN> aListBookedHs = new List<BookingHEN>(); List<BookingHs> aListTemp = new List<BookingHs>(); int Status = Convert.ToInt32(lueStatus.EditValue); aListTemp = aBookingHsBO.SelectBookingHs_ByTime_ByStatus(dtpFrom.DateTime, dtpTo.DateTime, Status); BookingHEN aBookingHEN; for (int i = 0; i < aListTemp.Count; i++) { aBookingHEN = new BookingHEN(); aBookingHEN.SetValue(aListTemp[i]); aBookingHEN.StatusPayDisplay = CORE.CONSTANTS.SelectedStatusPay(Convert.ToInt16(aBookingHEN.StatusPay)).Name; aBookingHEN.CustomerTypeDisplay = CORE.CONSTANTS.SelectedCustomerType(Convert.ToInt16(aBookingHEN.CustomerType)).Name; if (aBookingHEN.Type == 1) { aBookingHEN.TypeDisplay = "Tiệc không thuộc phạm trù nhà bếp"; } else { aBookingHEN.TypeDisplay = "Tiệc thuộc phạm trù nhà bếp"; } aListBookedHs.Add(aBookingHEN); } dgvBookingHs.DataSource = aListBookedHs; dgvBookingHs.RefreshDataSource(); if (Status == 1) { gridColumn7.Visible = true; gridColumn8.Visible = false; gridColumn10.Visible = false; gridColumn11.Visible = false; gridColumn14.Visible = false; gridColumn15.Visible = false; } else if (Status == 2) { gridColumn7.Visible = false; gridColumn8.Visible = true; gridColumn10.Visible = false; gridColumn11.Visible = false; gridColumn14.Visible = false; gridColumn15.Visible = false; } else if (Status == 3) { gridColumn7.Visible = false; gridColumn8.Visible = false; gridColumn9.Visible = false; gridColumn10.Visible = false; gridColumn11.Visible = false; gridColumn12.Visible = false; gridColumn14.Visible = false; gridColumn15.Visible = false; } else if (Status == 4) { gridColumn7.Visible = false; gridColumn8.Visible = false; gridColumn9.Visible = false; gridColumn10.Visible = false; gridColumn11.Visible = false; gridColumn14.Visible = true; gridColumn15.Visible = false; } else if (Status == 5) { gridColumn7.Visible = false; gridColumn8.Visible = false; gridColumn9.Visible = false; gridColumn10.Visible = false; gridColumn11.Visible = false; gridColumn14.Visible = false; gridColumn15.Visible = true; } else if (Status == 6) { gridColumn7.Visible = false; gridColumn8.Visible = false; gridColumn9.Visible = false; gridColumn10.Visible = true; gridColumn11.Visible = false; gridColumn14.Visible = false; gridColumn15.Visible = false; } else if (Status == 7) { gridColumn7.Visible = false; gridColumn8.Visible = false; gridColumn9.Visible = false; gridColumn10.Visible = false; gridColumn11.Visible = true; gridColumn12.Visible = false; gridColumn14.Visible = false; gridColumn15.Visible = false; } else if (Status == 8) { gridColumn7.Visible = false; gridColumn8.Visible = false; gridColumn9.Visible = false; gridColumn10.Visible = false; gridColumn11.Visible = false; gridColumn12.Visible = true; gridColumn14.Visible = false; gridColumn15.Visible = false; } } catch (Exception ex) { MessageBox.Show("frmTsk_ManageBookingHs.ReloadData \n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnCancelBooking_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { BookingHsBO aBookingHsBO = new BookingHsBO(); int IDBookingH = Convert.ToInt32(grvBookingRs.GetFocusedRowCellValue("ID")); string Name = aBookingHsBO.Select_ByID(IDBookingH).Subject; DialogResult result = MessageBox.Show(" Bạn muốn xóa buổi tiệc " + Name + " này ??", "Xóa buổi tiệc ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { aBookingHsBO.Delete(IDBookingH); MessageBox.Show("Xóa thành công"); this.Reload(); } } catch (Exception ex) { MessageBox.Show("frmTsk_UnpayBookingHs.btnCancelBooking_ButtonClick\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// =============================================================================== // Khoi tao doi tuong Payment private void InitData(int IDBookingR, int IDBookingH) { CompaniesBO aCompaniesBO = new CompaniesBO(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); SystemUsersBO aSystemUsersBO = new SystemUsersBO(); BookingHsBO aBookingHsBO = new BookingHsBO(); BookingRsBO aBookingRsBO = new BookingRsBO(); BookingRoomsBO aBookingRoomBO = new BookingRoomsBO(); CustomersBO aCustomersBO = new CustomersBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); RoomsBO aRoomsBO = new RoomsBO(); HallsBO aHallsBO = new HallsBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); FoodsBO aFoodsBO = new FoodsBO(); ExtraCostBO aExtraCostBO = new ExtraCostBO(); List<int> aListIndexTemp = new List<int>(); BookingHs aBookingHs = new BookingHs(); BookingRs aBookingRs = aBookingRsBO.Select_ByID(IDBookingR); if (this.IDBookingH > 0) { aBookingHs = aBookingHsBO.Select_ByID(this.IDBookingH); } else { BookingRs_BookingHs aItem = (new BookingRs_BookingHsBO()).Select_ByIDBookingR(this.IDBookingR); if (aItem != null) { this.IDBookingH = aItem.IDBookingH.GetValueOrDefault(0); aBookingHs = aBookingHsBO.Select_ByID(this.IDBookingH); } } // Truyen du lieu chung cua NewPayment if (aBookingRs != null) { aNewPaymentEN.IDBookingR = aBookingRs.ID; aNewPaymentEN.IDCustomer = aBookingRs.IDCustomer; Customers aCustomers = aCustomersBO.Select_ByID(aBookingRs.IDCustomer); if (aCustomers != null) { aNewPaymentEN.NameCustomer = aCustomers.Name; } aNewPaymentEN.IDSystemUser = aBookingRs.IDSystemUser; SystemUsers aSystemUsers = aSystemUsersBO.Select_ByID(aBookingRs.IDSystemUser); if (aSystemUsers != null) { aNewPaymentEN.NameSystemUser = aSystemUsers.Name; } aNewPaymentEN.IDCustomerGroup = aBookingRs.IDCustomerGroup; CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingRs.IDCustomerGroup); if (aCustomerGroups != null) { aNewPaymentEN.NameCustomerGroup = aCustomerGroups.Name; aNewPaymentEN.IDCompany = aCustomerGroups.IDCompany; Companies aCompanies = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany); if (aCompanies != null) { aNewPaymentEN.NameCompany = aCompanies.Name; aNewPaymentEN.TaxNumberCodeCompany = aCompanies.TaxNumberCode; aNewPaymentEN.AddressCompany = aCompanies.Address; } } aNewPaymentEN.PayMenthodR = aBookingRs.PayMenthod; aNewPaymentEN.CreatedDate_BookingR = aBookingRs.CreatedDate; aNewPaymentEN.CustomerType = aBookingRs.CustomerType; aNewPaymentEN.Status_BookingR = aBookingRs.Status; aNewPaymentEN.StatusPay = aBookingRs.StatusPay; aNewPaymentEN.BookingRMoney = aBookingRs.BookingMoney; aNewPaymentEN.Status_BookingR = aBookingRs.Status; aNewPaymentEN.AcceptDate = aBookingRs.AcceptDate; aNewPaymentEN.InvoiceDate = aBookingRs.InvoiceDate; aNewPaymentEN.InvoiceNumber = aBookingRs.InvoiceNumber; // Truyen du lieu cho List BookingRoom cua NewPayment List<BookingRooms> aListBookingRooms = aBookingRoomBO.Select_ByIDBookingRs(this.IDBookingR); if (aListBookingRooms.Count > 0) { BookingRoomUsedEN aBookingRoomUsedEN; foreach (BookingRooms item in aListBookingRooms) { aBookingRoomUsedEN = new BookingRoomUsedEN(); aBookingRoomUsedEN.SetValue(item); aBookingRoomUsedEN.ListCustomer = aCustomersBO.SelectListCustomer_ByIDBookingRoom(item.ID); Rooms aRooms = aRoomsBO.Select_ByCodeRoom(item.CodeRoom, 1); if (aRooms != null) { aBookingRoomUsedEN.RoomSku = aRooms.Sku; } else { aBookingRoomUsedEN.RoomSku = string.Empty; } if (item.Status == 8 || item.Status == 7) { aBookingRoomUsedEN.AddTimeStart = Convert.ToDouble(aReceptionTaskBO.GetAddTimeStart(Convert.ToInt32(item.Type), item.CheckInActual)); aBookingRoomUsedEN.AddTimeEnd = Convert.ToDouble(aReceptionTaskBO.GetAddTimeEnd(Convert.ToInt32(item.Type), item.CheckOutActual)); aBookingRoomUsedEN.TimeInUse = Convert.ToDecimal(aReceptionTaskBO.GetTimeInUsed(item.CheckInActual, item.CheckOutActual) * 24 * 60); } else { aBookingRoomUsedEN.AddTimeStart = Convert.ToDouble(aReceptionTaskBO.GetAddTimeStart(Convert.ToInt32(item.Type), item.CheckInActual)); aBookingRoomUsedEN.AddTimeEnd = Convert.ToDouble(aReceptionTaskBO.GetAddTimeEnd(Convert.ToInt32(item.Type), item.CheckOutPlan)); aBookingRoomUsedEN.TimeInUse = Convert.ToDecimal(aReceptionTaskBO.GetTimeInUsed(item.CheckInActual, item.CheckOutPlan) * 24 * 60); } decimal? cost = 0; if (item.Cost == null) { cost = item.CostRef_Rooms; aBookingRoomUsedEN.Cost = cost + Convert.ToDecimal(aExtraCostBO.Select_BySku_ByPriceType_ByNumberPeople(aRooms.Sku, aBookingRoomUsedEN.PriceType, aBookingRoomUsedEN.ListCustomer.Count).ExtraValue); } else { cost = item.Cost; aBookingRoomUsedEN.Cost = cost; } List<ServiceUsedEN> aListServiceRTemp = aReceptionTaskBO.GetListServiceUsedInRoom_ByIDBookingRoom(item.ID); foreach (ServiceUsedEN aTemp in aListServiceRTemp) { aBookingRoomUsedEN.ListServiceUsed.Add(aTemp); aListIndexTemp.Add(Convert.ToInt32(aTemp.IndexSubPayment)); } aListIndexTemp.Add(Convert.ToInt32(aBookingRoomUsedEN.IndexSubPayment)); aNewPaymentEN.aListBookingRoomUsed.Add(aBookingRoomUsedEN); } } //==================================================================================================== //==================================================================================================== //==================================================================================================== // Brucelee Thanh sửa ngày 04/06/2015 // //--------------- // Lỗi sai điều kiện câu lệnh if khiến aBookingHs truyền dữ liệu CustomerType sai cho NewPaymentEN //--------------- // Ban đầu : if (aBookingHs != null) //------------------------------------- if (aBookingHs.ID > 0) { aNewPaymentEN.IDBookingH = aBookingHs.ID; aNewPaymentEN.PayMenthodH = aBookingHs.PayMenthod; aNewPaymentEN.CreatedDate_BookingH = aBookingHs.CreatedDate; aNewPaymentEN.CustomerType = aBookingHs.CustomerType; aNewPaymentEN.Status_BookingH = aBookingHs.Status; aNewPaymentEN.BookingHMoney = aBookingHs.BookingMoney; // Truyen du lieu cho List BookingHall cua NewPayment List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookigH(this.IDBookingH); if (aListBookingHalls != null) { BookingHallUsedEN aBookingHallUsedEN; foreach (BookingHalls item in aListBookingHalls) { aBookingHallUsedEN = new BookingHallUsedEN(); aBookingHallUsedEN.SetValue(item); Halls aHalls = aHallsBO.Select_ByCodeHall(item.CodeHall, 1); if (aHalls != null) { aBookingHallUsedEN.HallSku = aHalls.Sku; } else { aBookingHallUsedEN.HallSku = string.Empty; } aBookingHallUsedEN.CustomerType = aBookingHs.CustomerType; aBookingHallUsedEN.BookingTypeBookingH = aBookingHs.BookingType; aBookingHallUsedEN.StatusPayBookingH = aBookingHs.StatusPay; aBookingHallUsedEN.LevelBookingH = aBookingHs.Level; aBookingHallUsedEN.aListMenuEN = aReceptionTaskBO.GetListMenus_ByIDBookingHall(item.ID); aListIndexTemp.Add(Convert.ToInt32(aBookingHallUsedEN.IndexSubPayment)); List<ServiceUsedEN> aListServiceTemp = aReceptionTaskBO.GetListServiceUsedInHall_ByIDBookingHall(item.ID); foreach (ServiceUsedEN aTemp in aListServiceTemp) { aBookingHallUsedEN.aListServiceUsed.Add(aTemp); aListIndexTemp.Add(Convert.ToInt32(aTemp.IndexSubPayment)); } aNewPaymentEN.aListBookingHallUsed.Add(aBookingHallUsedEN); } } } aNewPaymentEN.ListIndex = aListIndexTemp.Distinct().ToList(); } }
public void LoadData() { BookingHsBO aBookingHsBO = new BookingHsBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); HallsEN aTemp; aBookingHs = aBookingHsBO.Select_ByID(IDBookingH); HallsBO aHallsBO = new HallsBO(); List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookigH(IDBookingH); //Fill data for BookingH txtSubject.Text = aBookingHs.Subject; txtBookingMoney.Text = String.Format("{0:0,0}", aBookingHs.BookingMoney); txtNote.Text = aBookingHs.Note; //Fill data for BookingHall dtpFrom.DateTime = Convert.ToDateTime(aListBookingHalls[0].Date); //tedEnd.Time = DateTime.Parse( aListBookingHalls[0].EndTime.ToString()); //tedStart.Time = DateTime.Parse(aListBookingHalls[0].StartTime.ToString()); for (int i = 0; i < aListBookingHalls.Count; i++) { aTemp = new HallsEN(); aTemp.IDBookingHall = aListBookingHalls[i].ID; aTemp.Code = aListBookingHalls[i].CodeHall; aTemp.Sku = aHallsBO.Select_ByCodeHall(aListBookingHalls[i].CodeHall, 1).Sku; aTemp.CostRef = aListBookingHalls[i].CostRef_Halls; aTemp.Type = aHallsBO.Select_ByCodeHall(aListBookingHalls[i].CodeHall, 1).Type; aTemp.TypeDisplay = CORE.CONSTANTS.SelectedHallType(Convert.ToInt32(aTemp.Type)).Name; aTemp.Cost = aListBookingHalls[i].Cost; aTemp.TableOrPerson = aListBookingHalls[i].TableOrPerson; aTemp.Unit = aListBookingHalls[i].Unit; aListSelected.Add(aTemp); } dgvSelectedHalls.DataSource = aListSelected; dgvSelectedHalls.RefreshDataSource(); }
private void btnDeleteBookingR_Click(object sender, EventArgs e) { BookingRoomsMembersBO aBookingRoomsMembersBO = new BookingRoomsMembersBO(); BookingRooms_ServicesBO aBookingRooms_ServicesBO = new BookingRooms_ServicesBO(); BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO(); BookingRsBO aBookingRsBO = new BookingRsBO(); CustomerGroups_CustomersBO aCustomerGroups_CustomersBO = new CustomerGroups_CustomersBO(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); BookingHsBO aBookingHsBO = new BookingHsBO(); BookingHalls_ServicesBO aBookingHalls_ServicesBO = new BookingHalls_ServicesBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); MenusBO aMenusBO = new MenusBO(); Menus_FoodsBO aMenus_FoodsBO = new Menus_FoodsBO(); try { MessageBox.Show("Chức năng này sẽ xóa tất cả các phòng và hóa đơn đặt phòng đã đặt!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); if (this.IDBookingH == 0) { DialogResult result = MessageBox.Show("Xóa tất cả các phòng đã đặt. Tiếp tục?", "Xóa phòng", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { foreach (BookingRoomUsedEN item in this.aNewPaymentEN.aListBookingRoomUsed) { aBookingRooms_ServicesBO.DeleteListServiceUsed(item.ID); aBookingRoomsMembersBO.DeleteListBookingRoomsMembers(item.ID); aBookingRoomsBO.Delete(item.ID); } aCustomerGroups_CustomersBO.DeleteAllCustomersFromCustomerGroup_ByIDBookingRs(this.IDBookingR); aCustomerGroupsBO.Delete_ByID(Convert.ToInt32(this.aNewPaymentEN.IDCustomerGroup)); int ret = aBookingRsBO.Delete(this.IDBookingR); if (ret > 0) { MessageBox.Show("Thực hiện thành công!", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { DialogResult result = MessageBox.Show("Xóa tất cả các phòng và hội trường đã đặt. Tiếp tục?", "Xóa hóa đơn", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { foreach (BookingRoomUsedEN item in this.aNewPaymentEN.aListBookingRoomUsed) { aBookingRooms_ServicesBO.DeleteListServiceUsed(item.ID); aBookingRoomsMembersBO.DeleteListBookingRoomsMembers(item.ID); aBookingRoomsBO.Delete(item.ID); } aCustomerGroups_CustomersBO.DeleteAllCustomersFromCustomerGroup_ByIDBookingRs(this.IDBookingR); aCustomerGroupsBO.Delete_ByID(Convert.ToInt32(this.aNewPaymentEN.IDCustomerGroup)); aBookingRsBO.Delete(this.IDBookingR); foreach (BookingHallUsedEN item1 in this.aNewPaymentEN.aListBookingHallUsed) { aBookingHalls_ServicesBO.DeleteListServiceUsed(item1.ID); aBookingHallsBO.Delete(item1.ID); foreach (MenusEN aMenu in item1.aListMenuEN) { aMenusBO.Delete(aMenu.ID); aMenus_FoodsBO.Delete_ByIDMenu(aMenu.ID); } } int ret = aBookingHsBO.Delete(this.IDBookingH); if (ret > 0) { MessageBox.Show("Thực hiện thành công!", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } this.Close(); if (this.afrmMain != null) { this.afrmMain.ReloadData(); } else if (this.afrmMain_Halls != null) { this.afrmMain_Halls.ReloadData(); } } catch (Exception ex) { MessageBox.Show("frmTsk_UpdBookingHall.btnDeleteBookingRs\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAddCompany_Click(object sender, EventArgs e) { try { BookingHsBO aBookingHsBO = new BookingHsBO(); int CusType = Convert.ToInt32( aBookingHsBO.Select_ByID(IDBookingH).CustomerType); frmIns_Companies afrmIns_Companies = new frmIns_Companies(this, CusType); afrmIns_Companies.ShowDialog(); } catch (Exception ex) { MessageBox.Show("frmTsk_UpdBooking.btnAddCompany_Click\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//hiennv public bool PaymentHall(PaymentHallsEN aPaymentHallsEN) { try { BookingHsBO aBookingHsBO = new BookingHsBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); BookingHalls_ServicesBO aBookingHalls_ServicesBO = new BookingHalls_ServicesBO(); BookingHs aBookingHs = aBookingHsBO.Select_ByID(aPaymentHallsEN.IDBookingH); aBookingHs.PayMenthod = aPaymentHallsEN.PayMenthod; aBookingHs.DatePay = DateTime.Now; aBookingHs.StatusPay = 3;//da thanh toan aBookingHs.Status = 8;//da thanh toan toan bo aBookingHs.BookingMoney = 0; aBookingHsBO.Update(aBookingHs); foreach (InfoDetailPaymentHallsEN aInfoDetailPaymentHallsEN in aPaymentHallsEN.aListInfoDetailPaymentHallsEN) { if (aInfoDetailPaymentHallsEN.aBookingHalls.IDBookingH == aPaymentHallsEN.IDBookingH) { BookingHalls aBookingHalls = aBookingHallsBO.Select_ByID(aInfoDetailPaymentHallsEN.aBookingHalls.ID); aBookingHalls.Cost = aInfoDetailPaymentHallsEN.aBookingHalls.Cost; aBookingHalls.PercentTax = aInfoDetailPaymentHallsEN.aBookingHalls.PercentTax; aBookingHalls.Status = 8;// da thanh toan aBookingHallsBO.Update(aBookingHalls); foreach (ServicesHallsEN aServicesHallsEN in aInfoDetailPaymentHallsEN.aListServicesHallsEN) { if (aServicesHallsEN.IDBookingHall == aInfoDetailPaymentHallsEN.aBookingHalls.ID) { BookingHalls_Services aBookingHalls_Services = aBookingHalls_ServicesBO.Select_ByIDService_ByIDBookingHall(aServicesHallsEN.IDService, aInfoDetailPaymentHallsEN.aBookingHalls.ID); aBookingHalls_Services.Cost = aServicesHallsEN.Cost; aBookingHalls_Services.Quantity = aServicesHallsEN.Quantity; aBookingHalls_Services.PercentTax = aServicesHallsEN.PercentTax; aBookingHalls_Services.Status = 8;//da thanh toan aBookingHalls_ServicesBO.Update(aBookingHalls_Services); } } } } return true; } catch (Exception ex) { return false; throw new Exception(string.Format("ReceptionTaskBO.PaymentHall\n" + ex.Message)); } }