Пример #1
0
        private async Task LoadDataAsync()
        {
            var filter = new HardwareVaultFilter()
            {
                Status = VaultStatus.Ready
            };

            TotalRecords = await HardwareVaultService.GetVaultsCountAsync(new DataLoadingOptions <HardwareVaultFilter>
            {
                SearchText = SearchText,
                Filter     = filter
            });

            HardwareVaults = await HardwareVaultService.GetVaultsAsync(new DataLoadingOptions <HardwareVaultFilter>
            {
                Take          = TotalRecords,
                SortedColumn  = nameof(HardwareVault.Id),
                SortDirection = ListSortDirection.Ascending,
                SearchText    = SearchText,
                Filter        = filter
            });

            SelectedHardwareVault = null;
            StateHasChanged();
        }
Пример #2
0
        private async Task LoadDataAsync()
        {
            var filter = new HardwareVaultFilter()
            {
                Status = VaultStatus.Active
            };

            TotalRecords = await HardwareVaultService.GetVaultsCountAsync(new DataLoadingOptions <HardwareVaultFilter>
            {
                SearchText = SearchText,
                Filter     = filter
            });

            HardwareVaults = await HardwareVaultService.GetVaultsAsync(new DataLoadingOptions <HardwareVaultFilter>
            {
                Take          = TotalRecords,
                SortedColumn  = nameof(HardwareVault.Id),
                SortDirection = ListSortDirection.Ascending,
                SearchText    = SearchText,
                Filter        = filter
            });

            var count = await WorkstationService.GetProximityVaultsCountAsync(new DataLoadingOptions <WorkstationDetailsFilter>() { EntityId = WorkstationId });

            var proximityVaultFilter = new DataLoadingOptions <WorkstationDetailsFilter>()
            {
                Take          = count,
                SortedColumn  = nameof(WorkstationProximityVault.HardwareVaultId),
                SortDirection = ListSortDirection.Ascending,
                EntityId      = WorkstationId
            };
            var proximityVaults = await WorkstationService.GetProximityVaultsAsync(proximityVaultFilter);

            AlreadyAdded = proximityVaults.Count > 0;

            HardwareVaults        = HardwareVaults.Where(x => !proximityVaults.Select(s => s.HardwareVaultId).Contains(x.Id)).ToList();
            SelectedHardwareVault = null;
            StateHasChanged();
        }