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_SplitPayment_BookingHs(PaymentHallsEN aPaymentHallsEN, int indexSub)
        {
            InitializeComponent();
            this.aPaymentHallsEN = aPaymentHallsEN;
            this.indexSub = indexSub;
            try
            {
                ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO();
                HallsBO aHallsBO = new HallsBO();
                ServicesBO aServicesBO = new ServicesBO();
                List<HallsEN> aListHallsEN = new List<HallsEN>();
                aListHallsEN=this.aPaymentHallsEN.GetListHallsEN().Where(r => r.IndexSubHalls == this.indexSub).OrderBy(r => r.Sku).ToList();
                totalMoneyHall = aListHallsEN.Sum(s => s.TotalCost);

                List<ServicesHallsEN> aListServicesHallsEN = new List<ServicesHallsEN>();
                aListServicesHallsEN=this.aPaymentHallsEN.GetListServicesHallsEN().Where(r => r.IndexSubServices == this.indexSub).OrderBy(r => r.SkuHall).ToList();
                totalMoneyService = aListServicesHallsEN.Sum(s => s.Total);

                lblCompany.Text = this.aPaymentHallsEN.NameCompany;
                lblGroup.Text =this.aPaymentHallsEN.NameCustomerGroup;
                lblNameCustomer.Text =this.aPaymentHallsEN.NameCustomer;
                lblIDBookingH.Text = Convert.ToString(this.aPaymentHallsEN.IDBookingH);

                //danh sach hoi truong
                this.DetailReportHall.DataSource = aListHallsEN;
                colSkuHall.DataBindings.Add("Text", this.DetailReportHall.DataSource, "Sku");
                colCreateDate.DataBindings.Add("Text", this.DetailReportHall.DataSource, "Date", "{0:dd/MM/yyyy}");
                colBookingHallCost.DataBindings.Add("Text", this.DetailReportHall.DataSource, "Cost", "{0:0,0}");
                colPercentTax.DataBindings.Add("Text", this.DetailReportHall.DataSource, "PercentTax");
                colPaymentMoneyHall.DataBindings.Add("Text", this.DetailReportHall.DataSource, "TotalMoney", "{0:0,0}");

                //danh sach dich vu su dung
                this.DetailReportService.DataSource = aListServicesHallsEN;
                colService_Sku.DataBindings.Add("Text", this.DetailReportService.DataSource, "SkuHall");
                colService_Name.DataBindings.Add("Text", this.DetailReportService.DataSource, "NameService");
                colService_Date.DataBindings.Add("Text", this.DetailReportService.DataSource, "Date", "{0:dd/MM/yyyy}");
                colService_Quantity.DataBindings.Add("Text", this.DetailReportService.DataSource, "Quantity", "{0:0,0}");
                colService_Cost.DataBindings.Add("Text", this.DetailReportService.DataSource, "Cost", "{0:0,0}");
                colService_PercentTax.DataBindings.Add("Text", this.DetailReportService.DataSource, "PercentTax");
                colService_Money.DataBindings.Add("Text", this.DetailReportService.DataSource, "Total", "{0:0,0}");

                //tong tien dich vu
                lblTotalMoneyServices.Text = String.Format("{0:0,0} (VND)",this.totalMoneyService);
                //tong tien hoi truong
                lblTotalMoneyHall.Text = String.Format("{0:0,0} (VND)",this.totalMoneyHall);

                //tong tien
                lblTotalMoney.Text = String.Format("{0:0,0}",aPaymentHallsEN.GetTotalMoneyBookingHBehindTax());
                lblBookingMoney.Text = String.Format("{0:0,0}",this.aPaymentHallsEN.GetBookingMoney());
                lblMoney.Text = String.Format("{0:0,0}", (aPaymentHallsEN.GetTotalMoneyBookingHBehindTax() - this.aPaymentHallsEN.GetBookingMoney()));

            }
            catch (Exception ex)
            {
                MessageBox.Show("frmRpt_PaymentBookingHs.frmRpt_PaymentBookingHs\n" + ex.ToString());
            }
        }
        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");
        }
 private void btnDelete_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     HallsBO aHallsBO = new HallsBO();
     int IDHall = Convert.ToInt32(grvHall.GetFocusedRowCellValue("ID"));
     string Name = grvHall.GetFocusedRowCellValue("Sku").ToString();
     DialogResult result = MessageBox.Show("Bạn có muốn xóa hội trường " + Name + " này không?", "Xóa hội trường", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
     if (result == DialogResult.Yes)
     {
         aHallsBO.Delete(IDHall);
         MessageBox.Show("Xóa thành công");
         this.ReloadData();
     }
 }
        public void ReloadData()
        {
            try
            {
                HallsBO aHallsBO = new HallsBO();
                List<Halls> aListHalls = aHallsBO.Select_All();
                List<HallsEN> aListHallEN = new List<HallsEN> ();
                HallsEN aHallEN;
                 for (int i = 0; i < aListHalls.Count; i++)
                    {
                        aHallEN = new HallsEN();
                        aHallEN.SetValue(aListHalls[i]);
                        aHallEN.TypeDisplay = CORE.CONSTANTS.SelectedHallType(Convert.ToInt32(aListHalls[i].Type)).Name;
                        aListHallEN.Add(aHallEN);
                    }

                 dgvHalls.DataSource = aListHallEN;
                dgvHalls.RefreshDataSource();
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmLst_Halls.ReloadData\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        // 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
        private void btnEditBookingHall_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            try
            {
                lblSku.Visible = true;
                lblDate.Visible = true;
                lblLunarDate.Visible = true;
                lblStartTime.Visible = true;
                lblEndTime.Visible = true;
                txtBookingHallsCost.Visible = true;
                txtPercentTax_Hall.Visible = true;
                lblMoneyHall.Visible = true;
                lblNameMenu.Visible = true;

                IDBookingHall = Convert.ToInt32(viewHalls.GetFocusedRowCellValue("IDBookingHall"));
                BookingHalls aBookingHalls = aPaymentHallsEN.GetDetailBookingHall_ByID(IDBookingHall);
                HallsBO aHallsBO = new HallsBO();
                Halls aHalls = aHallsBO.Select_ByCodeHall(aBookingHalls.CodeHall, 1);
                lblSku.Text = aHalls.Sku;
                decimal? cost = 0;
                if (aBookingHalls.Cost == null || aBookingHalls.Cost == 0)
                {
                    cost = aBookingHalls.CostRef_Halls;
                }
                else
                {
                    cost = aBookingHalls.Cost;
                }

                lblDate.Text = String.Format("{0:dd/MM/yyyy}", aBookingHalls.Date);
                lblLunarDate.Text = String.Format("{0:dd/MM/yyyy}", aBookingHalls.LunarDate);
                lblStartTime.Text = String.Format(@"{0:hh\:mm}", aBookingHalls.StartTime);
                lblEndTime.Text = String.Format(@"{0:hh\:mm}", aBookingHalls.EndTime);

                MenusEN aMenusEN = aPaymentHallsEN.GetDetailMenus(IDBookingHall);
                lblNameMenu.Text = aMenusEN.Name;

                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 = SaleManagement.Properties.Resources.logo_nkcp_small;
                            image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero);
                            Byte[] aImageByte = this.ConvertImageToByteArray(image);
                            aFoods.Image1 = aImageByte;
                        }
                    }
                    else
                    {
                        Image image = SaleManagement.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();

                txtPercentTax_Hall.EditValue =aBookingHalls.PercentTax;

                lblMoneyHall.Text = String.Format("{0:0,0} (VND)", aPaymentHallsEN.GetMoneyHall(IDBookingHall));

                decimal? BookingHallsCost = aBookingHalls.Cost == null ? aBookingHalls.CostRef_Halls : aBookingHalls.Cost;

                txtBookingHallsCost.EditValue =BookingHallsCost;

                this.LoadDataService(this.IDBookingHall);

                lblTotalMoneyService.Text = String.Format("{0:0,0} (VND)", aPaymentHallsEN.GetTotalMoneyServiceHallBehindTax_ByIDBookingHall(IDBookingHall));

            }
            catch (Exception ex)
            {
                MessageBox.Show("frmTsk_PaymentHall.btnEditBookingHall_ButtonClick\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 //hiennv
 public void LoadListHall()
 {
     try
     {
         List<HallsEN> aListHallsEN = new List<HallsEN>();
         HallsEN aHallsEN;
         for (int i = 0; i < aPaymentHallsEN.aListInfoDetailPaymentHallsEN.Count; i++)
         {
             aHallsEN = new HallsEN();
             HallsBO aHallsBO = new HallsBO();
             Halls aHalls = aHallsBO.Select_ByCodeHall(aPaymentHallsEN.aListInfoDetailPaymentHallsEN[i].aBookingHalls.CodeHall, 1);
             aHallsEN.Sku = aHalls.Sku;
             aHallsEN.CodeHall = aPaymentHallsEN.aListInfoDetailPaymentHallsEN[i].aBookingHalls.CodeHall;
             aHallsEN.IDBookingH = aPaymentHallsEN.IDBookingH;
             aHallsEN.IDBookingHall = aPaymentHallsEN.aListInfoDetailPaymentHallsEN[i].aBookingHalls.ID;
             aHallsEN.TotalMoney = aPaymentHallsEN.GetMoneyHallAndService(aPaymentHallsEN.aListInfoDetailPaymentHallsEN[i].aBookingHalls.ID);
             aListHallsEN.Add(aHallsEN);
         }
         dgvHalls.DataSource = aListHallsEN;
     }
     catch (Exception ex)
     {
         MessageBox.Show("frmTsk_PaymentHall.LoadListHall\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());
            }
        }
        public List<BookingHalls> Select_ByRankTime(DateTime From, DateTime To, bool IsLunarDate)
        {
            try
            {
                HallsBO aHallBO = new HallsBO();

                List<BookingHalls> aList = new List<BookingHalls>();
                if (IsLunarDate == false)
                {

                    return aDatabaseDA.BookingHalls.Where(p => p.Date <= To).Where(p => p.Date >= From).ToList();
                }
                else
                {
                    return aDatabaseDA.BookingHalls.Where(p => p.LunarDate <= To).Where(p => p.LunarDate >= From).ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("BookingHallsBO.Select_ByRankTime:" + ex.ToString());
            }
        }
        public HallExtStatusEN GetStatusHall(int IDHall, DateTime CheckPoint, bool IsLunarDate)
        {
            List<sp_HallExt_GetCurrentStatusHalls_ByIDHall_ByTime_Result> aList = this.aDatabaseDA.sp_HallExt_GetCurrentStatusHalls_ByIDHall_ByTime(IDHall, CheckPoint, IsLunarDate).ToList();

            HallExtStatusEN aHallExtStatusEN = new HallExtStatusEN();

            if (aList.Count > 0)
            {
                for (int i = 0; i < aList.Count; i++)
                {
                    aHallExtStatusEN = new HallExtStatusEN();
                    aHallExtStatusEN.ID = aList[i].ID;

                    aHallExtStatusEN.CostRef = aList[i].CostRef;
                    aHallExtStatusEN.Code = aList[i].Code;
                    aHallExtStatusEN.Sku = aList[i].Sku;
                    aHallExtStatusEN.Note = aList[i].Note;
                    aHallExtStatusEN.Type = aList[i].Type;
                    aHallExtStatusEN.BookingHalls_ID = aList[i].BookingHalls_ID;

                    aHallExtStatusEN.BookingHs_BookingMoney = aList[i].BookingHs_BookingMoney;
                    aHallExtStatusEN.BookingHs_CustomerType = aList[i].BookingHs_CustomerType;
                    aHallExtStatusEN.BookingHs_ID = aList[i].BookingHs_ID;
                    aHallExtStatusEN.BookingHs_Subject = aList[i].BookingHs_Subject;

                    aHallExtStatusEN.Date = aList[i].Date;
                    aHallExtStatusEN.LunarDate = aList[i].LunarDate;
                    aHallExtStatusEN.StartTime = aList[i].StartTime;
                    aHallExtStatusEN.EndTime = aList[i].EndTime;
                    aHallExtStatusEN.Color = aList[i].Color;
                    aHallExtStatusEN.Companies_Name = aList[i].Companies_Name;
                    aHallExtStatusEN.CostRef = aList[i].CostRef;
                    aHallExtStatusEN.CustomerGroups_Name = aList[i].CustomerGroups_Name;
                    aHallExtStatusEN.Customers_Address = aList[i].Customers_Address;
                    aHallExtStatusEN.Customers_Name = aList[i].Customers_Name;
                    aHallExtStatusEN.Customers_Nationality = aList[i].Customers_Nationality;
                    aHallExtStatusEN.Customers_Tel = aList[i].Customers_Tel;
                    //aHallExtStatusEN.Code = aList[i].Code;

                    aHallExtStatusEN.Location = aList[i].Location;
                    aHallExtStatusEN.NumTableMax = aList[i].NumTableMax;
                    aHallExtStatusEN.NumTableStandard = aList[i].NumTableStandard;
                    aHallExtStatusEN.Unit = aList[i].Unit;
                    aHallExtStatusEN.TableOrPerson = aList[i].TableOrPerson;

                    if (aList[i].BookingHalls_Status == 1)
                    {
                        aHallExtStatusEN.HallStatus = 1;
                    }
                    else if (aList[i].BookingHalls_Status == 2)
                    {
                        aHallExtStatusEN.HallStatus = 2;
                    }
                    else if (aList[i].BookingHalls_Status == 3)
                    {
                        aHallExtStatusEN.HallStatus = 3;
                    }
                    else if (aList[i].BookingHalls_Status == 4)
                    {
                        aHallExtStatusEN.HallStatus = 4;
                    }

                    else if (aList[i].BookingHalls_Status == 5)
                    {
                        aHallExtStatusEN.HallStatus = 5;
                    }
                    else if (aList[i].BookingHalls_Status == 6)
                    {
                        aHallExtStatusEN.HallStatus = 6;
                    }
                    else if ( (aList[i].BookingHalls_Status == 7) || (aList[i].BookingHalls_Status == 8))
                    {
                        aHallExtStatusEN.HallStatus = 0;
                    }

                }
                return aHallExtStatusEN;
            }
            else
            {
                HallsBO aHallsBO = new HallsBO();
                Halls aHalls = aHallsBO.Select_ByID(IDHall);
                if (aHalls != null)
                {
                    aHallExtStatusEN = new HallExtStatusEN();
                    aHallExtStatusEN.HallStatus = 0;
                    aHallExtStatusEN.Code = aHalls.Code;
                    aHallExtStatusEN.Sku = aHalls.Sku;

                    aHallExtStatusEN.Type = aHalls.Type;

                    aHallExtStatusEN.CostRef = aHalls.CostRef;
                    aHallExtStatusEN.Code = aHalls.Code;
                    aHallExtStatusEN.Sku = aHalls.Sku;

                    aHallExtStatusEN.Type = aHalls.Type;

                    aHallExtStatusEN.CostRef = aHalls.CostRef;
                    aHallExtStatusEN.NumTableMax = aHalls.NumTableMax;
                    aHallExtStatusEN.NumTableStandard = aHalls.NumTableStandard;

                }
                else
                {
                    throw new Exception("Hội trường cần check trạng thái không tồn tại");

                }
                return aHallExtStatusEN;

            }
        }
 public List<HallExtStatusEN> GetListStatusHall(DateTime CheckPoint, bool IsLunarDate)
 {
     HallsBO aHallsBO = new HallsBO();
     List<Halls> aList = aHallsBO.Select_All().Where(p => p.IDLang == 1).ToList();
     List<HallExtStatusEN> ret = new List<HallExtStatusEN>();
     for (int i = 0; i < aList.Count; i++)
     {
         try
         {
             ret.Add(this.GetStatusHall(aList[i].ID, CheckPoint, IsLunarDate));
         }
         catch (Exception e)
         {
             throw new Exception("Có lỗi khi lấy trạng thái hội trường " + aList[i].ID.ToString() + "-" + aList[i].Sku + "|" + e.Message.ToString());
         }
     }
     return ret;
 }
        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();
        }
        // ===============================================================================
        // 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();
            }
        }
 private void grvBookingRs_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
 {
     try
     {
         BookingHallsBO aBookingHallsBO = new BookingHallsBO();
         List<BookingHall_ServiceEN> aListBookingHall_ServiceEN = new List<BookingHall_ServiceEN>();
         HallsBO aHallsBO = new HallsBO();
         int IDBookingH = Convert.ToInt32(grvBookingRs.GetFocusedRowCellValue("ID"));
         List<BookingHallsEN> aListBookingHalls = new List<BookingHallsEN>();
         List<BookingHalls> aListTemp = new List<BookingHalls>();
         aListTemp = aBookingHallsBO.Select_ByIDBookigH(IDBookingH);
         BookingHallsEN aBookingHallsEN;
         for (int i = 0; i < aListTemp.Count; i++)
         {
             aBookingHallsEN = new BookingHallsEN();
             aBookingHallsEN.SkuHall = aHallsBO.Select_ByCodeHall(aListTemp[i].CodeHall, 1).Sku;
             aBookingHallsEN.ID = aListTemp[i].ID;
             aBookingHallsEN.Cost = aListTemp[i].Cost;
             aBookingHallsEN.StartTime = aListTemp[i].StartTime;
             aBookingHallsEN.EndTime = aListTemp[i].EndTime;
             aListBookingHalls.Add(aBookingHallsEN);
         }
         dgvListBookingHalls.DataSource = aListBookingHalls;
         dgvListBookingHalls.RefreshDataSource();
         dgvServiceInBookingHall.DataSource = aListBookingHall_ServiceEN;
         dgvServiceInBookingHall.RefreshDataSource();
     }
     catch (Exception ex)
     {
         MessageBox.Show("frmTsk_UnpayBookingHs.grvBookingRs_RowClick\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void grvBookingRs_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
 {
     BookingHallsBO aBookingHallsBO = new BookingHallsBO();
     List<BookingHall_ServiceEN> aListBookingHall_ServiceEN = new List<BookingHall_ServiceEN>();
     HallsBO aHallsBO = new HallsBO();
     int IDBookingH = Convert.ToInt32(grvBookingRs.GetFocusedRowCellValue("ID"));
     List<BookingHallsEN> aListBookingHalls = new List<BookingHallsEN>();
     List<BookingHalls> aListTemp = new List<BookingHalls>();
     aListTemp = aBookingHallsBO.Select_ByIDBookigH(IDBookingH);
     BookingHallsEN aBookingHallsEN;
     for (int i = 0; i < aListTemp.Count; i++)
     {
         aBookingHallsEN = new BookingHallsEN();
         aBookingHallsEN.SkuHall = aHallsBO.Select_ByCodeHall(aListTemp[i].CodeHall, 1).Sku;
         aBookingHallsEN.ID = aListTemp[i].ID;
         aBookingHallsEN.Cost = aListTemp[i].Cost;
         aBookingHallsEN.StartTime = aListTemp[i].StartTime;
         aBookingHallsEN.EndTime = aListTemp[i].EndTime;
         aListBookingHalls.Add(aBookingHallsEN);
     }
     dgvListBookingHalls.DataSource = aListBookingHalls;
     dgvListBookingHalls.RefreshDataSource();
     dgvServiceInBookingHall.DataSource = aListBookingHall_ServiceEN;
     dgvServiceInBookingHall.RefreshDataSource();
 }
        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();
        }
 public HallExtStatusEN GetStatusHall(string CodeHall, DateTime CheckPoint, bool IsLunarDate)
 {
     HallsBO aHallsBO = new HallsBO();
     HallExtStatusEN aHallExtStatusEN = new HallExtStatusEN();
     Halls aHalls = aHallsBO.Select_ByCodeHall(CodeHall, 1);
     if (aHalls != null)
     {
         aHallExtStatusEN = this.GetStatusHall(aHalls.ID, CheckPoint, IsLunarDate);
         return aHallExtStatusEN;
     }
     else
     {
         return null;
     }
 }