/// <summary>
        /// Gets the user's name, provided with an ID.
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public string GetUserName(string userId)
        {
            string commandText = "SELECT \"UserName\" FROM \"AspNetUsers\" WHERE \"Id\" = @id";
            Dictionary <string, object> parameters = new Dictionary <string, object>()
            {
                { "@id", userId }
            };

            return(_database.GetStrValue(commandText, parameters));
        }
예제 #2
0
        /// <summary>
        /// Gets the user's name, provided with an ID.
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public string GetUserName(string userId)
        {
            string commandText = "SELECT " + fieldUserName.Quoted() + " FROM " + fullTableName + " WHERE " + fieldID.Quoted() + " = @id";
            Dictionary <string, object> parameters = new Dictionary <string, object>()
            {
                { "@id", userId }
            };

            return(_database.GetStrValue(commandText, parameters));
        }
예제 #3
0
파일: RoleTable.cs 프로젝트: hsudas/flexi
        /// <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 AspNetRoles WHERE Id = @id";
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("@id", roleId);

            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 " + fieldName.Quoted() + " FROM " + fullTableName + " WHERE " + fieldId.Quoted() + " = @id";
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("@id", roleId);

            return(_database.GetStrValue(commandText, parameters));
        }
        /// <summary>
        /// Return a user ID 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 \"AspNetUserLogins\" 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));
        }
        /// <summary>
        /// Return a user ID 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 " + fielduserID.Quoted() + " FROM " + fullTableName + " WHERE " + fieldLoginProvider.Quoted() + " = @loginProvider AND " + fieldProviderKey.Quoted() + " = @providerKey";
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("loginProvider", userLogin.LoginProvider);
            parameters.Add("providerKey", userLogin.ProviderKey);

            return(_database.GetStrValue(commandText, parameters));
        }