public Hashtable RoomTypeAndPersonNumber(TERMS.Common.PassengerType type)
    {
        Hashtable hTRoomType = new Hashtable();

        switch (type.ToString().ToUpper())
        {
            #region Delete
            //case "ADULT":
            //    if (tbSingle.Visible == true)
            //    {
            //        if (Convert.ToInt32(ddlSingleAdult.SelectedValue) > 0)
            //        {
            //            if (hTRoomType.ContainsKey(Terms.Product.Utility.RoomType.Single.ToString()))
            //            {
            //                hTRoomType[Terms.Product.Utility.RoomType.Single.ToString()] = Convert.ToInt32(hTRoomType[Terms.Product.Utility.RoomType.Single.ToString()]) + Convert.ToInt32(ddlSingleAdult.SelectedValue);
            //            }
            //            else
            //            {
            //                hTRoomType.Add(Terms.Product.Utility.RoomType.Single.ToString(), Convert.ToInt32(ddlSingleAdult.SelectedValue));
            //            }
            //        }
            //    }

            //    if (tbTwin.Visible == true)
            //    {
            //        if (Convert.ToInt32(ddlTwinAdult.SelectedValue) > 0)
            //        {
            //            if (hTRoomType.ContainsKey(Terms.Product.Utility.RoomType.Twin.ToString()))
            //            {
            //                hTRoomType[Terms.Product.Utility.RoomType.Twin.ToString()] = Convert.ToInt32(hTRoomType[Terms.Product.Utility.RoomType.Twin.ToString()]) + Convert.ToInt32(ddlTwinAdult.SelectedValue);
            //            }
            //            else
            //            {
            //                hTRoomType.Add(Terms.Product.Utility.RoomType.Twin.ToString(), Convert.ToInt32(ddlTwinAdult.SelectedValue));
            //            }
            //        }
            //    }

            //    if (tbTriple.Visible == true)
            //    {
            //        if (Convert.ToInt32(ddlTripleAdult.SelectedValue) > 0)
            //        {
            //            if (hTRoomType.ContainsKey(Terms.Product.Utility.RoomType.Trip.ToString()))
            //            {
            //                hTRoomType[Terms.Product.Utility.RoomType.Trip.ToString()] = Convert.ToInt32(hTRoomType[Terms.Product.Utility.RoomType.Trip.ToString()]) + Convert.ToInt32(ddlTripleAdult.SelectedValue);
            //            }
            //            else
            //            {
            //                hTRoomType.Add(Terms.Product.Utility.RoomType.Trip.ToString(), Convert.ToInt32(ddlTripleAdult.SelectedValue));
            //            }
            //        }
            //    }

            //    if (tbQuat.Visible == true)
            //    {
            //        if (Convert.ToInt32(ddlQuatAdult.SelectedValue) > 0)
            //        {
            //            if (hTRoomType.ContainsKey(Terms.Product.Utility.RoomType.Quarter.ToString()))
            //            {
            //                hTRoomType[Terms.Product.Utility.RoomType.Quarter.ToString()] = Convert.ToInt32(hTRoomType[Terms.Product.Utility.RoomType.Quarter.ToString()]) + Convert.ToInt32(ddlQuatAdult.SelectedValue);
            //            }
            //            else
            //            {
            //                hTRoomType.Add(Terms.Product.Utility.RoomType.Quarter.ToString(), Convert.ToInt32(ddlQuatAdult.SelectedValue));
            //            }
            //        }
            //    }
            //    break;
            //case "CHILD":

            //    if (tbTwin.Visible == true)
            //    {
            //        if (Convert.ToInt32(ddlTwinChild.SelectedValue) > 0)
            //        {
            //            if (hTRoomType.ContainsKey(Terms.Product.Utility.RoomType.Twin.ToString()))
            //            {
            //                hTRoomType[Terms.Product.Utility.RoomType.Twin.ToString()] = Convert.ToInt32(hTRoomType[Terms.Product.Utility.RoomType.Twin.ToString()]) + Convert.ToInt32(ddlTwinChild.SelectedValue);
            //            }
            //            else
            //            {
            //                hTRoomType.Add(Terms.Product.Utility.RoomType.Twin.ToString(), Convert.ToInt32(ddlTwinChild.SelectedValue));
            //            }
            //        }
            //    }

            //    if (tbTriple.Visible == true)
            //    {
            //        if (Convert.ToInt32(ddlTripleChild.SelectedValue) > 0)
            //        {
            //            if (hTRoomType.ContainsKey(Terms.Product.Utility.RoomType.Trip.ToString()))
            //            {
            //                hTRoomType[Terms.Product.Utility.RoomType.Trip.ToString()] = Convert.ToInt32(hTRoomType[Terms.Product.Utility.RoomType.Trip.ToString()]) + Convert.ToInt32(ddlTripleChild.SelectedValue);
            //            }
            //            else
            //            {
            //                hTRoomType.Add(Terms.Product.Utility.RoomType.Trip.ToString(), Convert.ToInt32(ddlTripleChild.SelectedValue));
            //            }
            //        }
            //    }

            //    if (tbQuat.Visible == true)
            //    {
            //        if (Convert.ToInt32(ddlQuatChild.SelectedValue) > 0)
            //        {
            //            if (hTRoomType.ContainsKey(Terms.Product.Utility.RoomType.Quarter.ToString()))
            //            {
            //                hTRoomType[Terms.Product.Utility.RoomType.Quarter.ToString()] = Convert.ToInt32(hTRoomType[Terms.Product.Utility.RoomType.Quarter.ToString()]) + Convert.ToInt32(ddlQuatChild.SelectedValue);
            //            }
            //            else
            //            {
            //                hTRoomType.Add(Terms.Product.Utility.RoomType.Quarter.ToString(), Convert.ToInt32(ddlQuatChild.SelectedValue));
            //            }
            //        }
            //    }
            //    break;
            //case "INFANT":

            //    if (tbTwin.Visible == true)
            //    {
            //        if (Convert.ToInt32(ddlTwinChildWithOut.SelectedValue) > 0)
            //        {
            //            if (hTRoomType.ContainsKey(Terms.Product.Utility.RoomType.Twin.ToString()))
            //            {
            //                hTRoomType[Terms.Product.Utility.RoomType.Twin.ToString()] = Convert.ToInt32(hTRoomType[Terms.Product.Utility.RoomType.Twin.ToString()]) + Convert.ToInt32(ddlTwinChildWithOut.SelectedValue);
            //            }
            //            else
            //            {
            //                hTRoomType.Add(Terms.Product.Utility.RoomType.Twin.ToString(), Convert.ToInt32(ddlTwinChildWithOut.SelectedValue));
            //            }
            //        }
            //    }

            //    if (tbTriple.Visible == true)
            //    {
            //        if (Convert.ToInt32(ddlTripleChildWithOut.SelectedValue) > 0)
            //        {
            //            if (hTRoomType.ContainsKey(Terms.Product.Utility.RoomType.Trip.ToString()))
            //            {
            //                hTRoomType[Terms.Product.Utility.RoomType.Trip.ToString()] = Convert.ToInt32(hTRoomType[Terms.Product.Utility.RoomType.Trip.ToString()]) + Convert.ToInt32(ddlTripleChildWithOut.SelectedValue);
            //            }
            //            else
            //            {
            //                hTRoomType.Add(Terms.Product.Utility.RoomType.Trip.ToString(), Convert.ToInt32(ddlTripleChildWithOut.SelectedValue));
            //            }
            //        }
            //    }

            //    if (tbQuat.Visible == true)
            //    {
            //        if (Convert.ToInt32(ddlQuatChildWithOut.SelectedValue) > 0)
            //        {
            //            if (hTRoomType.ContainsKey(Terms.Product.Utility.RoomType.Quarter.ToString()))
            //            {
            //                hTRoomType[Terms.Product.Utility.RoomType.Quarter.ToString()] = Convert.ToInt32(hTRoomType[Terms.Product.Utility.RoomType.Quarter.ToString()]) + Convert.ToInt32(ddlQuatChildWithOut.SelectedValue);
            //            }
            //            else
            //            {
            //                hTRoomType.Add(Terms.Product.Utility.RoomType.Quarter.ToString(), Convert.ToInt32(ddlQuatChildWithOut.SelectedValue));
            //            }
            //        }
            //    }
            //    break;
            #endregion

            case "ADULT":
                for (int i = 0; i < Rooms; i++)
                {
                    if (hTRoomType.ContainsKey(RoomTypes[i]))
                        hTRoomType[RoomTypes[i]] = Convert.ToInt32(hTRoomType[RoomTypes[i]]) + Adults[i];
                    else
                    {
                        if (Adults[i] > 0)
                            hTRoomType.Add(RoomTypes[i], Adults[i]);
                    }
                }
                break;
            case "CHILD":

                for (int i = 0; i < Rooms; i++)
                {
                    if (hTRoomType.ContainsKey(RoomTypes[i]))
                        hTRoomType[RoomTypes[i]] = Convert.ToInt32(hTRoomType[RoomTypes[i]]) + Childs[i];
                    else
                    {

                        if (Childs[i] > 0)
                            hTRoomType.Add(RoomTypes[i], Childs[i]);
                    }

                }
                break;
            case "INFANT":
                for (int i = 0; i < Rooms; i++)
                {
                    if (hTRoomType.ContainsKey(RoomTypes[i]))
                        hTRoomType[RoomTypes[i]] = Convert.ToInt32(hTRoomType[RoomTypes[i]]) + ChildsWithOut[i];
                    else
                    {

                        if (Childs[i] > 0)
                            hTRoomType.Add(RoomTypes[i], ChildsWithOut[i]);
                    }

                }
                break;

        }

        return hTRoomType;
    }
    public string GetUnitPprice(TourRoom tourRoom, TERMS.Common.PassengerType passenger)
    {
        decimal unitPprice = 0.0m;
        //for (int i = 0; i < tourRoom.FareType.Count; i++)
        //{
        //    if (tourRoom.FareType[i].PassengerType.ToString().Equals(passenger.ToString()))
        //    {
        //        unitPprice = tourRoom.FareType[i].LandUnitNetPrice + tourRoom.FareType[i].UnitMarkup;

        //    }

        //}
        return unitPprice.ToString("n", System.Globalization.CultureInfo.CurrentUICulture.NumberFormat);
    }
