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); }
public static void ClearItems(int portalID) { string cartID = getCartID(portalID); CartController controller = new CartController(); controller.DeleteItems(cartID); }
/* 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); }
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; }
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); } }
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; }
public static void RemoveItem(int itemID) { CartController controller = new CartController(); controller.DeleteItem(itemID); }
public static ArrayList GetItems(int portalID) { string cartID = getCartID(portalID); CartController controller = new CartController(); return controller.GetItems(cartID); }
public static CartInfo GetInfo(int portalID) { string cartID = getCartID(portalID); CartController controller = new CartController(); CartInfo cartInfo = controller.GetCart(cartID, portalID); return cartInfo; }
public static void DeleteCart(int portalID) { string cartID = getCartID(portalID); CartController controller = new CartController(); controller.DeleteItems(cartID); controller.DeleteCart(cartID); setCartID(portalID, null); }
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; }