/// <summary> /// Creator: Mitchell Paul /// Created: 2/16/2021 /// Approver: /// /// Manager method to Update the User Account while also implementing Reactivate and Deactivate user account if /// those options are chosen through the edit interface. /// </summary> /// <remarks> /// Updater: /// Updated: /// Update: /// </remarks> public bool UpdateUserAccount(UserAccount oldUserAccount, UserAccount newUserAccount) { bool result = false; try { result = (1 == _userAccessor.UpdateUserAccount(oldUserAccount, newUserAccount)); if (result == false) { throw new ApplicationException("Data not updated."); } if (oldUserAccount.Active != newUserAccount.Active) { if (newUserAccount.Active) { _userAccessor.ReactivateUserAccount(oldUserAccount.UserAccountID); } else { if (_userAccessor.DeactivateUserAccount(oldUserAccount.UserAccountID) != 1) { throw new ApplicationException("The user could not be deactivated."); } } } } catch (Exception ex) { throw new ApplicationException("User Account not updated.", ex); } return(result); }