示例#1
0
        //handle the event when clicking the button
        protected void Login_Click(object sender, EventArgs e)
        {
            DAL_User aLayer = new DAL_User();

            if (aLayer.LoginUser(txtUID.Text, txtPassword.Text))
            {
                Response.Redirect("MainForm.aspx");
            }
            else
            {
                //error message
                lblMessage.Visible = true;
                lblMessage.Text    = "Login failed! Please try again!";
            }
        }
        //handle the event when clicking the button
        protected void BtnRegistration(object sender, EventArgs e)
        {
            DAL_User aLayer = new DAL_User();

            string UID             = txtUserID.Text;
            string UserName        = txtUserName.Text;
            string Password        = txtPassword.Text;
            string ConfirmPassword = txtConfirmPassword.Text;

            //validations for input
            if (Password != ConfirmPassword)
            {
                showMessage("Please type the same password to confirm!");
            }
            else if (string.IsNullOrEmpty(UID) || string.IsNullOrEmpty(UserName) ||
                     string.IsNullOrEmpty(Password) || string.IsNullOrEmpty(ConfirmPassword))
            {
                showMessage("Please fill all fields to finish the registration!");
            }
            else
            {
                aLayer.RegisterUser(UID, UserName, Password);
            }
        }
示例#3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            DAL_User aLayer = new DAL_User();

            aLayer.registerUser(TextBox1.Text, TextBox2.Text, TextBox3.Text);
        }