private async Task DisableAlarmAsync() { try { var checkPassword = await UserManager.CheckPasswordAsync(ApplicationUser, UserConfirmPassword); if (!checkPassword) { throw new Exception("Invalid password"); } await RemoteWorkstationConnections.UnlockAllWorkstationsAsync(ApplicationUser.Email); await SynchronizationService.UpdateAlarm(ExceptPageId); await CallBack.InvokeAsync(this); await ToastService.ShowToastAsync("All workstations are unlocked.", ToastType.Success); await ModalDialogService.CloseAsync(); } catch (Exception ex) { Logger.LogError(ex.Message, ex); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogService.CancelAsync(); } }
private async Task EnableAlarmAsync() { try { await RemoteWorkstationConnections.LockAllWorkstationsAsync(CurrentUserEmail); await ToastService.ShowToastAsync("All workstations are locked.", ToastType.Success); await ModalDialogClose(); } catch (Exception ex) { Logger.LogError(ex.Message, ex); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogCancel(); } }
private async Task DisableAlarmAsync() { try { var checkPassword = await UserManager.CheckPasswordAsync(ApplicationUser, UserConfirmPassword); if (!checkPassword) { throw new HESException(HESCode.IncorrectCurrentPassword); } await RemoteWorkstationConnections.UnlockAllWorkstationsAsync(ApplicationUser.Email); await ToastService.ShowToastAsync("All workstations are unlocked.", ToastType.Success); await ModalDialogClose(); } catch (Exception ex) { Logger.LogError(ex.Message, ex); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogCancel(); } }
private async Task EnableAlarmAsync() { try { RemoteWorkstationConnections = ScopedServices.GetRequiredService <IRemoteWorkstationConnectionsService>(); string userEmail = null; try { userEmail = (await AuthenticationStateTask).User.Identity.Name; } catch (Exception ex) { Logger.LogError(ex.Message); } finally { await RemoteWorkstationConnections.LockAllWorkstationsAsync(userEmail); } await SynchronizationService.UpdateAlarm(ExceptPageId); await CallBack.InvokeAsync(this); await ToastService.ShowToastAsync("All workstations are locked.", ToastType.Success); await ModalDialogService.CloseAsync(); } catch (Exception ex) { Logger.LogError(ex.Message, ex); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogService.CancelAsync(); } }