private static HotelSearchParameter FillHotelSearchParameter(NameValue[] formVars) { List<int> ddlAccomodationTypesList = new List<int>(); List<int> goodForPersonList = new List<int>(); string accomodationTypeValues = HttpUtility.HtmlEncode(formVars.Form("ddlAccomodationType")); string goodForPersonValues = HttpUtility.HtmlEncode(formVars.Form("ddlGoodForPerson")); if (accomodationTypeValues != Constants.JSONNullElementValue) { foreach (string str in accomodationTypeValues.Split(',')) ddlAccomodationTypesList.Add(int.Parse(str)); } if (goodForPersonValues != Constants.JSONNullElementValue) { foreach (string str in goodForPersonValues.Split(',')) goodForPersonList.Add(int.Parse(str)); } int? id = null; int? districtId = null; int? countryId = null; int? cityId = null; int? distanceToBeach = null; int? starRating = null; int? maxPeople = null; float? minPrice = null; float? maxPrice = null; int currencyId = 1; try { currencyId = int.Parse(HttpUtility.HtmlEncode(formVars.Form("ddlCurrency"))); } catch { } try { id = int.Parse(HttpUtility.HtmlEncode(formVars.Form("txtHotelId"))); } catch { } try { districtId = int.Parse(HttpUtility.HtmlEncode(formVars.Form("ddlDistrict"))); } catch { } try { countryId = int.Parse(HttpUtility.HtmlEncode(formVars.Form("ddlCountry"))); } catch { } try { cityId = int.Parse(HttpUtility.HtmlEncode(formVars.Form("ddlCity"))); } catch { } try { distanceToBeach = int.Parse(HttpUtility.HtmlEncode(formVars.Form("ddlDistanceToSea"))); } catch { } try { starRating = int.Parse(HttpUtility.HtmlEncode(formVars.Form("hdnStarRatingChoice"))); } catch { } try { minPrice = float.Parse(HttpUtility.HtmlEncode(formVars.Form("txtPriceStart"))); } catch { } try { maxPrice = float.Parse(HttpUtility.HtmlEncode(formVars.Form("txtPriceEnd"))); } catch { } HotelSearchParameter param = new HotelSearchParameter(id , HttpUtility.HtmlEncode(formVars.Form("txtHotelName")) , districtId.HasValue ? (districtId.Value == -1 ? null : districtId) : null , countryId.HasValue ? (countryId.Value == -1 ? null : countryId) : null , cityId.HasValue ? (cityId.Value == -1 ? null : cityId) : null , distanceToBeach.HasValue ? (distanceToBeach.Value == -1 ? null : distanceToBeach) : null , starRating.HasValue ? (starRating.Value == -1 ? null : starRating) : null , maxPeople, minPrice, maxPrice , ddlAccomodationTypesList, goodForPersonList, currencyId); return param; }
public string GetHotelSearchResult(string formVars) { List<string> formArgs = UIHelper.SplitByString(formVars, "||").ToList(); List<NameValue> formItems = new List<NameValue>(); NameValue[] array = new NameValue[formArgs.Count()]; foreach (string arg in formArgs) { if (!string.IsNullOrEmpty(arg)) { string[] item = UIHelper.SplitByString(arg, "__").ToArray(); if (item[1] != null) formItems.Add(new NameValue(item[0], HttpUtility.UrlDecode(item[1]))); } } return GridHotelSearchResult.GetGridHotelSearchGridHTML(FillHotelSearchParameter((NameValue[])(formItems.ToArray<NameValue>()))); }
public string GetHotelSearchResult(NameValue[] formVars) { return GridHotelSearchResult.GetGridHotelSearchGridHTML(FillHotelSearchParameter(formVars)); }