private void FilterHotel(List<MVHotel> hotelMaterials, ref List<MVHotel> hotelMaterialsNew)
    {
        if (Utility.HotelSortRule.Count == 3 && Utility.BackFlag == "1")
        {
            Utility.BackFlag = "0";
            ddlStar.SelectedValue = Utility.HotelSortRule[0];
            txtContains.Text = Utility.HotelSortRule[1];
            rbtnSort.SelectedValue = Utility.HotelSortRule[2];
        }

        if (this.ddlStar.SelectedIndex > 0)
        {
            string strStar = this.ddlStar.SelectedValue;

            for (int i = 0; i < hotelMaterials.Count; i++)
            {
                if (hotelMaterials[i].HotelInformation.Class == strStar)
                {
                    hotelMaterialsNew.Add(hotelMaterials[i]);
                }
            }
        }
        else
        {
            if (hotelMaterialsNew.Count > 0)
            {
                hotelMaterials = hotelMaterialsNew;
                hotelMaterialsNew = new List<MVHotel>();
            }
        }

        if (hotelMaterials.Count != hotelMaterialsNew.Count && hotelMaterialsNew.Count > 0)
        {
            hotelMaterials = new List<MVHotel>();
            //hotelMaterials.CopyTo(hotelMaterialsNew.ToArray()) ;
            MVHotel[] arr = new MVHotel[hotelMaterialsNew.Count];
            hotelMaterialsNew.CopyTo(arr);
            hotelMaterials.AddRange(arr);
            hotelMaterialsNew = new List<MVHotel>();
        }

        if (hotelMaterials.Count == hotelMaterialsNew.Count)
        {
            hotelMaterialsNew = new List<MVHotel>();
        }

        if (this.txtContains.Text.Trim().Length > 0)
        {
            string strContains = txtContains.Text.Trim();

            for (int i = 0; i < hotelMaterials.Count; i++)
            {
                if (hotelMaterials[i].HotelInformation.Name.ToUpper().Contains(strContains.ToUpper()))
                {
                    hotelMaterialsNew.Add(hotelMaterials[i]);
                }
            }
        }
        else
        {
            if (hotelMaterialsNew.Count == 0)
            {
                hotelMaterialsNew = hotelMaterials;
            }
        }

        //if (hotelMaterialsNew.Count == 0)
        //{
        //    hotelMaterialsNew = hotelMaterials;
        //}

        if (hotelMaterialsNew.Count > 0)
        {
            if (rbtnSort.SelectedIndex == 0)
            {
                //hotelMaterialsNew.Sort(delegate(MVHotel r1, MVHotel r2) { return r1.RoomPrice.CompareTo(r2.RoomPrice); });
                MagesticPicksSort(ref hotelMaterialsNew);
            }
            if (rbtnSort.SelectedIndex == 1)
            {
                hotelMaterialsNew.Sort(delegate(MVHotel r1, MVHotel r2) { return r1.RoomPricePerNight.CompareTo(r2.RoomPricePerNight); });
            }
            if (rbtnSort.SelectedIndex == 2)
            {
                hotelMaterialsNew.Sort(delegate(MVHotel r1, MVHotel r2) { return r1.HotelInformation.Name.CompareTo(r2.HotelInformation.Name); });
            }
            if (rbtnSort.SelectedIndex == 3)
            {
                hotelMaterialsNew.Sort(delegate(MVHotel r1, MVHotel r2) { return r1.HotelInformation.Class.CompareTo(r2.HotelInformation.Class); });
            }
        }
    }
    private string BindPageList(MVHotel pHotelMaterial)
    {
        string temp = string.Empty;

        if (pHotelMaterial.HotelInformation.GetImage("FRONT") != null && pHotelMaterial.HotelInformation.GetImage("FRONT").Filename != null)
            imgHotel.ImageUrl = pHotelMaterial.HotelInformation.GetImage("FRONT").Filename.Trim();
        else
            imgHotel.ImageUrl = "~/images/v1/defaulth.gif";
        if (pHotelMaterial.HotelInformation.Class != null && pHotelMaterial.HotelInformation.Class.ToString() != "")
            imgstar3.ImageUrl = "~/images/star" + pHotelMaterial.HotelInformation.Class.ToString().Trim() + ".gif";
        lblHotelName.Text = pHotelMaterial.HotelInformation.Name;
        lblAddress.Text = pHotelMaterial.HotelInformation.Address;
        //lblLocation.Text = pHotelMaterial.HotelInformation.Description;
        //if (string.IsNullOrEmpty(pHotelMaterial.HotelInformation.MapUrl))
        //{
        //    imgMapUrl.Visible = false;
        //}
        //else
        //{
        //    imgMapUrl.Visible = true;
        //    imgMapUrl.ImageUrl = pHotelMaterial.HotelInformation.MapUrl;
        //}

        for (int i = 0; i < pHotelMaterial.HotelInformation.Features.Count; i++)
        {
            temp += "<li>" + pHotelMaterial.HotelInformation.Features[i] + "</li>";
        }

        return temp;
    }
示例#3
0
    private string BindPageList(MVHotel pHotelMaterial)
    {
        string temp = string.Empty;

        lblHotelName.Text = pHotelMaterial.HotelInformation.Name;

        lblAddress.Text = pHotelMaterial.HotelInformation.Address;

        lblLocation.Text = pHotelMaterial.Location;

        imgMapUrl.ImageUrl = pHotelMaterial.HotelInformation.MapUrl;

        //List<SaleHotelAmenity> tempSaleHotelAmenity = pHotelMaterial.Hotel.Amenities;

        for (int i = 0; i < pHotelMaterial.Amenities.Count; i++)
        {
            temp += "<li>" + pHotelMaterial.Amenities[i].Name + "</li>";
        }

        return temp;
    }
