コード例 #1
0
        public List<OverNightCustomerEN> GetOverNightCustomer(DateTime CheckPoint, int Status)
        {
            List<BookingRooms> aListBookingRooms = aBookingRoomsBO.Select_ByStatus_ByTime(CheckPoint, Status);
            List<BookingRoomsMembers> aListBookingRoomsMembers = new List<BookingRoomsMembers>();
            List<OverNightCustomerEN> aListOverNightCustomer = new List<OverNightCustomerEN>();
            OverNightCustomerEN aOverNightCustomer = new OverNightCustomerEN();
            Customers aCustomers;

            // get tất cả dữ liệu
            List<int> aListIDBookingRoom = new List<int>();
            int aTemp;
            for (int i = 0; i < aListBookingRooms.Count; i++)
            {
                aTemp = new int();
                aTemp = aListBookingRooms[i].ID;
                aListIDBookingRoom.Add(aTemp);
            }
            List<string> aListCodeRoom = new List<string>();

            for (int i = 0; i < aListBookingRooms.Count; i++)
            {
                string aCode;
                aCode = aListBookingRooms[i].CodeRoom;
                aListCodeRoom.Add(aCode);
            }

            List<BookingRoomsMembers> aListAllBookingRoomsMembers = aBookingRoomsMembersBO.Select_ByListIDBookingRoom(aListIDBookingRoom);
            List<Companies> aListCompanies = aCompaniesBO.Select_ByListIDBookingRoom(aListIDBookingRoom);
            List<CustomerGroups> aListCustomerGroups = aCustomerGroupsBO.Select_ByListIDBookingRoom(aListIDBookingRoom);
            List<Rooms> aListRooms = aRoomsBO.Select_ByListCodeRoom(aListCodeRoom, 1);
            List<Customers> aListCustomers = aCustomersBO.SelectListCustomer_ByListIDBookingRoom(aListIDBookingRoom);
            List<BookingRs> aListBookingRs = aBookingRsBO.Select_ByListIDBookingRoom(aListIDBookingRoom);

            for (int i = 0; i < aListBookingRooms.Count; i++)
            {
                aListBookingRoomsMembers = aListAllBookingRoomsMembers.Where(p => p.IDBookingRoom == aListBookingRooms[i].ID).ToList();

                for (int y = 0; y < aListBookingRoomsMembers.Count; y++)
                {
                    aOverNightCustomer = new OverNightCustomerEN();

                    aCustomers = new Customers();
                    int IDCustomer = aListBookingRoomsMembers[y].IDCustomer;
                    aCustomers = aListCustomers.Where(p => p.ID == IDCustomer).ToList()[0];

                    int IDCustomerGroup = aListBookingRs.Where(p => p.ID == aListBookingRooms[i].IDBookingR).ToList()[0].IDCustomerGroup;
                    int IDCompany = aListCustomerGroups.Where(p => p.ID == IDCustomerGroup).ToList()[0].IDCompany;
                    if (IDCompany != null)
                    {
                        aOverNightCustomer.CompanyName = aListCompanies.Where(p => p.ID == IDCompany).ToList()[0].Name;
                    }

                    aOverNightCustomer.PurposeComeVietnam = aListBookingRoomsMembers[y].PurposeComeVietnam;
                    aOverNightCustomer.DateEnterCountry = aListBookingRoomsMembers[y].DateEnterCountry;
                    aOverNightCustomer.EnterGate = aListBookingRoomsMembers[y].EnterGate;
                    aOverNightCustomer.TemporaryResidenceDate = aListBookingRoomsMembers[y].TemporaryResidenceDate;
                    aOverNightCustomer.LeaveDate = aListBookingRoomsMembers[y].LeaveDate;
                    aOverNightCustomer.Organization = aListBookingRoomsMembers[y].Organization;
                    aOverNightCustomer.LimitDateEnterCountry = aListBookingRoomsMembers[y].LimitDateEnterCountry;

                    aOverNightCustomer.IDBookingRoom = aListBookingRooms[i].ID;

                    if (aListRooms.Where(p => p.Code == aListBookingRooms[i].CodeRoom).ToList()[0] != null)
                    {
                        aOverNightCustomer.Sku = aListRooms.Where(p => p.Code == aListBookingRooms[i].CodeRoom).ToList()[0].Sku;
                    }

                    if (aListBookingRs.Where(p => p.ID == aListBookingRooms[i].IDBookingR).ToList()[0] != null)
                    {
                        aOverNightCustomer.CustomerType = aListBookingRs.Where(p => p.ID == aListBookingRooms[i].IDBookingR).ToList()[0].CustomerType;
                    }
                    aOverNightCustomer.CheckInActual = aListBookingRooms[i].CheckInActual;
                    aOverNightCustomer.CheckOutPlan = aListBookingRooms[i].CheckOutPlan;
                    aOverNightCustomer.Name = aCustomers.Name;
                    aOverNightCustomer.IDCustomer = aCustomers.ID;
                    aOverNightCustomer.Identifier1 = aCustomers.Identifier1;
                    aOverNightCustomer.Identifier2 = aCustomers.Identifier2;
                    aOverNightCustomer.Identifier3 = aCustomers.Identifier3;
                    aOverNightCustomer.Nationality = aCustomers.Nationality;
                    aOverNightCustomer.Birthday = String.Format("{0:MM-dd-yyyy}", aCustomers.Birthday);
                    aOverNightCustomer.Tel = aCustomers.Tel;
                    aOverNightCustomer.Address = aCustomers.Address;
                    aOverNightCustomer.Email = aCustomers.Email;
                    aOverNightCustomer.Info = aCustomers.Info;
                    aOverNightCustomer.Gender = aCustomers.Gender;
                    aOverNightCustomer.Citizen = aCustomers.Citizen;
                    aOverNightCustomer.Identifier1CreatedDate = aCustomers.Identifier1CreatedDate;
                    aOverNightCustomer.Identifier2CreatedDate = aCustomers.Identifier2CreatedDate;
                    aOverNightCustomer.Identifier3CreatedDate = aCustomers.Identifier3CreatedDate;
                    aOverNightCustomer.PlaceOfIssue1 = aCustomers.PlaceOfIssue1;
                    aOverNightCustomer.PlaceOfIssue2 = aCustomers.PlaceOfIssue2;
                    aOverNightCustomer.PlaceOfIssue3 = aCustomers.PlaceOfIssue3;
                    aOverNightCustomer.AgencyOfIssue1 = aCustomers.AgencyOfIssue1;
                    aOverNightCustomer.AgencyOfIssue2 = aCustomers.AgencyOfIssue2;
                    aOverNightCustomer.AgencyOfIssue3 = aCustomers.AgencyOfIssue3;
                    aOverNightCustomer.CAN_BO_NM = "NVNK";
                    aOverNightCustomer.IsVietNam = "N";
                    aOverNightCustomer.Quan = "HK";
                    aOverNightCustomer.DIACHI_TT = "2 Lê Thạch";
                    aOverNightCustomer.NgayTruyen = DateTime.Now.Date.ToShortDateString();

                    aListOverNightCustomer.Add(aOverNightCustomer);
                }
            }

            return aListOverNightCustomer;
        }
