Exemplo n.º 1
0
        private void OnReadData(DataGridReadDataEventArgs <SearchItem> e)
        {
            var currLang1Id = Const.PlLangId;

            if (_currentLanguage1 is not null)
            {
                currLang1Id = _currentLanguage1.Id;
            }
            var currLang2Id = Const.EnLangId;

            if (_currentLanguage2 is not null)
            {
                currLang2Id = _currentLanguage2.Id;
            }
            if (_currentLanguage3 is not null)
            {
                currLang1Id = _currentLanguage3.Id;
                if (_currentLanguage3.Id == Const.PlLangId)
                {
                    currLang2Id = Const.EnLangId;
                }
                else
                {
                    currLang2Id = _currentLanguage3.Id;
                }
            }


            _searchPageNr = e.Page;
            Dispatcher?.Dispatch(
                new SearchPageNrChangeAction(e.Page.ToString(), searchText: SearchText, baseTermLangId: currLang1Id,
                                             translationLangId: currLang2Id, itemsPerPage: _itemsPerPage, searchPageNr: _searchPageNr, current: _currentTranslations,
                                             noResults: MyText?.NoResults ?? string.Empty,
                                             searchTranslationMessage: MyText?.Loaded ?? string.Empty));
        }
Exemplo n.º 2
0
        private async Task OnDataGridReadAsync(DataGridReadDataEventArgs <GigDto> e)
        {
            CurrentSorting = e.Columns
                             .Where(c => c.Direction != SortDirection.None)
                             .Select(c => c.Field + (c.Direction == SortDirection.Descending ? " DESC" : ""))
                             .JoinAsString(",");
            CurrentPage = e.Page - 1;

            await GetProductsAsync();
            await InvokeAsync(StateHasChanged);
        }
Exemplo n.º 3
0
        private void OnReadData(DataGridReadDataEventArgs <OriinLink> e)
        {
            ReadLocalSettings();
            Dispatcher?.Dispatch(
                new LinksFetchDataAction(
                    searchPageNr: e.Page,
                    itemsPerPage: _itemsPerPage,
                    linkFetchedMessage: MyText?.Loaded ?? string.Empty));

            StateHasChanged();
        }
Exemplo n.º 4
0
        private async Task OnDatagridReadAsync(DataGridReadDataEventArgs <LabelObjectDto> e)
        {
            CurrentSorting = e.Columns
                             .Where(c => c.Direction != SortDirection.None)
                             .Select(c => c.Field + (c.Direction == SortDirection.Descending ? " DESC" : ""))
                             .JoinAsString(",");
            CurrentPage = e.Page;
            await GetLabelObjectsAsync();

            StateHasChanged();
        }
Exemplo n.º 5
0
        protected virtual async Task OnDataGridReadAsync(DataGridReadDataEventArgs <TListViewModel> e)
        {
            CurrentSorting = e.Columns
                             .Where(c => c.Direction != SortDirection.None)
                             .Select(c => c.Field + (c.Direction == SortDirection.Descending ? " DESC" : ""))
                             .JoinAsString(",");
            CurrentPage = e.Page;

            await GetEntitiesAsync();

            StateHasChanged();
        }
Exemplo n.º 6
0
        private void OnReadData(DataGridReadDataEventArgs <User> e)
        {
            if (!_reloadData)
            {
                return;
            }
            ReadLocalSettings();

            Dispatcher?.Dispatch(
                new UsersFetchDataAction(
                    token: _token,
                    searchPageNr: e.Page,
                    itemsPerPage: _itemsPerPage,
                    MyText?.Loaded ?? string.Empty));
        }
Exemplo n.º 7
0
        async Task OnReadData(DataGridReadDataEventArgs <Employee> e)
        {
            await Task.Delay(random.Next(800));

            if (!e.CancellationToken.IsCancellationRequested)
            {
                // this can be call to anything, in this case we're calling a fictional api
                var response = dataModels.Skip((e.Page - 1) * e.PageSize).Take(e.PageSize).ToList();

                employeeList   = new List <Employee>(response); // an actual data for the current page
                totalEmployees = dataModels.Count;              // this is used to tell datagrid how many items are available so that pagination will work

                // always call StateHasChanged!
                await InvokeAsync(StateHasChanged);
            }
        }
