public JsonResult SearchResultsApplyInputFilter() { GridDescriptor request = new GridDescriptor(new SortDescriptor() { PropertyName = "Name", Order = SortOrder.Ascending }); BaseSearchModel model = new BaseSearchModel(); SearchFilters filters = new SearchFilters(); IDictionary <string, object> allFilters = BreadcrumbNavigationGetSet(filters, null); filters = (SearchFilters)(allFilters["filters"]); if (allFilters.ContainsKey("advFilters")) { model = SearchResults(filters, "", (AdvSearchFiltersAll)allFilters["advFilters"], request); } else { model = SearchResults(filters, "", null, request); } SearchResultsCondition filterModel = GetFiltersModel(filters); model.Filter = filterModel; return(Json(ResponseStatus.Success, RenderPartialViewToString("ResultsContainer", model), JsonRequestBehavior.AllowGet)); }
public ActionResult AdvStructureSearch(string query, string exactsearch, string stereo, GridDescriptor request) { System.Web.HttpContext.Current.Session["AdvancedSearchFilter"] = null; var tmp = BreadcrumbNavigationGetSet(); AdvSearchFiltersAll filters = new AdvSearchFiltersAll(); if (filters.StructureSearch == null) { filters.StructureSearch = new AdvStructureSearch(); } filters.StructureSearch.Query = query; filters.StructureSearch.Exactsearch = exactsearch; filters.StructureSearch.Stereo = stereo; filters = BreadcrumbNavigationGetSet(filters); StringBuilder sb = new StringBuilder(524288); byte[] bytesData = Encoding.ASCII.GetBytes("query=" + query + ";exactsearch=" + exactsearch + ";stereo=" + stereo + "\0"); int result = StructureSearch(bytesData, sb, sb.Capacity); string recordIds = sb.Replace(";", ",").ToString().Trim().TrimEnd(','); ViewBag.ErrorMsg = "result: " + result + "sb: " + sb; BaseSearchModel model = new BaseSearchModel(); model.IsStructureSearch = true; if (request.Pager == null) { request = new GridDescriptor(new SortDescriptor() { PropertyName = "Name", Order = SortOrder.Ascending }); } model.Descriptor = request; //kada proradi raskomentarisati if (!string.IsNullOrEmpty(recordIds) && result > 0) { model.ListOfMaterials = _searchResultsBinder.GetResultsStructureAdvSearch(recordIds, request, materialContextUow); } SearchResultsCondition filterModel = new SearchResultsCondition(); filterModel.FullText = ""; filterModel.ShowPropertiesFilters = false; filterModel.FromBrowse = false; filterModel.FromAdvanced = true; model.Filter = filterModel; ModelState.Clear(); return(View("AdvSearchResults", model)); }
public ActionResult GetFiltersResizable(SearchFilters filters) { var sources = materialContextUow.Sources.AllAsNoTracking.ToList(); SearchResultsCondition model = new SearchResultsCondition(); model.FullText = ""; model.Sources = sources; model.ClassificationTypes = materialContextUow.Trees.GetFullTreeFor(); model.PropertyGroups = materialContextUow.Trees.GetFullPropertyGroups(0); model.ClasificationId = filters.ClasificationId; model.ClasificationTypeId = filters.ClasificationTypeId; model.ShowPropertiesFilters = true; return(PartialView("FiltersResizable", model)); }
public ActionResult BrowseSearch(SearchFilters filters) { BaseSearchModel model = new BaseSearchModel(); filters = (SearchFilters)((IDictionary <string, object>)BreadcrumbNavigationGetSet(filters, null, true))["filters"]; model = SearchResults(filters, "", null); SearchResultsCondition filterModel = new SearchResultsCondition(); filterModel.ClasificationId = filters.ClasificationId; filterModel.ClasificationTypeId = filters.ClasificationTypeId; filterModel.ShowPropertiesFilters = false; filterModel.FromBrowse = filters.FromBrowse; filterModel.SelectedSource = filters.Source; model.Filter = filterModel; return(View("BrowseSearch", model)); }
public JsonResult GetFilters(SearchFilters filters) { SearchResultsCondition filterModel = GetFiltersModel(filters); IDictionary <string, object> allFilters = BreadcrumbNavigationGetSet(filters, null); AdvSearchFiltersAll advFilters = new AdvSearchFiltersAll(); if (allFilters.ContainsKey("advFilters")) { advFilters = (AdvSearchFiltersAll)allFilters["advFilters"]; } IList <PropertyUnitModel> units = new List <PropertyUnitModel>(); if (advFilters != null && advFilters.AllFilters != null) { foreach (var item in advFilters.AllFilters) { var pUnits = materialContextUow.PropertyUnits.AllAsNoTracking.Where(n => n.PropertyID == item.propertyId).ToList(); PropertyUnitModel pum = new PropertyUnitModel() { PropertyType = item.propertyType, UniqueID = Guid.NewGuid().ToString("N"), PropertyID = item.propertyId, PropertyName = item.propertyName, Units = new List <UnitModel>() }; foreach (var u in pUnits.Where(i => i.UnitKey != null)) { pum.Units.Add(new UnitModel() { Factor = (double)u.Factor, Metric = (bool)u.Metric, Offset = (double)u.Offset, UnitKey = (int)u.UnitKey, UnitLabel = u.UnitLabel }); } pum.SelectedUnit = item.unitId; pum.SelectedBinary = item.binaryOperators; pum.SelectedLogical = item.logicalOperators; pum.ValueFrom = item.valueFrom_orig == null ? "" : item.valueFrom_orig.ToString(); pum.ValueTo = item.valueTo_orig == null ? "" : item.valueTo_orig.ToString(); units.Add(pum); } } return(Json(ResponseStatus.Success, new { showTitle = units.Count > 0 ? true : false, dataSearch = RenderPartialViewToString("FiltersContainerAdvProp", filterModel), dataAdv = RenderPartialViewToString("SearchConditionItemContainer", units) }, JsonRequestBehavior.AllowGet)); }
public JsonResult ApplyFilters(SearchFilters filters, AdvSearchFiltersAll advFilters, string classIds, int reset = 0) { if (classIds == "") { Session["ClassificationIds"] = ""; } BaseSearchModel model = new BaseSearchModel(); IDictionary <string, object> allFilters = BreadcrumbNavigationGetSet(filters, advFilters, false, classIds); filters = (SearchFilters)allFilters["filters"]; advFilters = (AdvSearchFiltersAll)allFilters["advFilters"]; if (reset == 1) { Session["ClassificationIds"] = ""; advFilters = null; classIds = ""; } model = SearchResults(filters, classIds, advFilters); SearchResultsCondition filterModel = new SearchResultsCondition(); filterModel.ClasificationId = filters.ClasificationId; filterModel.ClasificationTypeId = filters.ClasificationTypeId; filterModel.PropertyClasificationId = filters.PropertyClasificationId; filterModel.PropertyClasificationTypeId = filters.PropertyClasificationTypeId; filterModel.FullText = filters.filter; filterModel.ShowPropertiesFilters = false; filterModel.FromBrowse = filters.FromBrowse; filterModel.SelectedSource = filters.Source; model.Filter = filterModel; System.Web.HttpContext.Current.Session["AdvancedSearchFilter"] = advFilters; ModelState.Clear(); return(Json(ResponseStatus.Success, RenderPartialViewToString("ResultsContainer", model))); }
private SearchResultsCondition GetFiltersModel(SearchFilters filters) { var sources = materialContextUow.Sources.AllAsNoTracking.ToList().OrderBy(m => m.Id).ThenBy(n => n.Name).ToList(); SearchResultsCondition model = new SearchResultsCondition(); model.FullText = filters.filter; model.Sources = sources; IList <int> results = (IList <int>)Session["ClassificationRecordsCount"]; //IDictionary<int, int> records = _searchResultsBinder.TreeCount(results, materialContextUow); IDictionary <int, int> records = _searchResultsBinder.TaxonomyTreeCount(results, materialContextUow); model.ClassificationTypes = materialContextUow.Trees.GetFullTreeFor(records); Session["ClassificationTypes"] = model.ClassificationTypes; model.PropertyGroups = materialContextUow.Trees.GetFullPropertyGroups(0); model.ClasificationId = filters.ClasificationId; model.ClasificationTypeId = filters.ClasificationTypeId; model.ShowPropertiesFilters = true; model.SelectedSource = filters.Source; model.FromBrowse = filters.FromBrowse; return(model); }
public JsonResult ApplyPager(GridDescriptor request) { BreadcrumbNavigation nav = (BreadcrumbNavigation)System.Web.HttpContext.Current.Session["Navigation"]; if (nav == null) { nav = new BreadcrumbNavigation(); } AdvSearchFiltersAll filters = new AdvSearchFiltersAll(); AdvancedSearchResults res = nav.GetOrderedItems().Where(n => n.NavigableID == "AdvancedSearchResults").FirstOrDefault() as AdvancedSearchResults; if (res != null) { filters = res.PageData as AdvSearchFiltersAll; } nav.LastNavigable = "AdvancedSearchResults"; System.Web.HttpContext.Current.Session["Navigation"] = nav; BaseSearchModel model = new BaseSearchModel(); if (request.Pager == null) { request = new GridDescriptor(new SortDescriptor() { PropertyName = "Name", Order = SortOrder.Ascending }); } model.Descriptor = request; if (filters.StructureSearch != null) { StringBuilder sb = new StringBuilder(65536); byte[] bytesData = Encoding.ASCII.GetBytes("query=" + filters.StructureSearch.Query + ";exactsearch=" + filters.StructureSearch.Exactsearch + ";stereo=" + filters.StructureSearch.Stereo + "\0"); var result = StructureSearch(bytesData, sb, sb.Capacity); string recordIds = sb.Replace(";", ",").ToString().Trim().TrimEnd(','); if (!string.IsNullOrEmpty(recordIds)) { model.ListOfMaterials = _searchResultsBinder.GetResultsStructureAdvSearch(recordIds, request, materialContextUow); } model.IsStructureSearch = true; } else { model.ListOfMaterials = _searchResultsBinder.GetResultsAdvSearch(filters, request, materialContextUow); } SearchResultsCondition filterModel = new SearchResultsCondition(); //filterModel.ClasificationId = filters.ClasificationId; //filterModel.ClasificationTypeId = filters.ClasificationTypeId; filterModel.FullText = ""; filterModel.ShowPropertiesFilters = false; filterModel.FromBrowse = false; filterModel.FromAdvanced = true; // add Sources to model filterModel.Sources = materialContextUow.Sources.AllAsNoTracking.OrderBy(m => m.Id).ThenBy(n => n.Name).ToList(); filterModel.SelectedSource = filters.SelectedSource; model.Filter = filterModel; //BreadcrumbNavigationGetSet(filters); return(Json(ResponseStatus.Success, RenderPartialViewToString("AdvResultsContainer", model), JsonRequestBehavior.AllowGet)); }