Example #1
0
        public ActionResult SignIn(string Email, string Password)
        {
            try
            {
                bal = new BLCustomer();
                if (!string.IsNullOrEmpty(Email) && !string.IsNullOrEmpty(Password))
                {
                    string   email    = Request["Email"];
                    string   password = SHA1.Encode(Password);
                    string[] i        = bal.SignIn(email, password);

                    if (i != null)
                    {
                        Session["LoginCustomer"] = i[0];
                        Session["CustomerId"]    = i[1];

                        if (Session["CustomerId"] != null)
                        {
                            int CustomerId = Convert.ToInt32(Session["CustomerId"]);

                            int CartId            = bal.CartCustomerExist(CustomerId);
                            List <DLProducts> lst = bal.CartItem(CartId);

                            int count = 0;
                            foreach (var val in lst)
                            {
                                count++;
                            }
                            Session["CartCount"] = count;
                        }
                        return(Redirect("/Customer/Home"));
                    }
                    else
                    {
                        TempData["Error"] = "Invalid email or password";
                    }
                }
                else
                {
                    TempData["Error"] = "Required Email or password";
                }
                return(Redirect("/Customer/Home"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }