private void LoadDataCurrentHallForControl() { //--------- Hội trường ---------------- if (this.IDBookingH > 0) { //Thong tin nguoi dat lblNameCompany_BookingH.Text = this.aNewPaymentEN.NameCompany; lblNameCustomerGroup_BookingH.Text = this.aNewPaymentEN.NameCustomerGroup; lblNameCustomer_BookingH.Text = this.aNewPaymentEN.NameCustomer; txtAddressH.Text = this.aNewPaymentEN.AddressCompany; txtTaxNumberCodeH.Text = this.aNewPaymentEN.TaxNumberCodeCompany; // Trang thai, hinh thuc thanh toan lblTotalMoneyHalls.Text = String.Format("{0:0,0}", this.aNewPaymentEN.GetMoneyHalls()); txtBookingHMoney.EditValue = this.aNewPaymentEN.BookingHMoney; lblTotalMoneyH.Text = String.Format("{0:0,0}", this.aNewPaymentEN.GetMoneyHalls() - this.aNewPaymentEN.BookingHMoney); // Thong tin gia tiền, đặt trước lueBookingH_PayMethod.Properties.DataSource = CORE.CONSTANTS.ListPayMethods; lueBookingH_PayMethod.Properties.DisplayMember = "Name"; lueBookingH_PayMethod.Properties.ValueMember = "ID"; lueBookingH_PayMethod.EditValue = CORE.CONSTANTS.SelectedPayMethod(Convert.ToInt32(this.aNewPaymentEN.PayMenthodH)).ID; // Danh sách các hội trường dgvHalls.DataSource = this.aNewPaymentEN.aListBookingHallUsed; dgvHalls.RefreshDataSource(); // Thông tin 1 hội trường if (this.aNewPaymentEN.aListBookingHallUsed.Where(a => a.ID == this.CurrentIDBookingHall).ToList().Count > 0) { BookingHallUsedEN aBookingHallUsedEN = this.aNewPaymentEN.aListBookingHallUsed.Where(a => a.ID == this.CurrentIDBookingHall).ToList()[0]; lblSkuHalls.Text = Convert.ToString(aBookingHallUsedEN.HallSku); decimal? cost = 0; if (aBookingHallUsedEN.Cost == null || aBookingHallUsedEN.Cost == 0) { cost = aBookingHallUsedEN.CostRef_Halls; } else { cost = aBookingHallUsedEN.Cost; } lblDate.Text = String.Format("{0:dd/MM/yyyy}", aBookingHallUsedEN.Date); lblLunarDate.Text = String.Format("{0:dd/MM/yyyy}", aBookingHallUsedEN.LunarDate); lblStartTime.Text = String.Format(@"{0:hh\:mm}", aBookingHallUsedEN.StartTime); lblEndTime.Text = String.Format(@"{0:hh\:mm}", aBookingHallUsedEN.EndTime); lueMenus.Properties.DataSource = aBookingHallUsedEN.aListMenuEN; lueMenus.Properties.DisplayMember = "Name"; lueMenus.Properties.ValueMember = "ID"; if (aBookingHallUsedEN.aListMenuEN.Count > 0) { lueMenus.EditValue = aBookingHallUsedEN.aListMenuEN[0].ID; MenusEN aMenusEN = aBookingHallUsedEN.aListMenuEN[0]; List<Foods> aListFoods = new List<Foods>(); FoodsBO aFoodsBO = new FoodsBO(); foreach (Foods item in aMenusEN.aListFoods) { Foods aFoods = aFoodsBO.Select_ByID(item.ID); if (aFoods.Image1 != null) { if (aFoods.Image1.Length <= 0) { Image image = RoomManager.Properties.Resources.logo_nkcp_small; image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero); Byte[] aImageByte = this.ConvertImageToByteArray(image); aFoods.Image1 = aImageByte; } } else { Image image = RoomManager.Properties.Resources.logo_nkcp_small; image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero); Byte[] aImageByte = this.ConvertImageToByteArray(image); aFoods.Image1 = aImageByte; } aListFoods.Add(aFoods); } dgvFoods.DataSource = aListFoods; dgvFoods.RefreshDataSource(); } else { List<Foods> aListFoods = new List<Foods>(); dgvFoods.DataSource = aListFoods; dgvFoods.RefreshDataSource(); } txtPercentTax_Hall.EditValue = aBookingHallUsedEN.PercentTax; lblMoneyHall.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetMoneyAHall(aBookingHallUsedEN.ID)); decimal? BookingHallsCost = aBookingHallUsedEN.Cost == null ? aBookingHallUsedEN.CostRef_Halls : aBookingHallUsedEN.Cost; txtBookingHallsCost.EditValue = BookingHallsCost; dgvServicesH.DataSource = this.aNewPaymentEN.GetListServiceUsedInHall(aBookingHallUsedEN.ID); dgvServicesH.RefreshDataSource(); //-----------Ngoc bổ sung -------------- CustomersBO aCustomersBO = new CustomersBO(); lueUserInBookingH.DataSource = aCustomersBO.SelectListCustomer_ByIDBookingH(this.CurrentIDBookingHall); //-----------Ngoc bổ sung -------------- lblTotalMoneyServiceH.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetMoneyListServiceUsedInAHall(aBookingHallUsedEN.ID)); } } else { btnBookHall.Visible = true; btnPaymentHall.Enabled = false; btnPrintBookingH.Enabled = false; txtTaxNumberCodeH.Enabled = false; txtAddressH.Enabled = false; } // Thông tin tổng tiền lblTotalBookingRAndBookingHBeforeTax.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetTotalMoneyBeforeTax()); lblTotalBookingRAndBookingHAfterTax.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetTotalMoney()); if (this.aNewPaymentEN.BookingHMoney != null) { lblBookingMoney_BookingRAndBookingH.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.BookingHMoney + this.aNewPaymentEN.BookingRMoney); lblTotalBookingRAndBookingH.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetTotalMoney() - (this.aNewPaymentEN.BookingHMoney + this.aNewPaymentEN.BookingRMoney)); } else { lblBookingMoney_BookingRAndBookingH.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.BookingRMoney); lblTotalBookingRAndBookingH.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetTotalMoney() - this.aNewPaymentEN.BookingRMoney); } }
public void LoadServiceInBookingHall(int IDBookingHall) { try { ServicesBO aServicesBO = new ServicesBO(); BookingHalls_ServicesBO aBookingHalls_ServicesBO = new BookingHalls_ServicesBO(); List<BookingHalls_Services> aListTemp = aBookingHalls_ServicesBO.Select_ByIDBookingHall(IDBookingHall); BookingHall_ServiceEN aBookingHall_ServiceEN; for (int i = 0; i < aListTemp.Count; i++) { aBookingHall_ServiceEN = new BookingHall_ServiceEN(); aBookingHall_ServiceEN.ID = aListTemp[i].ID; aBookingHall_ServiceEN.Info = aListTemp[i].Info; aBookingHall_ServiceEN.Type = aListTemp[i].Type; aBookingHall_ServiceEN.Status = aListTemp[i].Status; aBookingHall_ServiceEN.Disable = aListTemp[i].Disable; aBookingHall_ServiceEN.IDBookingHall = aListTemp[i].IDBookingHall; aBookingHall_ServiceEN.IDService = aListTemp[i].IDService; aBookingHall_ServiceEN.Service_Name = aServicesBO.Select_ByID(aListTemp[i].IDService).Name; aBookingHall_ServiceEN.Service_Unit = aServicesBO.Select_ByID(aListTemp[i].IDService).Unit; aBookingHall_ServiceEN.Cost = aListTemp[i].Cost == null ? aListTemp[i].CostRef_Services : aListTemp[i].Cost; aBookingHall_ServiceEN.CostRef_Services = aListTemp[i].CostRef_Services; aBookingHall_ServiceEN.Date = aListTemp[i].Date; aBookingHall_ServiceEN.PercentTax = aListTemp[i].PercentTax; aBookingHall_ServiceEN.Quantity = aListTemp[i].Quantity; aBookingHall_ServiceEN.Tag = aListTemp[i].Tag; aListSelected.Add(aBookingHall_ServiceEN); } dgvServiceInHall.DataSource = aListSelected; dgvServiceInHall.RefreshDataSource(); CustomersBO aCustomersBO = new CustomersBO(); BookingRs_BookingHsBO aBookingRs_BookingHsBO = new BookingRs_BookingHsBO(); List<Customers> aListCustomerRoom = new List<Customers>(); List<Customers> aListCustomerHall = aCustomersBO.SelectListCustomer_ByIDBookingH(this.IDBookingHall); if (this.aNewPayment != null) { if (this.aNewPayment.IDBookingR > 0) { aListCustomerRoom = aCustomersBO.SelectListCustomer_ByIDBookingR(this.aNewPayment.IDBookingR.GetValueOrDefault(0)); } } aListCustomerHall.AddRange(aListCustomerRoom); lueUserInHall.DataSource = aListCustomerHall; } catch (Exception ex) { MessageBox.Show("frmIns_BookingHalls_Services.grvHalls_RowClick\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }