Пример #1
0
        protected void Signin_Click(object sender, EventArgs e)
        {
            int    vid;
            String CS = ConfigurationManager.ConnectionStrings["BrandBoxDatabaseConnectionString"].ConnectionString.ToString();

            using (SqlConnection con = new SqlConnection(CS))
            {
                SqlCommand cmd = new SqlCommand("select * from Vendor where VendorEmail='" + email.Text + "' and VendorPassword='******'", con);
                con.Open();
                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                DataTable      dt  = new DataTable();
                sda.Fill(dt);
                if (dt.Rows.Count != 0)
                {
                    if (access.checkifAlreadyVerified(email.Text, 'v'))
                    {
                        vid = Convert.ToInt32(dt.Rows[0]["VendorId"]);
                        if (RememberMeCheckBox.Checked)
                        {
                            Response.Cookies["VEMAIL"].Value = email.Text;
                            Response.Cookies["VPWD"].Value   = password.Text;


                            Response.Cookies["VEMAIL"].Expires = DateTime.Now.AddDays(3);
                            Response.Cookies["VPWD"].Expires   = DateTime.Now.AddDays(3);
                        }
                        else
                        {
                            Response.Cookies["VEMAIL"].Expires = DateTime.Now.AddDays(-1);
                            Response.Cookies["VPWD"].Expires   = DateTime.Now.AddDays(-1);
                        }
                        Session["vendor"] = email.Text;
                        Session["id"]     = vid;

                        Response.Redirect("~/SignUp.aspx");
                        Session.RemoveAll();
                    }

                    else
                    {
                        Response.Redirect("/Activation.aspx?rurl=notVerifiedVendor");
                    }
                }
                else
                {
                    lblError.Text      = "Invalid Username or password";
                    lblError.ForeColor = Color.Red;
                }
            }
        }
        private void verification(char type)
        {
            if (access.checkEmail(email.Text, type))
            {
                if (!(access.checkifAlreadyVerified(email.Text, type)))
                {
                    if (code.Text != "")
                    {
                        if (CheckCode(code.Text, email.Text, type))
                        {
                            updateTable(email.Text, type);
                            if (type == 'v')
                            {
                                Response.Redirect("~/Login.aspx");
                            }
                            else if (type == 'c')
                            {
                                Response.Redirect("~/CustLogin.aspx");
                            }
                        }
                        else
                        {
                            ErrorMessage.ForeColor = Color.Red;
                            ErrorMessage.Text      = "Code do not match";
                        }
                    }
                    else
                    {
                        ErrorMessage.ForeColor = Color.Red;
                        ErrorMessage.Text      = "Please Enter the code";
                    }
                }
                else
                {
                    ErrorMessage.ForeColor = Color.Red;
                    ErrorMessage.Text      = "You have already verified";
                }
            }

            else
            {
                ErrorMessage.ForeColor = Color.Red;
                ErrorMessage.Text      = "Incorrect Email";
            }
        }
Пример #3
0
        protected void Signin_Click(object sender, EventArgs e)
        {
            //  int Cid;
            SqlCommand cmd = new SqlCommand("select * from CustomerDetails where CustomerEmailAddress='" + email.Text + "' and CustomerPassword='******'");
            DataTable  dt  = new DataTable();

            dt = access.SelectFromDatabase(cmd);
            if (dt.Rows.Count != 0)
            {
                if (access.checkifAlreadyVerified(email.Text, 'c'))
                {
                    Session["Customer"] = email.Text;
                    if (Request.QueryString["rurl"] != null)
                    {
                        if (Request.QueryString["rurl"] == "view")
                        {
                            Response.Redirect("~/ViewProduct.aspx");
                        }
                    }
                    else
                    {
                        Response.Redirect("~/AllProducts.aspx");
                    }
                    Session.RemoveAll();
                }

                else
                {
                    Response.Redirect("/Activation.aspx?rurl=notVerifiedCust");
                }
            }
            else
            {
                lblError.Text      = "Invalid Username or password";
                lblError.ForeColor = Color.Red;
            }
        }