예제 #1
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            CustomerUtil c = new CustomerUtil();

            c.UserName = TextBoxUserName.Text;
            c.FName    = TextBoxFName.Text;
            c.LName    = TextBoxLName.Text;
            c.Email    = TextBoxEmail.Text;
            c.Country  = DropDownListCountry.SelectedItem.ToString();
            c.Password = TextBoxPassword.Text;
            c.Age      = TextBoxAge.Text;
            if (RadioButtonFemale.Checked)
            {
                c.Gender = "F";
            }
            else
            {
                c.Gender = "M";
            }
            if (c.CheckUserExist() == false)
            {
                c.InsertData();
                LabelWelcome.Text      = "You just registered with server!";
                LabelWelcome.ForeColor = Color.Red;
                Response.AddHeader("refresh", "4, url=Home.aspx");
            }//close if
            else
            {
                LabelWelcome.Text      = "User already Existed!!";
                LabelWelcome.ForeColor = Color.Red;
                Response.AddHeader("refresh", "4, url=Login.aspx");
            }
        }
예제 #2
0
        protected void ButtonLogin_Click(object sender, EventArgs e)
        {
            CustomerUtil check = new CustomerUtil();

            check.UserName = TextBoxUserName.Text;
            check.Password = TextBoxPassword.Text;
            if (check.CheckUserExist() && check.CheckPassword())
            {
                Session["user"]        = TextBoxUserName.Text;
                LabelMessage.Visible   = true;
                LabelMessage.Text      = "Welcome Back!";
                LabelMessage.ForeColor = Color.Red;

                Response.AddHeader("refresh", "4; url=Home.aspx");
            }
            else
            {
                LabelMessage.Visible            = true;
                LabelMessage.Text               = "Your userName and password are not correct!";
                LabelMessage.ForeColor          = Color.Red;
                LinkButtonResetPassowrd.Enabled = true;
                LinkButtonResetPassowrd.Visible = true;
            }   //close else
        }