private void Service_ValidateStaffCompleted(object sender, ValidateStaffCompletedEventArgs e) { try { Fault = e.fault; if (e.Result != null) { LoggedInUser = e.Result.Staff; } if (UserValidationCompleted != null) { UserValidationCompleted(this, e); } } catch (Exception) { throw; } }
private void UserLoginValidationCompletedHelper(EventArgs e) { try { dispatcher.BeginInvoke(() => { IsProcessing = false; ValidateStaffCompletedEventArgs args = (ValidateStaffCompletedEventArgs)e; if (args.fault != null) { Utility.DisplayMessage(args.fault.Message); return; } if (loginService.LoggedInUser == null || loginService.LoggedInUser.Id == null) { Utility.DisplayMessage("Invalid user name or password!"); return; } else if (Period == null || Period.Id <= 0) { Utility.DisplayMessage("No appraisal period found! Please try again"); return; } else if (HasAppraisalPeriodExpired() && !loginService.LoggedInUser.IsAdmin) { return; } else if (loginService.LoggedInUser.IsAdmin == false && loginService.LoggedInUser.IsActive == false) { Utility.DisplayMessage("Your Login Acount is not active! Please contact your HR department"); return; } LoginDetail = args.Result; if (LoginDetail != null) { Utility.LoggedInUser = LoginDetail.Staff; Staff = LoginDetail.Staff; if (LoginDetail.IsFirstLogon && Staff.IsAdmin == false) { PopUp.Show(); } else { if (UserAccountIsActive(LoginDetail.IsActivated, LoginDetail.IsLocked)) { Login(); } } //Login(); } }); } catch (Exception ex) { Utility.DisplayMessage(ex.Message); } }