Example #1
0
        /// <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((string)_database.ExecuteQueryGetSingleObject(commandText, parameters));
        }
        /// <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((string)_database.ExecuteQueryGetSingleObject(commandText, parameters));
        }
Example #3
0
        /// <summary>
        /// Return a user ID given a user's login.
        /// </summary>
        /// <param name="userLogin">The user's login info.</param>
        /// <returns></returns>
        public Guid 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(new Guid((string)_database.ExecuteQueryGetSingleObject(commandText, parameters)));
        }