示例#4
0
    private void FilterHotel(List<MVHotel> hotelMaterials, ref List<MVHotel> hotelMaterialsNew)
    {
        if (Utility.HotelSortRule.Count == 3 && Utility.BackFlag == "1")
        {
            Utility.BackFlag = "0";
            ddlStar.SelectedValue = Utility.HotelSortRule[0];
            txtContains.Text = Utility.HotelSortRule[1];
            ddlSort.SelectedValue = Utility.HotelSortRule[2];
        }

        if (this.ddlStar.SelectedIndex > 0)
        {
            string strStar = this.ddlStar.SelectedValue;

            for (int i = 0; i < hotelMaterials.Count; i++)
            {
                if ( Convert.ToDouble(hotelMaterials[i].HotelInformation.Class) >= Convert.ToDouble(strStar))
                {
                    if (hotelMaterials[i].HotelInformation.Position.LatitudeNoun != null && hotelMaterials[i].HotelInformation.Position.LongitudeNoun != null)
                    {
                        if (hotelMaterials[i].HotelInformation.Position.LatitudeNoun.DecimalCode != "0" && hotelMaterials[i].HotelInformation.Position.LongitudeNoun.DecimalCode != "0")
                        {
                            hotelMaterialsNew.Add(hotelMaterials[i]);
                        }
                    }
                }
            }
        }
        else
        {
            if (hotelMaterialsNew.Count > 0)
            {
                hotelMaterials = hotelMaterialsNew;
                hotelMaterialsNew = new List<MVHotel>();
            }
        }

        if (hotelMaterials.Count != hotelMaterialsNew.Count && hotelMaterialsNew.Count > 0)
        {
            hotelMaterials = new List<MVHotel>();
            MVHotel[] arr = new MVHotel[hotelMaterialsNew.Count];
            hotelMaterialsNew.CopyTo(arr);
            hotelMaterials.AddRange(arr);
            hotelMaterialsNew = new List<MVHotel>();
        }

        if (hotelMaterials.Count == hotelMaterialsNew.Count)
        {
            hotelMaterialsNew = new List<MVHotel>();
        }

        if (this.txtContains.Text.Trim().Length > 0)
        {
            string strContains = txtContains.Text.Trim();

            for (int i = 0; i < hotelMaterials.Count; i++)
            {
                if (hotelMaterials[i].HotelInformation.Name.ToUpper().Contains(strContains.ToUpper()))
                {
                    if (hotelMaterials[i].HotelInformation.Position.LatitudeNoun != null && hotelMaterials[i].HotelInformation.Position.LongitudeNoun != null)
                    {
                        if (hotelMaterials[i].HotelInformation.Position.LatitudeNoun.DecimalCode != "0" && hotelMaterials[i].HotelInformation.Position.LongitudeNoun.DecimalCode != "0")
                        {
                            hotelMaterialsNew.Add(hotelMaterials[i]);
                        }
                    }
                }
            }
        }
        else
        {
            if (hotelMaterialsNew.Count == 0)
            {
                for (int i = 0; i < hotelMaterials.Count; i++)
                {
                    if (hotelMaterials[i].HotelInformation.Position.LatitudeNoun != null && hotelMaterials[i].HotelInformation.Position.LongitudeNoun != null)
                    {
                        if (hotelMaterials[i].HotelInformation.Position.LatitudeNoun.DecimalCode != "0" && hotelMaterials[i].HotelInformation.Position.LongitudeNoun.DecimalCode != "0")
                        {
                            hotelMaterialsNew.Add(hotelMaterials[i]);
                        }
                    }
                }
            }
        }

        if (hotelMaterials.Count != hotelMaterialsNew.Count && hotelMaterialsNew.Count > 0)
        {
            hotelMaterials = new List<MVHotel>();
            MVHotel[] arr = new MVHotel[hotelMaterialsNew.Count];
            hotelMaterialsNew.CopyTo(arr);
            hotelMaterials.AddRange(arr);
            hotelMaterialsNew = new List<MVHotel>();
        }

        if (hotelMaterials.Count == hotelMaterialsNew.Count)
        {
            hotelMaterialsNew = new List<MVHotel>();
        }

        if (ddlArea.SelectedValue == "NO")
        {
            hotelMaterialsNew = hotelMaterials;
        }
        else
        {
            string strCode = ddlArea.SelectedValue;

            for (int i = 0; i < hotelMaterials.Count; i++)
            {
                if (hotelMaterials[i].HotelInformation.AreaInCity.ToUpper().Trim() == strCode.ToUpper().Trim())
                {
                    hotelMaterialsNew.Add(hotelMaterials[i]);
                }
            }
        }

        if (hotelMaterialsNew.Count > 0)
        {
            if (ddlSort.SelectedIndex == 0)
            {
                MagesticPicksSort(ref hotelMaterialsNew);
            }
            if (ddlSort.SelectedIndex == 1)
            {
                hotelMaterialsNew.Sort(delegate(MVHotel r1, MVHotel r2) { return r1.RoomPricePerNight.CompareTo(r2.RoomPricePerNight); });
            }
            if (ddlSort.SelectedIndex == 2)
            {
                hotelMaterialsNew.Sort(delegate(MVHotel r1, MVHotel r2) { return r1.HotelInformation.Name.CompareTo(r2.HotelInformation.Name); });
            }
            if (ddlSort.SelectedIndex == 3)
            {
                hotelMaterialsNew.Sort(delegate(MVHotel r1, MVHotel r2) { return r1.HotelInformation.Class.CompareTo(r2.HotelInformation.Class); });
            }
        }
    }