/// <summary> /// Determines the searchType requested by the user from the request. /// </summary> /// <param name="request">the httprequest</param> /// <returns>the searchType specified by the user, OR otherwise</returns> protected virtual FilterInfo.SearchType GetSearchType(HttpRequest request) { if (FilterInfo.ContainsFilterInfo(request)) { return((!string.IsNullOrEmpty(request.Params["searchType"]) && "or".Equals(request.Params["searchType"], StringComparison.CurrentCultureIgnoreCase)) ? FilterInfo.SearchType.OR : FilterInfo.SearchType.AND); } return((!string.IsNullOrEmpty(request.Params["searchType"]) && "and".Equals(request.Params["searchType"], StringComparison.CurrentCultureIgnoreCase)) ? FilterInfo.SearchType.AND : FilterInfo.SearchType.OR); }
/// <summary> /// Creates a FilterInfo instance from the httprequest. /// </summary> /// <param name="request">the httprequest</param> /// <returns>The FilterInfo instance, null if the filterInfo param is not specified.</returns> protected virtual FilterInfo CreateFilter(HttpRequest request) { FilterInfo filterInfo = null; if (FilterInfo.ContainsFilterInfo(request)) { //Paging will be performed on server side if (request.Params["filterInfo"] != null) { string json = request.Params["filterInfo"]; JavaScriptSerializer ser = new JavaScriptSerializer(); ser.RegisterConverters(new JavaScriptConverter[] { new FilterInfoConverter() }); filterInfo = ser.Deserialize <FilterInfo>(json); } else { filterInfo = new FilterInfo(request); } } return(filterInfo); }