コード例 #2
0
        //=======================================================
        //Author: LinhTing
        //Function : Tìm danh sách khách qua đêm
        //=======================================================
        //public List<OverNightCustomerEN> GetOverNightCustomer(DateTime CheckPoint, int Status)
        //{
        //    List<BookingRooms> aListBookingRooms = aBookingRoomsBO.Select_ByStatus_ByTime(CheckPoint, Status);
        //    List<BookingRoomsMembers> aListBookingRoomsMembers = new List<BookingRoomsMembers>();
        //    List<OverNightCustomerEN> aListOverNightCustomer = new List<OverNightCustomerEN>();
        //    OverNightCustomerEN aOverNightCustomer = new OverNightCustomerEN();
        //    Customers aCustomers;
        //    string a = DateTime.Now.Ticks.ToString();
        //    for (int i = 0; i < aListBookingRooms.Count; i++)
        //    {
        //        aListBookingRoomsMembers = aBookingRoomsMembersBO.Select_ByIDBookingRoom(aListBookingRooms[i].ID);
        //        for (int y = 0; y < aListBookingRoomsMembers.Count; y++)
        //        {
        //            aOverNightCustomer = new OverNightCustomerEN();
        //            aCustomers = new Customers();
        //            int IDCustomer = aListBookingRoomsMembers[y].IDCustomer;
        //            aCustomers = aCustomersBO.Select_ByID(IDCustomer);
        //            if (aCompaniesBO.Select_ByIDBookingRoom(aListBookingRooms[i].ID) != null)
        //            {
        //                aOverNightCustomer.CompanyName = aCompaniesBO.Select_ByIDBookingRoom(aListBookingRooms[i].ID).Name;
        //            }
        //            aOverNightCustomer.PurposeComeVietnam = aListBookingRoomsMembers[y].PurposeComeVietnam;
        //            aOverNightCustomer.IDBookingRoom = aListBookingRooms[i].ID;
        //            if (aRoomsBO.Select_ByCodeRoom(aListBookingRooms[i].CodeRoom, 1) != null)
        //            {
        //                aOverNightCustomer.Sku = aRoomsBO.Select_ByCodeRoom(aListBookingRooms[i].CodeRoom, 1).Sku;
        //            }
        //            if (aBookingRsBO.Select_ByID(aListBookingRooms[i].IDBookingR) != null)
        //            {
        //                aOverNightCustomer.CustomerType = aBookingRsBO.Select_ByID(aListBookingRooms[i].IDBookingR).CustomerType;
        //            }
        //            aOverNightCustomer.CheckInActual = aListBookingRooms[i].CheckInActual;
        //            aOverNightCustomer.CheckOutPlan = aListBookingRooms[i].CheckOutPlan;
        //            aOverNightCustomer.Name = aCustomers.Name;
        //            aOverNightCustomer.IDCustomer = aCustomers.ID;
        //            aOverNightCustomer.Identifier1 = aCustomers.Identifier1;
        //            aOverNightCustomer.Identifier2 = aCustomers.Identifier2;
        //            aOverNightCustomer.Identifier3 = aCustomers.Identifier3;
        //            aOverNightCustomer.Nationality = aCustomers.Nationality;
        //            aOverNightCustomer.Birthday = aCustomers.Birthday;
        //            aOverNightCustomer.Tel = aCustomers.Tel;
        //            aOverNightCustomer.Address = aCustomers.Address;
        //            aOverNightCustomer.Email = aCustomers.Email;
        //            aOverNightCustomer.Info = aCustomers.Info;
        //            aOverNightCustomer.Gender = aCustomers.Gender;
        //            aOverNightCustomer.Citizen = aCustomers.Citizen;
        //            aOverNightCustomer.Identifier1CreatedDate = aCustomers.Identifier1CreatedDate;
        //            aOverNightCustomer.Identifier2CreatedDate = aCustomers.Identifier2CreatedDate;
        //            aOverNightCustomer.Identifier3CreatedDate = aCustomers.Identifier3CreatedDate;
        //            aOverNightCustomer.PlaceOfIssue1 = aCustomers.PlaceOfIssue1;
        //            aOverNightCustomer.PlaceOfIssue2 = aCustomers.PlaceOfIssue2;
        //            aOverNightCustomer.PlaceOfIssue3 = aCustomers.PlaceOfIssue3;
        //            aListOverNightCustomer.Add(aOverNightCustomer);
        //        }
        //    }
        //    a = a + "---" + DateTime.Now.Ticks.ToString();
        //    return aListOverNightCustomer;
        //}
        // Author : LinhTing
        // Select list khách qua đêm mới
        public List<OverNightCustomerEN> GetNewOverNightCustomer(DateTime CheckPoint, int Status)
        {
            List<BookingRooms> aListNewBookingRooms = aBookingRoomsBO.Select_ByStatus_ByTime(CheckPoint, CheckPoint.AddDays(-1), Status);
            List<BookingRoomsMembers> aListNewBookingRoomsMembers = new List<BookingRoomsMembers>();
            List<OverNightCustomerEN> aListNewOverNightCustomer = new List<OverNightCustomerEN>();
            OverNightCustomerEN aNewOverNightCustomer = new OverNightCustomerEN();
            Customers aCustomers;

            for (int i = 0; i < aListNewBookingRooms.Count; i++)
            {
                aListNewBookingRoomsMembers = aBookingRoomsMembersBO.Select_ByIDBookingRoom(aListNewBookingRooms[i].ID);

                for (int y = 0; y < aListNewBookingRoomsMembers.Count; y++)
                {
                    aNewOverNightCustomer = new OverNightCustomerEN();

                    aCustomers = new Customers();
                    int IDCustomer = aListNewBookingRoomsMembers[y].IDCustomer;
                    aCustomers = aCustomersBO.Select_ByID(IDCustomer);

                    aNewOverNightCustomer.CompanyName = aCompaniesBO.Select_ByIDBookingRoom(aListNewBookingRooms[i].ID).Name;

                    aNewOverNightCustomer.PurposeComeVietnam = aListNewBookingRoomsMembers[y].PurposeComeVietnam;
                    aNewOverNightCustomer.IDBookingRoom = aListNewBookingRooms[i].ID;

                    aNewOverNightCustomer.Sku = aRoomsBO.Select_ByCodeRoom(aListNewBookingRooms[i].CodeRoom, 1).Sku;

                    aNewOverNightCustomer.CustomerType = aBookingRsBO.Select_ByID(aListNewBookingRooms[i].IDBookingR).CustomerType;

                    aNewOverNightCustomer.CheckInActual = aListNewBookingRooms[i].CheckInActual;
                    aNewOverNightCustomer.CheckOutPlan = aListNewBookingRooms[i].CheckOutPlan;
                    aNewOverNightCustomer.Name = aCustomers.Name;
                    aNewOverNightCustomer.IDCustomer = aCustomers.ID;
                    aNewOverNightCustomer.Identifier1 = aCustomers.Identifier1;
                    aNewOverNightCustomer.Identifier2 = aCustomers.Identifier2;
                    aNewOverNightCustomer.Identifier3 = aCustomers.Identifier3;
                    aNewOverNightCustomer.Nationality = aCustomers.Nationality;
                    aNewOverNightCustomer.Birthday = String.Format("{0:MM-dd-yyyy}", aCustomers.Birthday);

                    aNewOverNightCustomer.Tel = aCustomers.Tel;
                    aNewOverNightCustomer.Address = aCustomers.Address;
                    aNewOverNightCustomer.Email = aCustomers.Email;
                    aNewOverNightCustomer.Info = aCustomers.Info;
                    aNewOverNightCustomer.Gender = aCustomers.Gender;
                    aNewOverNightCustomer.Citizen = aCustomers.Citizen;
                    aNewOverNightCustomer.Identifier1CreatedDate = aCustomers.Identifier1CreatedDate;
                    aNewOverNightCustomer.Identifier2CreatedDate = aCustomers.Identifier2CreatedDate;
                    aNewOverNightCustomer.Identifier3CreatedDate = aCustomers.Identifier3CreatedDate;
                    aNewOverNightCustomer.PlaceOfIssue1 = aCustomers.PlaceOfIssue1;
                    aNewOverNightCustomer.PlaceOfIssue2 = aCustomers.PlaceOfIssue2;
                    aNewOverNightCustomer.PlaceOfIssue3 = aCustomers.PlaceOfIssue3;
                    aNewOverNightCustomer.AgencyOfIssue1 = aCustomers.AgencyOfIssue1;
                    aNewOverNightCustomer.AgencyOfIssue2 = aCustomers.AgencyOfIssue2;
                    aNewOverNightCustomer.AgencyOfIssue3 = aCustomers.AgencyOfIssue3;

                    aListNewOverNightCustomer.Add(aNewOverNightCustomer);
                }
            }
            return aListNewOverNightCustomer;
        }