private void Button_Clicked(object sender, EventArgs e)
        {
            var sortColumn = _selectedSortColumn.CloneJson();

            sortColumn.Ascending = _isAscending;
            _filter.SortColumn   = sortColumn;
            SearchCommand?.Execute(_filter);
        }
        private async Task Refresh(SalesInquiryContext filter, SortColumnItem sortColumnItem = null)
        {
            try
            {
                IsBusy = true;
                if (sortColumnItem == null)
                {
                    _sortColumn = new SortColumnItem(PipelineSortColumn.Plant, null)
                    {
                        Ascending = true
                    };
                }
                else
                {
                    _sortColumn = sortColumnItem.CloneJson();
                }
                IEnumerable <SalesQuotationInquiry> lines;
                if (_forceRefresh || IsFilterDifferentFromLast(filter))
                {
                    var result = await Api.GetSalesQuotationInquiry(filter);

                    if (!result.Successful.GetValueOrDefault() &&
                        !string.IsNullOrEmpty(result.ExceptionMessage))
                    {
                        await Alert.DisplayApiCallError(result.ExceptionMessage, result.ValidationErrors);

                        NoResults = true;
                        return;
                    }

                    lines           = result.Data.ToList();
                    _previousFilter = filter;
                }
                else
                {
                    lines = _pipelineList;
                }


                var sortedLines = SortList(_sortColumn, lines.ToList())
                                  .ToList();

                PipelineList = new ObservableCollection <SalesQuotationInquiry>(sortedLines);
                NoResults    = !_pipelineList.Any();
                ListHeight   = _pipelineList.Count * 80;
            }
            catch (Exception ex)
            {
                await Alert.DisplayError(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Пример #3
0
 public UserFilter ToFilter()
 {
     return(new UserFilter
     {
         FirstName = _firstName,
         LastName = _lastName,
         Email = _email,
         IsAscending = _isAscending,
         SelectedRoleKey = _selectedRole.Key,
         SelectedStatus = _selectedStatus,
         SortColumnItem = _selectedSortColumn.CloneJson(),
         IsDefaultRole = _roleList.IndexOf(_selectedRole) < 0,
         IsDefaultStatus = _statusList.IndexOf(_selectedStatus) < 1,
         Phone = _phone,
         Language = _selectedLanguage.Key
     });
 }