protected void Page_Load(object sender, EventArgs e)
        {
            MiddleWare MD   = new MiddleWare();
            Boolean    flag = true;
            String     current_session_email = Session["CurrentUser_email"].ToString();

            if (current_session_email != "")
            {
                if (MD.login(current_session_email, Session["CurrentUser_password"].ToString()) == 1)
                {
                    String name = MD.get_name(current_session_email);
                    CurrentUser.InnerHtml = name;

                    most_bought.InnerHtml = MD.most_clicks();
                }
                else
                {
                    Session["Issue"] = "Incorrect Password";
                    flag             = false;
                }
            }
            else
            {
                Session["Issue"] = "User Not Found";
                flag             = false;
            }
            if (!flag)
            {
                Session.Remove("CurrentUser_email");
                Session.Remove("CurrentUser_password");
                Response.Redirect("/LoginError.aspx");
            }
        }
Beispiel #2
0
        protected void redirect_buy_now(object sender, EventArgs e)
        {
            MiddleWare MD = new MiddleWare();

            MD.empty_cart();
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Scripts", "<script>alert('ORDER PLACED');</script>");
        }
Beispiel #3
0
        protected void login(object sender, EventArgs e)
        {
            MiddleWare MD = new MiddleWare();

            Session["CurrentUser_email"]    = email.Text;
            Session["CurrentUser_password"] = password.Text;
            MD.empty_cart();
            Response.Redirect("/CustomerHome.aspx");
        }
Beispiel #4
0
        protected void sign_up(object sender, EventArgs e)
        {
            String _email     = email.Text;
            String _name      = name.Text;
            String _phone     = phone.Text;
            String _pass      = password.Text;
            String _conf_pass = conf_password.Text;

            if (_email != "" && _name != "" && _pass != "" && _phone != "")
            {
                if (_pass.Equals(_conf_pass))
                {
                    MiddleWare MD = new MiddleWare();
                    int        result;

                    result = MD.sign_up(_name, _email, _pass, _phone);

                    if (result == 1)
                    {
                        Response.Redirect("/Login.aspx");
                    }
                    else
                    {
                        Session["Issue"] = "This email is already registered !";
                        Response.Redirect("/LoginError.aspx");
                    }
                }
                else
                {
                    details_error.InnerText = "Passwords do not match !";
                }
            }
            else
            {
                details_error.InnerText = "Invalid details entered !";
            }
        }
Beispiel #5
0
        public void login()
        {
            MiddleWare mw = new MiddleWare();

            Assert.AreEqual(1, mw.login("*****@*****.**", "megha"));
        }