示例#1
0
        private async Task <bool> VerifyAdUserAsync()
        {
            try
            {
                await LdapService.VerifyAdUserAsync(Employee);

                return(true);
            }
            catch (HESException ex) when(ex.Code == HESCode.ActiveDirectoryUserNotFound)
            {
                await EmployeeService.RemoveFromHideezKeyOwnersAsync(Employee.Id);

                Employee = await EmployeeService.GetEmployeeByIdAsync(EmployeeId, asNoTracking : true);

                await ToastService.ShowToastAsync(ex.Message, ToastType.Notify);

                return(false);
            }
            catch (LdapException ex) when(ex.ResultCode == (LdapForNet.Native.Native.ResultCode) 81)
            {
                await ToastService.ShowToastAsync("The LDAP server is unavailable.", ToastType.Error);

                return(false);
            }
            catch (Exception ex)
            {
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                return(false);
            }
        }