Exemple #1
0
        /**********************************
        *                                *
        *      Register DAO Method       *
        *                                *
        *   Use with form generated User *
        *               obj              *
        *                                *
        *    To Register new User call   *
        *     Register Business Method   *
        *                                *
        **********************************/
        public bool Register(MinesweeperProjectCLC247.Models.UserModel user)
        {
            //create SqlCommand to insert new user into DB
            SqlCommand cmd = new SqlCommand("INSERT INTO dbo.Users(FirstName, LastName, Gender, Age, State, Email, Username, Password) VALUES('" + user.FirstName + "', '" + user.LastName + "', '" + user.Gender + "', '" + user.Age + "', '" + user.State + "', '" + user.Email + "', '" + user.Username + "', '" + user.Password + "')", this.conn);

            //open database connection
            conn.Open();

            //execute query
            int rows = cmd.ExecuteNonQuery();

            //check to see how many rows were affected
            if (rows >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
        /**********************************
         *                                *
         *          Register Method       *
         *                                *
         *   Use with form generated User *
         *             obj                *
         *                                *
         *  Call this method to Register  *
         *           new User             *
         ********************************** */
        public bool Register(MinesweeperProjectCLC247.Models.UserModel newUser)
        {
            DAO dao = new DAO();

            return(dao.Register(newUser));
        }