示例#1
0
        /// <summary>
        /// Returns an TUser given the user's id.
        /// </summary>
        /// <param name="userId">The user's id.</param>
        /// <returns></returns>
        public IdentityUser GetUserById(Guid userId)
        {
            string commandText = "SELECT * FROM " + fullTableName + " WHERE " + FieldId.Quoted() + " = @id";
            Dictionary <string, object> parameters = new Dictionary <string, object>()
            {
                { "@id", userId }
            };

            var row = _database.Query(commandText, parameters);

            return(loadUser(GenericHelpers.AddToDictionary(row)));
        }
示例#2
0
        public Profiles GetProfileByUserId(string userId)
        {
            string commandText = "SELECT * FROM " + fullTableName + " WHERE " + FieldUserId.Quoted() + " = @userid";
            Dictionary <string, object> parameters = new Dictionary <string, object>()
            {
                { "@userid", userId }
            };

            var row = _database.Query(commandText, parameters);

            return(loadProfile(GenericHelpers.AddToDictionary(row)));
        }
示例#3
0
        public LoginCounts GetLoginCountById(string userId)
        {
            string commandText = "SELECT * FROM " + fullTableName + " WHERE " + FieldUserId.Quoted() + " = @id";
            Dictionary <string, object> parameters = new Dictionary <string, object>()
            {
                { "@id", userId }
            };

            var row = _database.Query(commandText, parameters);//.ExecuteQueryGetSingleRow

            return(loadLoginCount(GenericHelpers.AddToDictionary(row)));
        }
示例#4
0
        /// <summary>
        /// Returns a list of TUser instances given a user name.
        /// </summary>
        /// <param name="userName">User's name.</param>
        /// <returns></returns>
        public IdentityUser GetUserByUserName(string userName)
        {
            if (userName != null)
            {
                userName = userName.ToLower();
            }
            //take in email field
            string commandText = "SELECT *  FROM " + fullTableName + " WHERE lower(" + FieldEmail.Quoted() + ") = @name";
            Dictionary <string, object> parameters = new Dictionary <string, object>()
            {
                { "@name", userName }
            };

            var row = _database.Query(commandText, parameters);

            return(loadUser(GenericHelpers.AddToDictionary(row)));
        }
示例#5
0
        /// <summary>
        /// Returns a list of TUser instances given a user email.
        /// </summary>
        /// <param name="email">User's email address.</param>
        /// <returns></returns>
        public IdentityUser GetUserByEmail(string email)
        {
            //Due to PostgreSQL's case sensitivity, we have another column for the user name in lowercase.
            if (email != null)
            {
                email = email.ToLower();
            }

            string commandText = "SELECT *  FROM " + fullTableName + " WHERE " + FieldEmail.Quoted() + " = @email";
            Dictionary <string, object> parameters = new Dictionary <string, object>()
            {
                { "@email", email }
            };

            var row = _database.Query(commandText, parameters);

            return(loadUser(GenericHelpers.AddToDictionary(row)));
        }