Exemplo n.º 8
0
 private void OnReadData(DataGridReadDataEventArgs <Comment> e)
 {
     if (!_reloadData)
     {
         return;
     }
     ReadLocalSettings();
     Dispatcher?.Dispatch(
         new CommentsFetchDataAction(
             _token,
             e.Page,
             _itemsPerPage,
             MyText?.Loaded ?? string.Empty));
     UpdateLocalData();
     _reloadData = false;
 }
Exemplo n.º 9
0
        public override DataGridParameters GetDataGridCurrent(DataGridReadDataEventArgs <ItemCategoryLookupView> inputDataGridReadData, string inputCustomerFilter)
        {
            DataGridParameters _dataGridParameters = new DataGridParameters
            {
                CurrentPage  = inputDataGridReadData.Page,
                PageSize     = inputDataGridReadData.PageSize,
                CustomFilter = inputCustomerFilter
            };

            if (inputDataGridReadData.Columns != null)
            {
                foreach (var col in inputDataGridReadData.Columns)
                {
                    if (col.Direction != Blazorise.SortDirection.None)
                    {
                        if (_dataGridParameters.SortParams == null)
                        {
                            _dataGridParameters.SortParams = new List <SortParam>();
                        }
                        _dataGridParameters.SortParams.Add(new SortParam
                        {
                            FieldName = col.Field,
                            Direction = col.Direction
                        });
                    }
                    if (!string.IsNullOrEmpty(col.SearchValue))
                    {
                        if (_dataGridParameters.FilterParams == null)
                        {
                            _dataGridParameters.FilterParams = new List <FilterParam>();
                        }
                        _dataGridParameters.FilterParams.Add(new FilterParam
                        {
                            FieldName = col.Field,
                            FilterBy  = col.SearchValue
                        });
                    }
                }
            }
            return(_dataGridParameters);
        }
Exemplo n.º 10
0
        public async Task HandleReadDataAsync(DataGridReadDataEventArgs <ItemAttributeLookupView> inputDataGridReadData)
        {
            if (IsLoading)
            {
                return;
            }
            IsLoading = true;
            //
            try
            {
                if (!inputDataGridReadData.CancellationToken.IsCancellationRequested)
                {
                    DataGridParameters _dataGridParameters = _AttributeWooLinkedViewRepository.GetDataGridCurrent(inputDataGridReadData, _GridSettings.CustomFilterValue);
                    if (_GridSettings.PageSize != inputDataGridReadData.PageSize)
                    {                                                                    /// page sized changed so jump back to original page
                        _GridSettings.CurrentPage = _dataGridParameters.CurrentPage = 1; // force this
                        _GridSettings.PageSize    = inputDataGridReadData.PageSize;
                        //                  await Reload();
                    }
                    await SetLoadStatus("Checking Woo status & loading Attributes");
                    await SetLoadStatus("Checking Woo status");

                    _GridSettings.WooIsActive = await _AttributeWooLinkedViewRepository.WooIsActiveAsync(_AppState);
                    await SetLoadStatus("Loading Attributes");
                    await LoadItemAttributeLookupList(_dataGridParameters);

                    _Status = string.Empty;
                }
            }
            catch (Exception ex)
            {
                _Logger.LogError($"Error running async tasks: {ex.Message}");
                throw;
            }
            finally
            {
                IsLoading = false;
            }
        }
Exemplo n.º 11
0
 protected override async Task OnDataGridReadAsync(DataGridReadDataEventArgs <TipoCambioDto> e)
 {
     CurrentSorting = "Fecha DESC";
     CurrentPage    = e.Page;
     await GetEntitiesAsync();
 }
Exemplo n.º 12
0
 public virtual DataGridParameters GetDataGridCurrent(DataGridReadDataEventArgs <TEntityView> inputDataGridReadData, string inputCustomerFilter)
 {
     _Logger.LogError($"GetDataGridCurrent for Entity: {inputDataGridReadData.ToString()} not implemented, place holder executed. Please implement.");
     throw new NotImplementedException();
 }