//Hiennv
        public List<BookingRStatusPayViewEN> GetListUnPayBookingR_ByIDBookingR(int IDBookingR)
        {
            List<vw__PaymentInfo__BookingRs_BookingRooms_Customers> aListTemp = new List<vw__PaymentInfo__BookingRs_BookingRooms_Customers>();
            int?[] BookingRoomStatus = new int?[] { 3, 5, 7 };

            aListTemp = aDatabaseDA.vw__PaymentInfo__BookingRs_BookingRooms_Customers.Where(c => c.BookingRs_ID == IDBookingR).Where(e => BookingRoomStatus.Contains(e.BookingRooms_Status)).ToList();

            List<BookingRStatusPayViewEN> aListReturn = new List<BookingRStatusPayViewEN>();
            BookingRStatusPayViewEN aBookingRStatusPayViewEN;
            CompaniesBO aCompaniesBO = new CompaniesBO();
            for (int i = 0; i < aListTemp.Count; i++)
            {
                aBookingRStatusPayViewEN = new BookingRStatusPayViewEN();

                aBookingRStatusPayViewEN.IDBookingR = aListTemp[i].BookingRs_ID;
                aBookingRStatusPayViewEN.CreatedDate = aListTemp[i].BookingRs_CreatedDate;
                aBookingRStatusPayViewEN.Customer_Name = aListTemp[i].Customers_Name;
                aBookingRStatusPayViewEN.Subject = aListTemp[i].BookingRs_Subject;
                aBookingRStatusPayViewEN.IDCustomer = aListTemp[i].Customers_ID;
                aBookingRStatusPayViewEN.IDCustomerGroup = aListTemp[i].CustomerGroups_ID;
                aBookingRStatusPayViewEN.BookingRs_Status = aListTemp[i].BookingRs_Status;

                int IDCompany = !String.IsNullOrEmpty(aListTemp[i].CustomerGroups_IDCompany.ToString()) ? Convert.ToInt32(aListTemp[i].CustomerGroups_IDCompany) : 0;

                Companies aCompanies = aCompaniesBO.Select_ByID(IDCompany);
                aBookingRStatusPayViewEN.NameCompany = aCompanies.Name;
                aBookingRStatusPayViewEN.CustomerGroups_Name = aListTemp[i].CustomerGroups_Name;
                aBookingRStatusPayViewEN.StatusPay = aListTemp[i].BookingRs_StatusPay;
                aBookingRStatusPayViewEN.BookingMoney = aListTemp[i].BookingRs_BookingMonye;
                aBookingRStatusPayViewEN.IDBookingRoom = aListTemp[i].BookingRooms_ID;
                aBookingRStatusPayViewEN.Sku = aListTemp[i].Rooms_Sku;
                aBookingRStatusPayViewEN.BookingStatus = aListTemp[i].BookingRooms_Status;
                aBookingRStatusPayViewEN.BookingRooms_CodeRoom = aListTemp[i].BookingRooms_CodeRoom;

                switch (aBookingRStatusPayViewEN.StatusPay)
                {
                    case 1:
                        aBookingRStatusPayViewEN.BookingRStatusPayDisplay = "Chưa thanh toán";
                        break;
                    case 2:
                        aBookingRStatusPayViewEN.BookingRStatusPayDisplay = "Tạm ứng";
                        break;
                    case 3:
                        aBookingRStatusPayViewEN.BookingRStatusPayDisplay = "Đã thanh toán";
                        break;
                    default:
                        aBookingRStatusPayViewEN.BookingRStatusPayDisplay = "Chưa xác định";
                        break;
                }
                switch (aBookingRStatusPayViewEN.BookingStatus)
                {
                    case 3:
                        aBookingRStatusPayViewEN.BookingRoomStatusPayDisplay = "Đã check in";
                        break;
                    case 5:
                        aBookingRStatusPayViewEN.BookingRoomStatusPayDisplay = "Pending";
                        break;
                    case 7:
                        aBookingRStatusPayViewEN.BookingRoomStatusPayDisplay = "Đã check out nhưng chưa thanh toán";
                        break;
                    case 8:
                        aBookingRStatusPayViewEN.BookingRoomStatusPayDisplay = "Đã thanh toán";
                        break;
                    default:
                        aBookingRStatusPayViewEN.BookingRoomStatusPayDisplay = "Chưa xác định";
                        break;
                }
                aListReturn.Add(aBookingRStatusPayViewEN);

            }
            return aListReturn;
        }
        //Ngoc da sua lai ten ham 26/12/2014
        public List<BookingRStatusPayViewEN> GetListBookingRByStatus(DateTime? From, DateTime? To, int? CustomerType, string StatusPay)
        {
            List<sp_BookingRsExt_GetInfo_ByTime_ByCustomerType_ByStatusPay_Result> aListTemp = new List<sp_BookingRsExt_GetInfo_ByTime_ByCustomerType_ByStatusPay_Result>();
            aListTemp = aDatabaseDA.sp_BookingRsExt_GetInfo_ByTime_ByCustomerType_ByStatusPay(From, To, CustomerType, StatusPay).ToList();

            List<BookingRStatusPayViewEN> aListReturn = new List<BookingRStatusPayViewEN>();
            BookingRStatusPayViewEN aBookingRStatusPayViewEN;
            CompaniesBO aCompaniesBO = new CompaniesBO();
            List<Companies> aListCompaniesTemp = aCompaniesBO.Select_All();

            BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO();
            List<BookingRooms> aListBookingRoomTemp = aBookingRoomsBO.Select_All();

            for (int i = 0; i < aListTemp.Count; i++)
            {
                aBookingRStatusPayViewEN = new BookingRStatusPayViewEN();
                aBookingRStatusPayViewEN.IDBookingR = aListTemp[i].BookingRs_ID;
                aBookingRStatusPayViewEN.CreatedDate = aListTemp[i].BookingRs_CreatedDate;
                aBookingRStatusPayViewEN.Customer_Name = aListTemp[i].Customers_Name;
                aBookingRStatusPayViewEN.Subject = aListTemp[i].BookingRs_Subject;
                aBookingRStatusPayViewEN.IDCustomer = aListTemp[i].Customers_ID;
                aBookingRStatusPayViewEN.IDCustomerGroup = aListTemp[i].CustomerGroups_ID;
                aBookingRStatusPayViewEN.BookingRs_Status = aListTemp[i].BookingRs_Status;
                aBookingRStatusPayViewEN.CustomerGroups_Name = aListTemp[i].CustomerGroups_Name;
                int IDCompany = !String.IsNullOrEmpty(aListTemp[i].Companies_ID.ToString()) ? Convert.ToInt32(aListTemp[i].Companies_ID) : 0;
                if (aListCompaniesTemp.Where(c => c.ID == IDCompany).ToList().Count > 0)
                {
                    aBookingRStatusPayViewEN.NameCompany = aListCompaniesTemp.Where(c => c.ID == IDCompany).ToList()[0].Name;
                }
                else
                {
                    aBookingRStatusPayViewEN.NameCompany = string.Empty;
                }
                aBookingRStatusPayViewEN.StatusPay = aListTemp[i].BookingRs_StatusPay;
                aBookingRStatusPayViewEN.BookingMoney = aListTemp[i].BookingRs_BookingMoney;
                aBookingRStatusPayViewEN.Sku = aListTemp[i].Rooms_Sku;
                aBookingRStatusPayViewEN.IDBookingH = aListTemp[i].BookingRs_BookingHs_IDBookingH;
                aBookingRStatusPayViewEN.BookingHs_Status = aListTemp[i].BookingHs_Status;
                aBookingRStatusPayViewEN.BookingHs_StatusPay = aListTemp[i].BookingHs_StatusPay;
                aBookingRStatusPayViewEN.BookingHs_Type = aListTemp[i].BookingHs_Type;
                aBookingRStatusPayViewEN.BookingHs_Disable = aListTemp[i].BookingHs_Disable;
                aBookingRStatusPayViewEN.BookingHs_Subject = aListTemp[i].BookingHs_Subject;

                List<BookingRooms> aListBookingRooms = aListBookingRoomTemp.Where(br => br.IDBookingR == aListTemp[i].BookingRs_ID && br.CodeRoom == aListTemp[i].Rooms_Code).ToList();
                if (aListBookingRooms.Count > 0)
                {
                    switch (aListBookingRooms[0].Status)
                    {
                        case 3:
                            aBookingRStatusPayViewEN.BookingRoomStatusPayDisplay = "Đã check in";
                            break;
                        case 5:
                            aBookingRStatusPayViewEN.BookingRoomStatusPayDisplay = "Pending";
                            break;
                        case 7:
                            aBookingRStatusPayViewEN.BookingRoomStatusPayDisplay = "Đã check out nhưng chưa thanh toán";
                            break;
                        case 8:
                            aBookingRStatusPayViewEN.BookingRoomStatusPayDisplay = "Đã thanh toán";
                            break;
                        default:
                            aBookingRStatusPayViewEN.BookingRoomStatusPayDisplay = "Chưa xác định";
                            break;
                    }
                    aBookingRStatusPayViewEN.IDBookingRoom = aListBookingRooms[0].ID;
                    aBookingRStatusPayViewEN.BookingRooms_CodeRoom = aListBookingRooms[0].CodeRoom;
                    aBookingRStatusPayViewEN.CheckInActual = aListBookingRooms[0].CheckInActual;
                    aBookingRStatusPayViewEN.CheckOut = aListBookingRooms[0].CheckOutPlan;
                }

                switch (aBookingRStatusPayViewEN.StatusPay)
                {
                    case 1:
                        aBookingRStatusPayViewEN.BookingRStatusPayDisplay = "Chưa thanh toán";
                        break;
                    case 2:
                        aBookingRStatusPayViewEN.BookingRStatusPayDisplay = "Tạm ứng";
                        break;
                    case 3:
                        aBookingRStatusPayViewEN.BookingRStatusPayDisplay = "Đã thanh toán";
                        break;
                    default:
                        aBookingRStatusPayViewEN.BookingRStatusPayDisplay = "Chưa xác định";
                        break;
                }
                switch (aListTemp[i].BookingRs_CustomerType)
                {
                    case 1:
                        aBookingRStatusPayViewEN.CustomerTypeDisplay = "Nhà nước";
                        break;
                    case 2:
                        aBookingRStatusPayViewEN.CustomerTypeDisplay = "Khách đoàn";
                        break;
                    case 3:
                        aBookingRStatusPayViewEN.CustomerTypeDisplay = "Khách lẻ";
                        break;
                    case 4:
                        aBookingRStatusPayViewEN.CustomerTypeDisplay = "Khách vãng lai";
                        break;
                    case 5:
                        aBookingRStatusPayViewEN.CustomerTypeDisplay = "Khách bộ ngoại giao";
                        break;
                    default:
                        aBookingRStatusPayViewEN.CustomerTypeDisplay = "Chưa xác định";
                        break;
                }
                aListReturn.Add(aBookingRStatusPayViewEN);

            }
            return aListReturn;
        }
        public List<BookingRStatusPayViewEN> GetListUnPayBookingR(DateTime From, DateTime To, int CustomerType, string StatusPay)
        {
            BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO();
            try
            {
                List<sp_BookingRsExt_GetInfo_ByTime_ByCustomerType_ByStatusPay_Result> aListSP = new List<sp_BookingRsExt_GetInfo_ByTime_ByCustomerType_ByStatusPay_Result>();
                aListSP = aDatabaseDA.sp_BookingRsExt_GetInfo_ByTime_ByCustomerType_ByStatusPay(From, To, CustomerType, StatusPay).ToList();

                List<BookingRStatusPayViewEN> aListBookingR = new List<BookingRStatusPayViewEN>();
                BookingRStatusPayViewEN aBookingRStatusPayViewEN = new BookingRStatusPayViewEN();

                for (int i = 0; i < aListSP.Count; i++)
                {
                    aBookingRStatusPayViewEN = new BookingRStatusPayViewEN();

                    aBookingRStatusPayViewEN.IDBookingR = aListSP[i].BookingRs_ID;
                    aBookingRStatusPayViewEN.CreatedDate = aListSP[i].BookingRs_CreatedDate;
                    aBookingRStatusPayViewEN.Customer_Name = aListSP[i].Customers_Name;
                    aBookingRStatusPayViewEN.Subject = aListSP[i].BookingRs_Subject;
                    aBookingRStatusPayViewEN.IDCustomer = Convert.ToInt32(aListSP[i].Customers_ID.ToString());
                    aBookingRStatusPayViewEN.IDCustomerGroup = Convert.ToInt32(aListSP[i].CustomerGroups_ID.ToString());
                    aBookingRStatusPayViewEN.CustomerGroups_Name = aListSP[i].CustomerGroups_Name;
                    aBookingRStatusPayViewEN.StatusPay = aListSP[i].BookingRs_StatusPay;
                    aBookingRStatusPayViewEN.BookingMoney = aListSP[i].BookingRs_BookingMoney;

                    switch (aBookingRStatusPayViewEN.StatusPay)
                    {
                        case 0:
                            aBookingRStatusPayViewEN.BookingRStatusPayDisplay = "Chưa thanh toán";
                            break;
                        case 1:
                            aBookingRStatusPayViewEN.BookingRStatusPayDisplay = "Tạm ứng";
                            break;
                        default:
                            aBookingRStatusPayViewEN.BookingRStatusPayDisplay = "Chưa xác định";
                            break;
                    }

                    aListBookingR.Add(aBookingRStatusPayViewEN);
                }
                return aListBookingR;
            }
            catch (Exception ex)
            {
                throw new Exception("ReceptionTaskBO.GetListUnPayBookingR \n" + ex.ToString());
            }
        }
        //=======================================================
        //Author: LinhTing
        //Function : Tìm danh sách phòng + hóa đơn đã đặt
        //=======================================================
        public List<BookingRStatusPayViewEN> GetListBookedBookingR_BookingRoom(DateTime From, DateTime To, int CustomerType, int BookingStatus)
        {
            List<vw__PaymentInfo__BookingRs_BookingRooms_Customers> aListTemp = new List<vw__PaymentInfo__BookingRs_BookingRooms_Customers>();
            aListTemp = aDatabaseDA.vw__PaymentInfo__BookingRs_BookingRooms_Customers.ToList().Where(a => a.BookingRs_CreatedDate > From).Where(b => b.BookingRs_CreatedDate < To).Where(c => c.BookingRooms_Status == BookingStatus).Where(d => d.BookingRs_CustomerType == CustomerType).ToList();
            List<BookingRStatusPayViewEN> aListReturn = new List<BookingRStatusPayViewEN>();
            BookingRStatusPayViewEN aBookingRStatusPayViewEN = new BookingRStatusPayViewEN();
            CompaniesBO aCompaniesBO = new CompaniesBO();
            for (int i = 0; i < aListTemp.Count; i++)
            {
                aBookingRStatusPayViewEN = new BookingRStatusPayViewEN();

                aBookingRStatusPayViewEN.IDBookingR = aListTemp[i].BookingRs_ID;
                aBookingRStatusPayViewEN.CreatedDate = aListTemp[i].BookingRs_CreatedDate;
                aBookingRStatusPayViewEN.Customer_Name = aListTemp[i].Customers_Name;
                aBookingRStatusPayViewEN.Subject = aListTemp[i].BookingRs_Subject;
                aBookingRStatusPayViewEN.IDCustomer = aListTemp[i].Customers_ID;
                aBookingRStatusPayViewEN.IDCustomerGroup = aListTemp[i].CustomerGroups_ID;

                int IDCompany = !String.IsNullOrEmpty(aListTemp[i].CustomerGroups_IDCompany.ToString()) ? Convert.ToInt32(aListTemp[i].CustomerGroups_IDCompany) : 0;

                Companies aCompanies = aCompaniesBO.Select_ByID(IDCompany);
                aBookingRStatusPayViewEN.NameCompany = aCompanies.Name;
                aBookingRStatusPayViewEN.CustomerGroups_Name = aListTemp[i].CustomerGroups_Name;
                aBookingRStatusPayViewEN.StatusPay = aListTemp[i].BookingRs_StatusPay;
                aBookingRStatusPayViewEN.BookingMoney = aListTemp[i].BookingRs_BookingMonye;
                aBookingRStatusPayViewEN.IDBookingRoom = aListTemp[i].BookingRooms_ID;
                aBookingRStatusPayViewEN.Sku = aListTemp[i].Rooms_Sku;
                aBookingRStatusPayViewEN.BookingStatus = aListTemp[i].BookingRooms_Status;
                aListReturn.Add(aBookingRStatusPayViewEN);
            }
            return aListReturn;
        }