コード例 #1
0
        public ActionResult Login()
        {
            try
            {
                bal = new BLCustomer();
                DLCustomer dlcustomer = new DLCustomer();
                dlcustomer.Firstname = Request["Firstname"];

                dlcustomer.Lastname      = Request["Lastname"];
                dlcustomer.GoogleId      = Request["GoogleID"];
                dlcustomer.Email         = Request["Email"];
                Session["LoginCustomer"] = dlcustomer.Firstname + " " + dlcustomer.Lastname;

                dlcustomer.Password = null;


                int val = bal.Signup(dlcustomer, "Insert");

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

                    int CartId = bal.CartCustomerExist(CustomerId);
                    if (CartId > 0)
                    {
                        List <DLProducts> lst = bal.CartItem(CartId);
                        int count             = 0;
                        foreach (var v in lst)
                        {
                            count++;
                        }
                        Session["CartCount"] = count;
                    }
                }

                return(Redirect("/Customer/Home"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }