protected void signUpSubmitButton_Click(object sender, EventArgs e)
        {
            UserManager userManager=new UserManager();
            User aUser=new User();
            aUser.UserFullName = signUpFullName.Text;
            aUser.UserEmail = signUpEmailTextBox.Text;
            aUser.UserName = userName.Text;
            aUser.UserPassword = signUpPassword.Text;

            if (userManager.GetUser(aUser.UserName)!=null)
            {

                userName.BackColor = Color.Red;
            }

            else
            {
                if (userManager.InsertUser(aUser) > 0)
                {

                    Response.Redirect("LoginPage.aspx");

                }

            }
        }
Beispiel #2
0
        public int InsertUser(User aUser)
        {
            SqlConnection connection = new SqlConnection(connectionString);

            string query = string.Format("INSERT INTO tbl_user VALUES('" + aUser.UserEmail + "','" + aUser.UserFullName + "','" + aUser.UserPassword + "','" + aUser.UserName + "')");
            SqlCommand command = new SqlCommand(query, connection);

            connection.Open();

            int rowAffected = command.ExecuteNonQuery();

            connection.Close();

            return rowAffected;
        }
Beispiel #3
0
        public User GetUserById(string userId)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string query2 = string.Format("SELECT * FROM tbl_user WHERE UserId='" + userId + "'");

            SqlCommand command2 = new SqlCommand(query2, connection);
            User aUser=new User();
            connection.Open();
            SqlDataReader reader = command2.ExecuteReader();

            while (reader.Read())
            {
                aUser.UserId = Convert.ToInt32(reader["UserId"].ToString());
                aUser.UserFullName = reader["FullName"].ToString();
                aUser.UserName = reader["UserName"].ToString();
                aUser.UserEmail = reader["Email"].ToString();
                aUser.UserPassword = reader["Password"].ToString();

            }
            connection.Close();
            return aUser;
        }
Beispiel #4
0
 public int InsertUser(User aUser)
 {
     return aUserGateway.InsertUser(aUser);
 }