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

            return(PartialView(result));
        }
Esempio n. 2
0
        public async Task <PersonAlertCommentSearchModel> GetPersonAlertComments(PersonAlertCommentSearchModel model)
        {
            var url    = ODataApiUri + "/PersonAlertComment?" + 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.PersonAlertCommentSearchResult.Clear();
            model.PersonAlertCommentSearchResult.AddRange(result.Items.Select(item => JsonConvert.DeserializeObject <PersonAlertCommentDto>(item.ToString())));
            return(model);
        }
Esempio n. 3
0
        private string GetFilterString(PersonAlertCommentSearchModel searchModel)
        {
            var filterString = ODataFilterConstant.Expand + $"PersonAlert";

            if (searchModel.PersonAlertId > 0)
            {
                filterString += ODataFilterConstant.Filter + $"PersonAlertId eq {searchModel.PersonAlertId}";
            }
            if (!string.IsNullOrWhiteSpace(searchModel.FilterText))
            {
                if (string.IsNullOrWhiteSpace(filterString))
                {
                    filterString += ODataFilterConstant.Filter + $"contains(Comment,'{searchModel.FilterText}') eq true";
                }
                else
                {
                    filterString += $" or contains(Comment,'{searchModel.FilterText}') eq true";
                }
                filterString += $" or contains(Comment,'{searchModel.FilterText}') eq true";
            }
            AddPageSizeNumberAndSortingInFilterString(searchModel, ref filterString);
            return(filterString);
        }
Esempio n. 4
0
 public async Task <PersonAlertCommentSearchModel> GetPersonAlertComments(PersonAlertCommentSearchModel model)
 {
     return(await _personAlertCommentApiClient.GetPersonAlertComments(model));
 }
Esempio n. 5
0
 private PersonAlertCommentSearchModel InitializeModel(PersonAlertCommentSearchModel model)
 {
     model = InitializeSearchModel(model, "PersonAlertCommentGrid", "RaisedOn", "Desc");
     return(model);
 }