Пример #1
0
    private SortedList getWaitListedRoomsList(BookedRooms[] oBookedRooms, int WaitListedBookingId, out SortedList WaitListedCatnType)
    {
        SortedList slWaitListedRooms = new SortedList();
        SortedList slCatType = new SortedList();
        string     key, value;
        int        wlRooms = 0;

        for (int i = 0; i < oBookedRooms.Length; i++)
        {
            if (oBookedRooms[i].BookingId == WaitListedBookingId && oBookedRooms[i].RoomStatus == Constants.WAITLISTED)
            {
                key   = oBookedRooms[i].RoomNo;
                value = GF.ReplaceSpace(oBookedRooms[i].RoomCategory) + "*" + oBookedRooms[i].RoomType + "*" + oBookedRooms[i].RoomCategoryId.ToString() + "*" + oBookedRooms[i].RoomTypeId.ToString();
                if (!slWaitListedRooms.ContainsKey(key))
                {
                    slWaitListedRooms.Add(key, value);
                }
                if (!slCatType.ContainsKey(value))
                {
                    slCatType.Add(value, 1);
                }
                else
                {
                    wlRooms          = Convert.ToInt32(slCatType[value]) + 1;
                    slCatType[value] = wlRooms;
                }
            }
        }

        WaitListedCatnType = slCatType;
        return(slWaitListedRooms);
    }
Пример #2
0
    private SortedList getAvailableRoomsList(BookedRooms[] oBookedRooms, SortedList slWaitListedRooms, int WaitListedBookingId)
    {
        string     RoomCategory = string.Empty, RoomType = string.Empty;
        int        RoomCategoryId = 0, RoomTypeId = 0;
        string     Key, Value;
        SortedList slAvaialbleRooms          = new SortedList();
        SortedList slBookedWithOtherBookings = new SortedList();

        for (int i = 0; i < slWaitListedRooms.Count; i++)
        {
            splitRoomCatType(Convert.ToString(slWaitListedRooms.GetByIndex(i)), out RoomCategory, out RoomType, out RoomCategoryId, out RoomTypeId);

            for (int j = 0; j < oBookedRooms.Length; j++)
            {
                Key   = oBookedRooms[j].RoomNo;
                Value = GF.ReplaceSpace(oBookedRooms[j].RoomCategory) + "*" + oBookedRooms[j].RoomType + "*" + oBookedRooms[j].RoomCategoryId.ToString() + "*" + oBookedRooms[j].RoomTypeId.ToString();
                //TODO: Not sure about the rooms of the Cancelled booking so currently taking those rooms as available.
                if (oBookedRooms[j].BookingId != WaitListedBookingId && oBookedRooms[j].RoomStatus != Constants.BOOKED && GF.ReplaceSpace(oBookedRooms[j].RoomCategory) == RoomCategory && GF.ReplaceSpace(oBookedRooms[j].RoomType) == RoomType && oBookedRooms[j].RoomStatus.ToString() != "M")
                {
                    if (!slBookedWithOtherBookings.ContainsKey(Key))
                    {
                        if (!slAvaialbleRooms.ContainsKey(Key))
                        {
                            slAvaialbleRooms.Add(Key, Value);
                        }
                    }
                }
                //TODO Not sure about the rooms of the Cancelled Booking
                else if (oBookedRooms[j].BookingId != WaitListedBookingId && (oBookedRooms[j].RoomStatus == Constants.BOOKED) && GF.ReplaceSpace(oBookedRooms[j].RoomCategory) == RoomCategory && GF.ReplaceSpace(oBookedRooms[j].RoomType) == RoomType)
                {
                    if (!slBookedWithOtherBookings.ContainsKey(Key))
                    {
                        slBookedWithOtherBookings.Add(Key, null);
                    }
                    if (slAvaialbleRooms.ContainsKey(Key))
                    {
                        slAvaialbleRooms.Remove(Key);
                    }
                }
                else if (oBookedRooms[j].BookingId == WaitListedBookingId && (oBookedRooms[j].RoomStatus == Constants.WAITLISTED) && GF.ReplaceSpace(oBookedRooms[j].RoomCategory) == RoomCategory && GF.ReplaceSpace(oBookedRooms[j].RoomType) == RoomType)
                {
                    if (oBookedRooms[j].RoomNo == Key)
                    {
                        if (!slBookedWithOtherBookings.ContainsKey(Key))
                        {
                            if (!slAvaialbleRooms.ContainsKey(Key))
                            {
                                slAvaialbleRooms.Add(Key, Value);
                            }
                        }
                    }
                }
            }
        }
        return(slAvaialbleRooms);
    }
Пример #3
0
    private void splitRoomCatType(string RoomCatType, out string RoomCategory, out string RoomType, out int RoomCategoryId, out int RoomTypeId)
    {
        RoomCategory   = string.Empty;
        RoomType       = string.Empty;
        RoomCategoryId = 0;
        RoomTypeId     = 0;

        string[] RCTArray;
        RCTArray     = RoomCatType.Split('*');
        RoomCategory = RCTArray[0];
        RoomCategory = GF.ReplaceSpace(RoomCategory);
        if (RCTArray.Length >= 2)
        {
            RoomType = RCTArray[1];
        }
        if (RCTArray.Length >= 3)
        {
            RoomCategoryId = Convert.ToInt32(RCTArray[2]);
        }
        if (RCTArray.Length >= 4)
        {
            RoomTypeId = Convert.ToInt32(RCTArray[3]);
        }
    }