/// <summary>
        /// Updates the shopping cart item
        /// </summary>
        /// <param name="ShoppingCartItemID">The shopping cart item identifier</param>
        /// <param name="ShoppingCartType">The shopping cart type</param>
        /// <param name="CustomerSessionGUID">The customer session identifier</param>
        /// <param name="ProductVariantID">The product variant identifier</param>
        /// <param name="AttributesXML">The product variant attributes</param>
        /// <param name="Quantity">The quantity</param>
        /// <param name="CreatedOn">The date and time of instance creation</param>
        /// <param name="UpdatedOn">The date and time of instance update</param>
        /// <returns>Shopping cart item</returns>
        internal static ShoppingCartItem UpdateShoppingCartItem(int ShoppingCartItemID,
                                                                ShoppingCartTypeEnum ShoppingCartType, Guid CustomerSessionGUID,
                                                                int ProductVariantID, string AttributesXML, int Quantity,
                                                                DateTime CreatedOn, DateTime UpdatedOn)
        {
            if (ShoppingCartItemID == 0)
            {
                return(null);
            }

            if (AttributesXML == null)
            {
                AttributesXML = string.Empty;
            }

            CreatedOn = DateTimeHelper.ConvertToUtcTime(CreatedOn);
            UpdatedOn = DateTimeHelper.ConvertToUtcTime(UpdatedOn);

            DBShoppingCartItem dbItem = DBProviderManager <DBShoppingCartProvider> .Provider.UpdateShoppingCartItem(ShoppingCartItemID, (int)ShoppingCartType,
                                                                                                                    CustomerSessionGUID, ProductVariantID, AttributesXML,
                                                                                                                    Quantity, CreatedOn, UpdatedOn);

            ShoppingCartItem shoppingCartItem = DBMapping(dbItem);

            return(shoppingCartItem);
        }
        /// <summary>
        /// Gets a shopping cart item
        /// </summary>
        /// <param name="ShoppingCartItemID">The shopping cart item identifier</param>
        /// <returns>Shopping cart item</returns>
        public static ShoppingCartItem GetShoppingCartItemByID(int ShoppingCartItemID)
        {
            if (ShoppingCartItemID == 0)
            {
                return(null);
            }

            DBShoppingCartItem dbItem = DBProviderManager <DBShoppingCartProvider> .Provider.GetShoppingCartItemByID(ShoppingCartItemID);

            ShoppingCartItem shoppingCartItem = DBMapping(dbItem);

            return(shoppingCartItem);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Updates this instance of ShoppingCartItem. Returns true on success.
 /// </summary>
 /// <returns>bool</returns>
 private bool Update()
 {
     return(DBShoppingCartItem.Update(
                this.guid,
                this.siteID,
                this.productID,
                this.userGuid,
                this.attributesXml,
                this.quantity,
                this.shoppingCartType,
                this.createdFromIP,
                this.createdUtc,
                this.lastModUtc));
 }
Exemplo n.º 4
0
        /// <summary>
        /// Persists a new instance of ShoppingCartItem. Returns true on success.
        /// </summary>
        /// <returns></returns>
        private bool Create()
        {
            this.guid = Guid.NewGuid();

            int rowsAffected = DBShoppingCartItem.Create(
                this.guid,
                this.siteID,
                this.productID,
                this.userGuid,
                this.attributesXml,
                this.quantity,
                this.shoppingCartType,
                this.createdFromIP,
                this.createdUtc,
                this.lastModUtc);

            return(rowsAffected > 0);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Gets an instance of ShoppingCartItem.
 /// </summary>
 /// <param name="guid"> guid </param>
 private void GetShoppingCartItem(Guid guid)
 {
     using (IDataReader reader = DBShoppingCartItem.GetOne(guid))
     {
         if (reader.Read())
         {
             this.guid             = new Guid(reader["Guid"].ToString());
             this.siteID           = Convert.ToInt32(reader["SiteID"]);
             this.productID        = Convert.ToInt32(reader["ProductID"]);
             this.userGuid         = new Guid(reader["UserGuid"].ToString());
             this.attributesXml    = reader["AttributesXml"].ToString();
             this.quantity         = Convert.ToInt32(reader["Quantity"]);
             this.shoppingCartType = Convert.ToInt32(reader["ShoppingCartType"]);
             this.createdFromIP    = reader["CreatedFromIP"].ToString();
             this.createdUtc       = Convert.ToDateTime(reader["CreatedUtc"]);
             this.lastModUtc       = Convert.ToDateTime(reader["LastModUtc"]);
         }
     }
 }
        private static ShoppingCartItem DBMapping(DBShoppingCartItem dbItem)
        {
            if (dbItem == null)
            {
                return(null);
            }

            ShoppingCartItem item = new ShoppingCartItem();

            item.ShoppingCartItemID  = dbItem.ShoppingCartItemID;
            item.ShoppingCartTypeID  = dbItem.ShoppingCartTypeID;
            item.CustomerSessionGUID = dbItem.CustomerSessionGUID;
            item.ProductVariantID    = dbItem.ProductVariantID;
            item.AttributesXML       = dbItem.AttributesXML;
            item.Quantity            = dbItem.Quantity;
            item.CreatedOn           = dbItem.CreatedOn;
            item.UpdatedOn           = dbItem.UpdatedOn;

            return(item);
        }
Exemplo n.º 7
0
        public static List <ShoppingCartItem> GetPage(int siteId, int shoppingCartType, int pageNumber, int pageSize)
        {
            IDataReader reader = DBShoppingCartItem.GetPage(siteId, shoppingCartType, pageNumber, pageSize);

            return(LoadListFromReader(reader, true));
        }
Exemplo n.º 8
0
        public static List <ShoppingCartItem> GetByUserGuid(int siteId, ShoppingCartTypeEnum cartType, Guid userGuid)
        {
            IDataReader reader = DBShoppingCartItem.GetByUserGuid(siteId, (int)cartType, userGuid);

            return(LoadListFromReader(reader));
        }
Exemplo n.º 9
0
 public static int GetCount(int siteId, int shoppingCartType)
 {
     return(DBShoppingCartItem.GetCount(siteId, shoppingCartType));
 }
Exemplo n.º 10
0
 public static bool MoveToUser(Guid userGuid, Guid newUserGuid)
 {
     return(DBShoppingCartItem.MoveToUser(userGuid, newUserGuid));
 }
Exemplo n.º 11
0
 public static bool DeleteOlderThan(int siteId, int shoppingCartType, DateTime olderThanUtc)
 {
     return(DBShoppingCartItem.DeleteOlderThan(siteId, shoppingCartType, olderThanUtc));
 }
Exemplo n.º 12
0
 public static bool DeleteBySite(int siteId)
 {
     return(DBShoppingCartItem.DeleteBySite(siteId));
 }
Exemplo n.º 13
0
 public static bool DeleteByProduct(int productId)
 {
     return(DBShoppingCartItem.DeleteByProduct(productId));
 }
Exemplo n.º 14
0
 public static bool Delete(Guid guid)
 {
     return(DBShoppingCartItem.Delete(guid));
 }