Exemplo n.º 1
0
        protected void bSubmitCreateUser_Click(object sender, EventArgs e)
        {
            // Instance that populates the properties in that instance from the text in the textboxes.
            UserModel newUser = new UserModel();

            // Calls the CreateUser function in the CreateUserController.
            CreateUserController con = new CreateUserController(ConfigurationManager.ConnectionStrings["DBInformation"].ToString());

            newUser.FirstName   = tbFirstname.Text;
            newUser.LastName    = tbLastName.Text;
            newUser.Email       = tbEmail.Text;
            newUser.Password    = tbPassword.Text;
            newUser.PhoneNumber = tbPhoneNumber.Text;
            newUser.UserType    = tbUserType.Text;

            con.InsertUser(newUser);

            //string sql = "INSERT into UserID (FisrtName, LastName, Email, Password, PhoneNumber";

            //CreateUserController dbs = new CreateUserController(ConfigurationManager.ConnectionStrings["DBInformation"].ToString());

            // dbs.InsertUser(newUser);

            // Causes the Default page to load.
            Response.Redirect("Default.aspx", false);
        }
Exemplo n.º 2
0
        protected void bSubmit_Click(object sender, EventArgs e)
        {
            UserModel newUser = new UserModel();

            newUser.FirstName = tbFirstName.Text;
            newUser.LastName  = tbLastName.Text;
            newUser.Email     = tbEmail.Text;
            newUser.Password  = tbPassword.Text;

            CreateUserController con = new CreateUserController(ConfigurationManager.ConnectionStrings["DBInformation"].ToString());

            con.InsertUser(newUser);
            con.EncryptPassword(tbPassword.Text);

            Session["CurrentUser_UserID"] = newUser.UserID;
            Response.Redirect("Default.aspx", false);
        }