Esempio n. 1
0
        public IActionResult Grid(PersonCaseSearchModel model)
        {
            model = InitializeModel(model);
            var result = _customerFacadeApiClient.GetPersonCases(model).Result;

            return(PartialView(result));
        }
Esempio n. 2
0
        public async Task <PersonCaseSearchModel> GetPersonCases(PersonCaseSearchModel model)
        {
            var url    = ODataApiUri + "/PersonCase?" + GetFilterString(model);
            var result = await GetOdataResultFromApi(url);

            var searchResultCount = 0;

            if (result.Count != null)
            {
                int.TryParse(result.Count.ToString(), out searchResultCount);
            }
            model.TotalRows = searchResultCount;
            model.PersonCaseSearchResult.Clear();
            try
            {
                model.PersonCaseSearchResult.AddRange(result.Items.Select(item => JsonConvert.DeserializeObject <PersonCaseDto>(item.ToString())));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

            return(model);
        }
Esempio n. 3
0
 public IActionResult PersonCase(PersonCaseSearchModel model)
 {
     model = InitializePersonCaseModel(model);
     if (Request.IsAjaxRequest())
     {
         model = _customerApiClient.GetPersonCases(model).Result;
         return(PartialView("PersonCase", model));
     }
     return(View(model));
 }
Esempio n. 4
0
        private string GetFilterString(PersonCaseSearchModel searchModel)
        {
            var filterString = ODataFilterConstant.Expand + $"Person";

            if (searchModel.PersonId > 0)
            {
                filterString += ODataFilterConstant.Filter + $"PersonId eq {searchModel.PersonId}";
            }
            if (!string.IsNullOrWhiteSpace(searchModel.FilterText))
            {
                if (string.IsNullOrWhiteSpace(filterString))
                {
                    filterString += ODataFilterConstant.Filter + $"contains(Person/Forename,'{searchModel.FilterText}') eq true";
                }
                else
                {
                    filterString += $" or contains(Person/Forename,'{searchModel.FilterText}') eq true";
                }
                filterString += $" or contains(Person/Surname,'{searchModel.FilterText}') eq true";
                filterString += $" or contains(Details,'{searchModel.FilterText}') eq true";
            }
            AddPageSizeNumberAndSortingInFilterString(searchModel, ref filterString);
            return(filterString);
        }
Esempio n. 5
0
 private PersonCaseSearchModel InitializeModel(PersonCaseSearchModel model)
 {
     model = InitializeSearchModel(model, "PersonCaseGrid", "RaisedOn", "Desc");
     return(model);
 }
Esempio n. 6
0
 public async Task <PersonCaseSearchModel> GetPersonCases(PersonCaseSearchModel model)
 {
     return(await _personCaseApiClient.GetPersonCases(model));
 }