예제 #1
0
        public static void AddItem(int portalID, int productID, int quantity)
        {
            string cartID = getCartID(portalID);

            ItemInfo itemInfo = new ItemInfo();
            itemInfo.CartID = cartID;
            itemInfo.ProductID = productID;
            itemInfo.Quantity = quantity;

            CartController controller = new CartController();
            controller.AddItem(itemInfo);
        }
예제 #2
0
        public static void ClearItems(int portalID)
        {
            string cartID = getCartID(portalID);

            CartController controller = new CartController();
            controller.DeleteItems(cartID);
        }
예제 #3
0
        /*
        public static void AddItem(int portalID, int productID, int quantity, int deliveryMethod)
        {
            string cartID = getCartID(portalID);

            ItemInfo itemInfo = new ItemInfo();
            itemInfo.CartID = cartID;
            itemInfo.ProductID = productID;
            itemInfo.Quantity = quantity;
            itemInfo.DeliveryMethod = deliveryMethod;

            CartController controller = new CartController();
            controller.AddItem(itemInfo);
        }
        */
        // canadean changed: added method for the Data Extracts products
        public static void AddItem(int portalID, int productID, int quantity, int deliveryMethod, string modelNumber, string modelName, decimal cost)
        {
            string cartID = getCartID(portalID);

            ItemInfo itemInfo = new ItemInfo();
            itemInfo.CartID = cartID;
            if (productID == -1)
                productID = 15;        // DE product. Only used as a reference
            itemInfo.ProductID = productID;
            itemInfo.Quantity = quantity;
            itemInfo.DeliveryMethod = deliveryMethod;

            itemInfo.ModelNumber = modelNumber;
            itemInfo.ModelName = modelName;
            itemInfo.UnitCost = cost;

            CartController controller = new CartController();
            controller.AddItem(itemInfo);
        }
예제 #4
0
        private static string getCartID(int portalID)
        {
            string cartID = null;

            // Get cart ID from cookie
            HttpCookie cartCookie = HttpContext.Current.Request.Cookies[CartCookieName + portalID.ToString()];
            if (cartCookie != null)
            {
                cartID = cartCookie["CartID"];
            }

            // Do we need to verify?
            if ((cartID != null) && (!_isCartVerified))
            {
                CartController controller = new CartController();
                _isCartVerified = (controller.GetCart(cartID, portalID) != null);
                if (!_isCartVerified)
                {
                    cartID = null;
                }
            }

            // Do we need to create a new cart?
            if (cartID == null)
            {
                cartID = createCart(portalID);
                setCartID(portalID, cartID);
            }

            return cartID;
        }
예제 #5
0
        public static void UpdateItem(int portalID, int itemID, int quantity)
        {
            string cartID = getCartID(portalID);

            CartController controller = new CartController();
            ItemInfo itemInfo = controller.GetItem(itemID);

            if (itemInfo != null)
            {
                itemInfo.CartID = cartID;
                itemInfo.ItemID = itemID;
                itemInfo.Quantity = quantity;

                controller.UpdateItem(itemInfo);
            }
        }
예제 #6
0
        private static string createCart(int portalID)
        {
            CartController controller = new CartController();
            string cartID = null;

            cartID = System.Guid.NewGuid().ToString();

            DotNetNuke.Entities.Users.UserInfo mUser = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo();
            controller.AddCart(cartID, portalID, mUser.UserID);
            //controller.AddCart(cartID, portalID, Null.NullInteger);

            return cartID;
        }
예제 #7
0
 public static void RemoveItem(int itemID)
 {
     CartController controller = new CartController();
     controller.DeleteItem(itemID);
 }
예제 #8
0
        public static ArrayList GetItems(int portalID)
        {
            string cartID = getCartID(portalID);

            CartController controller = new CartController();
            return controller.GetItems(cartID);
        }
예제 #9
0
        public static CartInfo GetInfo(int portalID)
        {
            string cartID = getCartID(portalID);

            CartController controller = new CartController();
            CartInfo cartInfo = controller.GetCart(cartID, portalID);

            return cartInfo;
        }
예제 #10
0
        public static void DeleteCart(int portalID)
        {
            string cartID = getCartID(portalID);

            CartController controller = new CartController();
            controller.DeleteItems(cartID);
            controller.DeleteCart(cartID);

            setCartID(portalID, null);
        }
예제 #11
0
        private OrderInfo CreateOrder()
        {
            // Associate cart with this user
            CartController cartController = new CartController();
            cartController.UpdateCart(CurrentCart.GetInfo(PortalId).CartID, UserId);

            // Create order (copies cart to create order)
            OrderController orderController = new OrderController();
            OrderInfo orderInfo = orderController.CreateOrder(CurrentCart.GetInfo(PortalId).CartID);
            if (orderInfo != null)
            {
                SetOrderIdCookie(orderInfo.OrderID);
            }

            return orderInfo;
        }