protected override async Task OnInitializedAsync() { SheredAccountSevice = ScopedServices.GetRequiredService <ISharedAccountService>(); EmployeeService = ScopedServices.GetRequiredService <IEmployeeService>(); RemoteDeviceConnectionsService = ScopedServices.GetRequiredService <IRemoteDeviceConnectionsService>(); var count = await SheredAccountSevice.GetSharedAccountsCountAsync(new DataLoadingOptions <SharedAccountsFilter>()); SharedAccounts = await SheredAccountSevice.GetSharedAccountsAsync(new DataLoadingOptions <SharedAccountsFilter> { Take = count, SortedColumn = nameof(Employee.FullName), SortDirection = ListSortDirection.Ascending }); SelectedSharedAccount = SharedAccounts.FirstOrDefault(); }
protected override async Task OnInitializedAsync() { try { EmployeeService = ScopedServices.GetRequiredService <IEmployeeService>(); HardwareVaultService = ScopedServices.GetRequiredService <IHardwareVaultService>(); OrgStructureService = ScopedServices.GetRequiredService <IOrgStructureService>(); SharedAccountService = ScopedServices.GetRequiredService <ISharedAccountService>(); RemoteDeviceConnectionsService = ScopedServices.GetRequiredService <IRemoteDeviceConnectionsService>(); Companies = await OrgStructureService.GetCompaniesAsync(); Departments = new List <Department>(); Positions = await OrgStructureService.GetPositionsAsync(); SharedAccounts = await SharedAccountService.GetAllSharedAccountsAsync(); SharedAccountId = SharedAccounts.FirstOrDefault()?.Id; await LoadHardwareVaultsAsync(); Employee = new Employee() { Id = Guid.NewGuid().ToString() }; EmployeeContext = new EditContext(Employee); PersonalAccount = new AccountAddModel { EmployeeId = Employee.Id, LoginType = LoginType.Local }; PersonalAccountContext = new EditContext(PersonalAccount); SetInitialized(); } catch (Exception ex) { Logger.LogError(ex.Message); SetLoadFailed(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogService.CloseAsync(); } }