Example #1
0
 private int GetCurrentCompanyId()
 {
     var userID = AccountHelper.currentUser.ID;
     UserManager userManager = new UserManager();
     var user = userManager.GetUserById(userID);
     return (int)user.CompanyId;
 }
 //
 // Summary:
 //     Verifies that the specified user name and password exist in the data source.
 //
 // Parameters:
 //   username:
 //     The name of the user to validate.
 //
 //   password:
 //     The password for the specified user.
 //
 // Returns:
 //     true if the specified username and password are valid; otherwise, false.
 public override bool ValidateUser(string username, string password)
 {
     using (var AccountRepository = new UserManager())
     {
         return AccountRepository.IsValidLogin(username, password);
     }
 }
 //
 // Summary:
 //     Clears a lock so that the membership user can be validated.
 //
 // Parameters:
 //   userName:
 //     The membership user whose lock status you want to clear.
 //
 // Returns:
 //     true if the membership user was successfully unlocked; otherwise, false.
 public override bool UnlockUser(string userName)
 {
     using (var AccountRepository = new UserManager())
     {
         var res = AccountRepository.UnlockUser(userName);
         if (res.IsError)
             return false;
         else
             return true;
     }
 }