/// <summary> /// Create a new StoreCart object. /// </summary> /// <param name="cartID">Initial value of the CartID property.</param> /// <param name="portalID">Initial value of the PortalID property.</param> /// <param name="createDate">Initial value of the CreateDate property.</param> public static StoreCart CreateStoreCart(global::System.Int32 cartID, global::System.Int32 portalID, global::System.DateTime createDate) { StoreCart storeCart = new StoreCart(); storeCart.CartID = cartID; storeCart.PortalID = portalID; storeCart.CreateDate = createDate; return storeCart; }
/// <summary> /// Deprecated Method for adding a new object to the StoreCarts EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToStoreCarts(StoreCart storeCart) { base.AddObject("StoreCarts", storeCart); }
public static int GetCartID() { int CartID = 0; if (HttpContext.Current.Request.Cookies["CartID"] == null) { DAL.StoreCart R = new DAL.StoreCart { CreateDate = DateTime.Now, PortalID = Product.PortalID }; Utils.DbContext.AddToStoreCarts(R); Utils.DbContext.SaveChanges(); CartID = R.CartID; HttpCookie CookieCartID = new HttpCookie("CartID"); CookieCartID.Value = Crypto.Encrypt(CartID.ToString(), ConfigurationManager.AppSettings.Get("PASSPHRASESALT")); CookieCartID.Expires = DateTime.Now.AddMinutes(15); HttpContext.Current.Response.AppendCookie(CookieCartID); } else { CartID = int.Parse(Crypto.Decrypt(HttpContext.Current.Request.Cookies["CartID"].Value.ToString(), ConfigurationManager.AppSettings.Get("PASSPHRASESALT"))); } return CartID; }