コード例 #1
0
        private void InitData()
        {
            ItemChangeRoomEN aItemChangeRoomEN = new ItemChangeRoomEN();
            aItemChangeRoomEN.SetBookingRooms(this.aBookingRoom);

            if (aItemChangeRoomEN.GetStatusBookingRooms() < 3)
            {
                // Phong trang thai dat
            }
            else if (aItemChangeRoomEN.GetStatusBookingRooms() == 3) // Phong dang co nguoi o
            {
                // Thay doi thoi gian de check in
                //aItemChangeRoomEN.SetCheckInActual(dtpCheckIn.DateTime);
            }
            aItemChangeRoomEN.IsRootRoom = true;

            List<CustomerInfoEN> aListCustomer = (List<CustomerInfoEN>)this.dgvSelectCustomers.DataSource;
            BookingRoomsMembersBO aBookingRoomsMembersBO = new BookingRoomsMembersBO();
            BookingRoomsMembers aBookingRoomsMembers = new BookingRoomsMembers();
            for (int i = 0; i < aListCustomer.Count; i++)
            {
                aBookingRoomsMembers = aBookingRoomsMembersBO.Select_ByIDBookingRoom_ByIDCustomer(this.aBookingRoom.ID, aListCustomer[i].ID);
                aListCustomer[i].LeaveDate = aBookingRoomsMembers.LeaveDate;
                aListCustomer[i].LimitDateEnterCountry = aBookingRoomsMembers.LimitDateEnterCountry;

                aListCustomer[i].PurposeComeVietnam = aBookingRoomsMembers.PurposeComeVietnam;
                aListCustomer[i].TemporaryResidenceDate = aBookingRoomsMembers.TemporaryResidenceDate;
                aListCustomer[i].DateEnterCountry = aBookingRoomsMembers.DateEnterCountry;
                aListCustomer[i].EnterGate = aBookingRoomsMembers.EnterGate;

            }
            aItemChangeRoomEN.AddCustomer(aListCustomer);

            AccountancyBO aAccountancyBO = new AccountancyBO();

            //aItemChangeRoomEN.SetCost(aAccountancyBO.CalculateCostRoom(lueRooms.EditValue.ToString(), this.aBookingRoom.PriceType, aBookingRs.CustomerType.GetValueOrDefault(0), aItemChangeRoomEN.GetAllCustomers().Count).GetValueOrDefault(0));

            this.aCurrentRoomInfo.SetAddTimeStart(null);
            this.aCurrentRoomInfo.SetAddTimeEnd(null);
            this.aCurrentRoomInfo.SetTimeInUsed(null);

            this.aCurrentRoomInfo.SetCheckInActual(dtpCheckIn.DateTime);
            this.aCurrentRoomInfo.SetCheckInPlan(dtpCheckIn.DateTime);
            this.aCurrentRoomInfo.SetCheckOutActual(dtpCheckOut.DateTime);
            this.aCurrentRoomInfo.SetCheckOutPlan(dtpCheckOut.DateTime);

            this.aChangeRoomEn.InsertItemChangeRooms(aItemChangeRoomEN);
            this.aCurrentRoomInfo = aItemChangeRoomEN;
        }
コード例 #2
0
        private void lueRooms_EditValueChanged(object sender, EventArgs e)
        {
            if (this.IsReadyInitData == true)
            {
                // Luu lai thong tin cua chuyen phong cu truoc khi select phong moi
                this.aChangeRoomEn.UpdateItemChangeRooms(this.aCurrentRoomInfo);

                // Chuyen sang select phong moi bang thong tin trong aChangeRoomsEN
                this.aCurrentRoomInfo = this.aChangeRoomEn.GetItemChangeRooms(lueRooms.EditValue.ToString());

                // Get list customer for current room
                dgvSelectCustomers.DataSource = this.GetDataForSelectCustomerGridview(lueRooms.EditValue.ToString());

                if (this.aCurrentRoomInfo == null)
                {
                    //add them mot ItemChangeRooms moi
                    ItemChangeRoomEN aItemChangeRoomEN = new ItemChangeRoomEN();
                    //Kiem tra va danh dau xem phong vua chon co nam trong BookingR ban dau k?
                    //Viec nay lien quan den truong hop chuyen nguoi tu phong A -> B, (A,B cung thuoc BookingR)
                   List<BookingRooms> aList  = (new BookingRoomsBO()).Select_ByIDBookingRs(this.aBookingRs.ID).Where(p => p.CodeRoom == lueRooms.EditValue.ToString()).ToList();
                   int IsSelectRoomInBookingR = aList.Count;
                   int IDBookingRoom = 0;
                    if (IsSelectRoomInBookingR > 0)
                    {
                        aItemChangeRoomEN.IsRoomInBookingR = true;
                        IDBookingRoom = aList.Max(p => p.ID);
                        aItemChangeRoomEN.SetBookingRooms((new BookingRoomsBO()).Select_ByID(IDBookingRoom));
                    }
                    else
                    {
                        aItemChangeRoomEN.IsRoomInBookingR = false;
                        aItemChangeRoomEN.SetBookingRooms(this.aBookingRoom);
                    }
                    //-----------------------------------------------------------

                    aItemChangeRoomEN.SetAddTimeStart(null);
                    aItemChangeRoomEN.SetAddTimeEnd(null);
                    aItemChangeRoomEN.SetTimeInUsed(null);

                    aItemChangeRoomEN.SetCheckInActual(dtpCheckIn.DateTime);
                    aItemChangeRoomEN.SetCheckInPlan(dtpCheckIn.DateTime);
                    aItemChangeRoomEN.SetCheckOutActual(dtpCheckOut.DateTime);
                    aItemChangeRoomEN.SetCheckOutPlan(dtpCheckOut.DateTime);

                    aItemChangeRoomEN.SetTypeBookingRoom(1); // Khong tin chechIn som voi phong chuyen sang sau

                    aItemChangeRoomEN.SetCodeRoom(lueRooms.EditValue.ToString());

                    aItemChangeRoomEN.AddCustomer(this.GetDataForSelectCustomerGridview(lueRooms.EditValue.ToString()));

                    if (aItemChangeRoomEN.GetAllCustomers().Count > 0)
                    {
                        AccountancyBO aAccountancyBO = new AccountancyBO();
                        aItemChangeRoomEN.SetCost(aAccountancyBO.CalculateCostRoom(lueRooms.EditValue.ToString(), this.aBookingRoom.PriceType, aBookingRs.CustomerType.GetValueOrDefault(0), aItemChangeRoomEN.GetAllCustomers().Count).GetValueOrDefault(0));
                    }
                    else
                    {
                        aItemChangeRoomEN.SetCost(0);
                    }

                    this.aChangeRoomEn.InsertItemChangeRooms(aItemChangeRoomEN);
                    this.aCurrentRoomInfo = aItemChangeRoomEN;
                }
            }
        }
コード例 #3
0
        public bool InsertItemChangeRooms(ItemChangeRoomEN cust)
        {
            try
            {
                ItemChangeRoomEN temp = new ItemChangeRoomEN();
                temp.AddCustomer(cust.GetAllCustomers());
                temp.SetBookingRooms(cust.GetBookingRooms());

                this.aListItemChangeRoomEN.Insert(0, temp);
                return true;
            }
            catch (Exception e2)
            {
                return false;
            }
        }