/// <summary> /// Преобразование настроек фильтров к параметрам поиска /// </summary> /// <returns>Параметры для хранимой процедуры поиска</returns> public PersonAccessor.SearchParameters ToSearchParameters() { var searchParams = new PersonAccessor.SearchParameters(); if (PersonWhereSearch.Enable) { searchParams.PersonWhereSearch = PersonWhereSearch.GetValue() ?? 0; } if (PersonHowSearch.Enable) { searchParams.PersonHowSearch = PersonHowSearch.GetValue(); } searchParams.Search = Search.Enable ? Search.GetValue() : String.Empty; if (PersonType.Enable) { searchParams.PersonType = PersonType.GetValue(); } if (Veracity.Enable) { searchParams.PersonCheck = Veracity.GetValue(); } if (BusinessProject.Enable) { searchParams.PersonBProject = BusinessProject.GetValue(); searchParams.PersonSubBProject = BusinessProject.SubBProject? 1 : 0; if (BusinessProject.AllBProject) { searchParams.PersonAllBProject = 1; } } if (PersonArea.Enable) { searchParams.PersonArea = (PersonArea == null ? 0 : PersonArea.GetValue()); } if (PersonOPForma.Enable) { searchParams.PersonOPForma = PersonOPForma.GetValue(); } searchParams.PersonUsers = PersonUsers.Enable ? PersonUsers.GetValue() : String.Empty; searchParams.PersonThemes = PersonThemes.Enable ? PersonThemes.GetValue() : String.Empty; if (PersonThemes.Enable) { searchParams.PersonSubThemes = PersonThemes.Subthemes ? 1 : 0; } if (PersonValidAt.GetValue().Length > 0) { searchParams.PersonValidAtTicks = String2Ticks(PersonValidAt.GetValue()); } return(searchParams); }
public virtual ActionResult Execute(PersonAccessor.SearchParameters parameters) { try { List <Person> persons = Repository.Persons.Search(parameters); return(Json(new { Persons = persons }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Logging.Logger.WriteEx(ex); return(JsonError(ex.Message, ex.ToString(), JsonRequestBehavior.AllowGet)); } }
public virtual JsonResult SearchPersonGridDataRequested(PersonAccessor.SearchParameters parameters, int?execute) { if (parameters.PersonValidAtTicks > 0) { parameters.PersonValidAt = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddTicks(parameters.PersonValidAtTicks); } var gridModel = new SearchResultViewModel(); gridModel.Grid.DataUrl = Url.Action("SearchPersonGridDataRequested"); IQueryable <Person> result; if ((execute ?? 0) > 0 || !String.IsNullOrWhiteSpace(parameters.Search)) { result = Repository.Persons.Search(parameters).AsQueryable(); } else { result = (new List <Person>()).AsQueryable(); } return(gridModel.Grid.DataBind(result)); }