Exemplo n.º 3
0
    private TERMS.Business.Centers.SalesCenter.Hotel ConvertRooms(TERMS.Business.Centers.SalesCenter.Hotel hotel, Terms.Sales.Business.HotelSearchCondition searchCondtion)
    {
        List<MVRoom> rooms = new List<MVRoom>();

        for (int index = 0; index < searchCondtion.RoomSearchConditions.Count; index++)
        {
            //������
            int iAdult = searchCondtion.RoomSearchConditions[index].Passengers[TERMS.Common.PassengerType.Adult];
            //����
            int iChild = searchCondtion.RoomSearchConditions[index].Passengers[TERMS.Common.PassengerType.Child];

            int MaxNumber = 0;

            MVRoom mvroom = new MVRoom((TERMS.Business.Centers.SalesCenter.HotelProfile)((TERMS.Business.Centers.SalesCenter.HotelProfile)hotel.Profile).Clone());
            mvroom.Profile.AdultNumber = iAdult;
            mvroom.Profile.ChildNumber = iChild;

            for (int j = 0; j < hotel.Items.Count; j++)
            {
                //�жϷ��������Ƿ����
                HotelMaterial room = (HotelMaterial)hotel.Items[j];

                if (string.IsNullOrEmpty(room.Room.Name))
                    room.Room.Name = room.Room.Description;

                MaxNumber = room.Room.Capacity + room.Room.MaxExtraBed + room.Room.MaxShareBed;

                if ((iAdult + iChild) > MaxNumber)
                {
                    continue;
                }
                else
                {
                    if (iChild > 0)
                    {
                        if ((iAdult + iChild) == room.Room.Capacity)
                        {
                            if (iAdult == 2 && iChild == 1)
                            {
                                if (room.Room.Code == "TR")
                                {
                                    continue;
                                }
                            }

                            AddRoomSort(mvroom, room);
                            continue;
                        }

                        if ((room.Room.MaxExtraBed + room.Room.MaxShareBed) >= iChild && iAdult == room.Room.Capacity)
                        {
                            if (iAdult == 2 && iChild == 1)
                            {
                                if (room.Room.Code == "TR")
                                {
                                    continue;
                                }
                            }

                            AddRoomSort(mvroom, room);
                            continue;
                        }

                        if (iAdult == 1 && iChild == 2)
                        {
                            if (room.Room.Code == "DB" || room.Room.Code == "TB")
                            {
                                if (room.Room.MaxExtraBed == 1)
                                {
                                    AddRoomSort(mvroom, room);
                                    continue;
                                }
                            }
                        }
                    }
                    else
                    {
                        if (iAdult == room.Room.Capacity && (room.Room.MaxExtraBed + room.Room.MaxShareBed) == iChild)
                        {
                            if (iAdult == 2 && iChild == 1)
                            {
                                if (room.Room.Code == "TR")
                                {
                                    continue;
                                }
                            }

                            AddRoomSort(mvroom, room);
                            continue;
                        }
                    }

                    //mvroom.Items.Add(room);

                }
            }

            if (mvroom.Items.Count > 0)
                rooms.Add(mvroom);
        }

        if (rooms.Count == searchCondtion.RoomSearchConditions.Count)
        {
            hotel.Items.Clear();

            for (int j = 0; j < rooms.Count; j++)
            {
                hotel.Items.Add(rooms[j]);
            }

            return hotel;
        }
        else
        {
            return null;
        }
    }
    public Hashtable RoomTypeAndPersonNumber(TERMS.Common.PassengerType type)
    {
        Hashtable hTRoomType = new Hashtable();

        switch (type.ToString().ToUpper())
        {
            case "ADULT":
                for (int i = 0; i < Rooms; i++)
                {
                    if (hTRoomType.ContainsKey(RoomTypes[i]))
                        hTRoomType[RoomTypes[i]] = Convert.ToInt32(hTRoomType[RoomTypes[i]]) + Adults[i];
                    else
                    {
                        if (Adults[i] > 0)
                            hTRoomType.Add(RoomTypes[i], Adults[i]);
                    }
                }
                break;
            case "CHILD":

                for (int i = 0; i < Rooms; i++)
                {
                    if (hTRoomType.ContainsKey(RoomTypes[i]))
                        hTRoomType[RoomTypes[i]] = Convert.ToInt32(hTRoomType[RoomTypes[i]]) + Childs[i];
                    else
                    {

                        if (Childs[i] > 0)
                            hTRoomType.Add(RoomTypes[i], Childs[i]);
                    }

                }
                break;
            case "INFANT":
                for (int i = 0; i < Rooms; i++)
                {
                    if (hTRoomType.ContainsKey(RoomTypes[i]))
                        hTRoomType[RoomTypes[i]] = Convert.ToInt32(hTRoomType[RoomTypes[i]]) + ChildsWithOut[i];
                    else
                    {

                        if (Childs[i] > 0)
                            hTRoomType.Add(RoomTypes[i], ChildsWithOut[i]);
                    }

                }
                break;

        }

        return hTRoomType;
    }