Example #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            dataaccesslayer da   = new dataaccesslayer();
            int             user = da.stafflogin(txtuserid.Text, txtpassword.Text);

            if (user > 0)
            {
                Response.Redirect("staffenter.aspx");
            }
            else
            {
                txtlabel.Visible = true;
                txtlabel.Text    = "Incorrect StaffID or Password";
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (!passwordstrength.HasMinimumLength(txtpassword.Text, 8))
            {
                txtlbl2.Visible = true;
            }

            else if (!passwordstrength.HasMinimumUniqueChars(txtpassword.Text, 1))
            {
                txtlbl2.Visible = true;
            }

            else if (!passwordstrength.HasDigit(txtpassword.Text))
            {
                txtlbl2.Visible = true;
            }

            else if (!passwordstrength.HasLowerCaseLetter(txtpassword.Text))
            {
                txtlbl2.Visible = true;
            }

            else if (!passwordstrength.HasUpperCaseLetter(txtpassword.Text))
            {
                txtlbl2.Visible = true;
            }
            else
            {
                dataaccesslayer da   = new dataaccesslayer();
                int             user = da.updatepassword(TextBox3.Text, txtpassword.Text);
                if (user > 0)
                {
                    lbllabel2.Visible         = true;
                    customerloginlink.Visible = true;
                }
                else
                {
                    lbllabel2.Visible = true;
                    lbllabel2.Text    = "Password doesn't changed successfully";
                }
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            dataaccesslayer da    = new dataaccesslayer();
            int             user1 = da.customerlogin(txtemailid.Text.Trim(), txtpassword.Text.Trim());

            if (user1 > 0)
            {
                HttpCookie user = new HttpCookie("user");
                user["userName"] = txtemailid.Text;
                //store as much data as you want.
                user.Expires = DateTime.Now.AddDays(1);
                Response.Cookies.Add(user);
                Response.Redirect("services.aspx");
            }
            else
            {
                txtlbl.Visible = true;
                txtlbl.Text    = "Incorrect CustomerID or Password";
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (!passwordstrength.HasMinimumLength(txtpassword.Text, 8))
                {
                    txtlbl2.Visible = true;
                }

                else if (!passwordstrength.HasMinimumUniqueChars(txtpassword.Text, 1))
                {
                    txtlbl2.Visible = true;
                }

                else if (!passwordstrength.HasDigit(txtpassword.Text))
                {
                    txtlbl2.Visible = true;
                }

                else if (!passwordstrength.HasLowerCaseLetter(txtpassword.Text))
                {
                    txtlbl2.Visible = true;
                }

                else if (!passwordstrength.HasUpperCaseLetter(txtpassword.Text))
                {
                    txtlbl2.Visible = true;
                }
                else
                {
                    dataaccesslayer da = new dataaccesslayer();
                    da.AddCustomers(txtfirstname.Text, txtlastname.Text, txtemailaddress.Text, txtpassword.Text, txtphone.Text, txtmobile.Text, txtstreetno.Text, txtsuburb.Text, txtcountry.Text);
                    Response.Redirect("customerlogin.aspx");
                }
            }
            catch (Exception)
            {
                txtlbl.Visible = true;
                txtlbl.Text    = "Error:EmailID already exists.Try another email";
            }
        }