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");
        }
        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");
        }
        //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);
            }
        }
        public void Reload()
        {
            try
            {
                BookingHallsBO aBookingHallsBO = new BookingHallsBO();
                List<BookingHallsEN> aListBookingHall = new List<BookingHallsEN>();
                BookingHallsEN aBookingHallsEN = new BookingHallsEN();
                BookingHalls aBookingHalls = aBookingHallsBO.Select_ByID(IDBookingHall);
                aBookingHallsEN.ID = aBookingHalls.ID;
                aBookingHallsEN.HallSku = aHallsBO.Select_ByCodeHall(aBookingHalls.CodeHall, 1).Sku;
                aListBookingHall.Add(aBookingHallsEN);

                dtpDate.DateTime = aBookingHalls.Date.GetValueOrDefault();
                dgvHalls.DataSource = aListBookingHall;
                dgvHalls.RefreshDataSource();

                ServicesBO aServicesBO = new ServicesBO();
                aListAvailable = aServicesBO.Select_ByType(1);
                dgvService.DataSource = aListAvailable;
                dgvService.RefreshDataSource();

            }
            catch (Exception ex)
            {
                MessageBox.Show("frmIns_BookingHalls_Services.Reload\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));
            }
        }