Esempio n. 1
0
        public PartialViewResult _CartSummary()
        {
            iCartManager cart = (iCartManager)Session["USERCART"];

            if (cart == null)
            {
                cart = (iCartManager)(new CartManager());
                Session["USERCART"] = cart;
            }

            var cartItems = cart.ConvertCartDetails();

            return(PartialView(cartItems));
        }
Esempio n. 2
0
        public bool SubmitOrder(int id, int kioskId, string customer)
        {
            try
            {
                iCartManager cart = (iCartManager)Session["USERCART"];
                if (cart == null)
                {
                    cart = (iCartManager)(new CartManager());
                    Session["USERCART"] = cart;
                }

                var cartSession = cart.ConvertCartDetails();

                if (cartSession == null)
                {
                    return(false);
                }

                var userId = GetUserId();
                cartSession.FirstOrDefault().StoreDetail  = null;
                cartSession.FirstOrDefault().DeliveryType = "Kiosk";
                cartSession.FirstOrDefault().UserDetailId = store.CartMgr.GetUserDetails(userId).Id;
                var cartId = store.CartMgr.SaveKioskOrder(cartSession, userId, id);
                if (cartId > 0)
                {  //save to db
                    var kioskOrder = new StoreKioskOrder()
                    {
                        CartDetailId = cartId,
                        StoreKioskId = kioskId,
                        DtOrder      = DateTime.Now,
                        Customer     = customer.Trim()
                    };

                    //save storeKioskOrder
                    var kioskOrderRes = store.CartMgr.AddStoreKioskOrder(kioskOrder);
                    if (kioskOrderRes)
                    {
                        ClearCart();
                        return(true);
                    }
                }

                return(false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        public ActionResult CartCheckout(int kioskId, string customer)
        {
            iCartManager cart = (iCartManager)Session["USERCART"];

            if (cart == null)
            {
                cart = (iCartManager)(new CartManager());
                Session["USERCART"] = cart;
            }

            var cartItems = cart.ConvertCartDetails();

            ViewBag.Name    = customer;
            ViewBag.KioskId = kioskId;

            return(View(cartItems));
        }
Esempio n. 4
0
        public bool AddToCart(int id, int qty)
        {
            try
            {
                iCartManager cart = (iCartManager)Session["USERCART"];
                if (cart == null)
                {
                    cart = (iCartManager)(new CartManager());
                }

                int currentstoreid = (int)Session["STOREID"];
                cart.AddItem(currentstoreid, id, qty);
                Session["USERCART"] = cart;

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Esempio n. 5
0
        public bool RemoveCartItem(int id)
        {
            try
            {
                iCartManager cart = (iCartManager)Session["USERCART"];
                if (cart == null)
                {
                    return(false);
                }

                int currentstoreid = (int)Session["STOREID"];
                cart.RemoveItem(currentstoreid, id);
                Session["USERCART"] = cart;

                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }