/// <summary> /// Returns the user's name given a user id /// </summary> /// <param name="userId"></param> /// <returns></returns> public string GetUserName(string userId) { string commandText = "Select Name from Users where Id = @id"; Dictionary <string, object> parameters = new Dictionary <string, object>() { { "@id", userId } }; return(_database.GetStrValue(commandText, parameters)); }
/// <summary> /// Returns a role name given the roleId /// </summary> /// <param name="roleId">The role Id</param> /// <returns>Role name</returns> public string GetRoleName(string roleId) { string commandText = "Select Name from Roles where Id = @id"; Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("@id", roleId); return(_database.GetStrValue(commandText, parameters)); }
/// <summary> /// Return a userId given a user's login /// </summary> /// <param name="userLogin">The user's login info</param> /// <returns></returns> public string FindUserIdByLogin(UserLoginInfo userLogin) { string commandText = "Select UserId from UserLogins where LoginProvider = @loginProvider and ProviderKey = @providerKey"; Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("loginProvider", userLogin.LoginProvider); parameters.Add("providerKey", userLogin.ProviderKey); return(_database.GetStrValue(commandText, parameters)); }