Exemplo n.º 1
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            //register a new user
            if (chb_terms.Checked == true)
            {
                string name            = txt_name.Text;
                string dob             = txt_dobDay.Text + "/" + txt_dobMonth.Text + "/" + txt_dobYear.Text;
                string experience      = ddl_yogaExperience.SelectedValue;
                string health          = txt_healthIssues.Text;
                string email           = txt_email.Text;
                string password        = txt_password.Text;
                string passwordConfirm = txt_passwordConfirm.Text;
                long   tel             = long.Parse(txt_telNo.Text);

                if (password.Equals(passwordConfirm))
                {
                    User u = new User(name, dob, experience, health, email, tel, password, "Client");
                    DBconnection.addUser(u);
                    System.Web.HttpContext.Current.Response.Write("<script>alert('Thank you for your registration! You can now login.')</script>");
                    clearFields();
                    Response.AddHeader("REFRESH", "1;URL=Default.aspx");
                }
                else
                {
                    Label2.Text = "Passwords do not match!";
                }
            }
            else
            {
                Label2.Text = "You must accept terms and conditions in order to register. :P ";
            }
        }
        protected void btn_register_Click(object sender, EventArgs e)
        {
            string name            = txt_name.Text;
            string dob             = txt_dobDay.Text + "/" + txt_dobMonth.Text + "/" + txt_dobYear.Text;
            string health          = txt_healthIssues.Text;
            string email           = txt_email.Text;
            string password        = txt_password.Text;
            bool   anusara         = chb_Anusara.Checked;
            bool   bikram          = chb_Bikram.Checked;
            bool   hatha           = chb_Hatha.Checked;
            string passwordConfirm = txt_passwordConfirm.Text;
            long   tel             = long.Parse(txt_telNo.Text);

            if (password.Equals(passwordConfirm))
            {
                User u = new User(name, dob, "Instructor", health, anusara, bikram, hatha, email, tel, password, "Instructor");
                DBconnection.addUser(u);
                clearFields();
                HttpContext.Current.Response.Write("<script>alert('Instructor " + u.Name + " has been added. ')</script>");
            }
            else
            {
                Label2.Text = "Passwords do not match!";
            }
        }