public ActionResult ShowAdvanceFilter(Spartan_Traduction_Concept_TypeAdvanceSearchModel model) { if (ModelState.IsValid) { Session["AdvanceSearch"] = model; return(RedirectToAction("Index")); } ViewBag.Filter = new List <SelectListItem> { new SelectListItem() { Text = Resources.Resources.BeginWith, Value = "1" }, new SelectListItem() { Text = Resources.Resources.EndWith, Value = "2" }, new SelectListItem() { Text = Resources.Resources.Contains, Value = "4" }, new SelectListItem() { Text = Resources.Resources.Exact, Value = "3" }, }; if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } return(View(model)); }
public string GetAdvanceFilter(Spartan_Traduction_Concept_TypeAdvanceSearchModel filter) { var where = ""; if (!string.IsNullOrEmpty(filter.FromIdConcept) || !string.IsNullOrEmpty(filter.ToIdConcept)) { if (!string.IsNullOrEmpty(filter.FromIdConcept)) { where += " AND Spartan_Traduction_Concept_Type.IdConcept >= " + filter.FromIdConcept; } if (!string.IsNullOrEmpty(filter.ToIdConcept)) { where += " AND Spartan_Traduction_Concept_Type.IdConcept <= " + filter.ToIdConcept; } } if (!string.IsNullOrEmpty(filter.Concept_Description)) { switch (filter.Concept_DescriptionFilter) { case Models.Filters.BeginWith: where += " AND Spartan_Traduction_Concept_Type.Concept_Description LIKE '" + filter.Concept_Description + "%'"; break; case Models.Filters.EndWith: where += " AND Spartan_Traduction_Concept_Type.Concept_Description LIKE '%" + filter.Concept_Description + "'"; break; case Models.Filters.Exact: where += " AND Spartan_Traduction_Concept_Type.Concept_Description = '" + filter.Concept_Description + "'"; break; case Models.Filters.Contains: where += " AND Spartan_Traduction_Concept_Type.Concept_Description LIKE '%" + filter.Concept_Description + "%'"; break; } } where = new Regex(Regex.Escape("AND ")).Replace(where, "", 1); return(where); }
public ActionResult ShowAdvanceFilter(string previousFilters = "") { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } var previousFiltersObj = new Spartan_Traduction_Concept_TypeAdvanceSearchModel(); if (previousFilters != "") { previousFiltersObj = (Spartan_Traduction_Concept_TypeAdvanceSearchModel)(Session["AdvanceSearch"] ?? new Spartan_Traduction_Concept_TypeAdvanceSearchModel()); } ViewBag.Filter = new List <SelectListItem> { new SelectListItem() { Text = Resources.Resources.BeginWith, Value = "1" }, new SelectListItem() { Text = Resources.Resources.EndWith, Value = "2" }, new SelectListItem() { Text = Resources.Resources.Contains, Value = "4" }, new SelectListItem() { Text = Resources.Resources.Exact, Value = "3" }, }; return(View(previousFiltersObj)); }