public GetCustomersSearchContext ToFilter() { var filter = new GetCustomersSearchContext { CustomerName = this.AccountName, BranchCode = this.SelectedBranch?.Code, AXCustomerId = this.AccountNumber, PageSize = _selectedQty }; return(filter); }
private async Task Refresh(GetCustomersSearchContext countContext) { lock (_lock) { if (!_loading && HasMoreToLoad) { _loading = true; } else { return; } } try { _countContext = countContext ?? new GetCustomersSearchContext(); if (_currentFilter.Key != null) { _countContext.SortBy = _currentFilter.Key.ToString(); _countContext.IsDescendingSort = !_currentFilter.Ascending; } if (_pageNumber == 0) { IsBusy = true; CustomerList = new ObservableCollection <DynamicCustomer>(); } _countContext.StartPage = _pageNumber; _countContext.PageSize = _pageSize; var result = await Api.GetCustomers(_countContext); if (!result.Successful.GetValueOrDefault()) { await Alert.DisplayApiCallError(result.ExceptionMessage, result.ValidationErrors); } //_pageNumber += 1; CustomerList = new ObservableCollection <DynamicCustomer>(result.Data); } catch (Exception ex) { await Alert.DisplayError(ex); } finally { IsBusy = false; _loading = false; } }
private async Task OnSearch(GetCustomersSearchContext arg) { var countResponse = await Api.GetCustomerCount(arg); if (!countResponse.Successful.GetValueOrDefault()) { await Alert.DisplayApiCallError(countResponse.ExceptionMessage, countResponse.ValidationErrors); } else { customerCount = countResponse.Data.Value; _maxPageNumber = (int)Math.Ceiling(customerCount / (double)_pageSize); } _pageNumber = 0; _pageSize = arg.PageSize ?? 50; _loading = false; ShowFilter = false; await Refresh(arg); }
public async Task Load() { var countContext = new GetCustomersSearchContext { BranchCode = Settings.MyInfo.CurrentUser.SiteBranchCode }; var countResponse = await Api.GetCustomerCount(countContext); if (!countResponse.Successful.GetValueOrDefault()) { await Alert.DisplayApiCallError(countResponse.ExceptionMessage, countResponse.ValidationErrors); return; } customerCount = countResponse.Data.Value; _maxPageNumber = (int)Math.Ceiling(customerCount / (double)_pageSize); _pageNumber = 0; _loading = false; await Refresh(countContext); }
public async Task <ApiResponseOfInt64> GetCustomerCount(GetCustomersSearchContext context) { return(await AXClient.Instance.GetCustomersCountAsync(context).ConfigureAwait(false)); }
public async Task <ApiResponseOfListOfDynamicCustomer> GetCustomers(GetCustomersSearchContext context) { var result = await AXClient.Instance.GetCustomersAsync(context).ConfigureAwait(false); return(result); }