/// <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); }
/// <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)); }
/// <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); }
/// <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); }
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)); }
public static List <ShoppingCartItem> GetByUserGuid(int siteId, ShoppingCartTypeEnum cartType, Guid userGuid) { IDataReader reader = DBShoppingCartItem.GetByUserGuid(siteId, (int)cartType, userGuid); return(LoadListFromReader(reader)); }
public static int GetCount(int siteId, int shoppingCartType) { return(DBShoppingCartItem.GetCount(siteId, shoppingCartType)); }
public static bool MoveToUser(Guid userGuid, Guid newUserGuid) { return(DBShoppingCartItem.MoveToUser(userGuid, newUserGuid)); }
public static bool DeleteOlderThan(int siteId, int shoppingCartType, DateTime olderThanUtc) { return(DBShoppingCartItem.DeleteOlderThan(siteId, shoppingCartType, olderThanUtc)); }
public static bool DeleteBySite(int siteId) { return(DBShoppingCartItem.DeleteBySite(siteId)); }
public static bool DeleteByProduct(int productId) { return(DBShoppingCartItem.DeleteByProduct(productId)); }
public static bool Delete(Guid guid) { return(DBShoppingCartItem.Delete(guid)); }