コード例 #1
0
		private void detach_Carts1(Cart entity)
		{
			this.SendPropertyChanging();
			entity.Shipping = null;
		}
コード例 #2
0
ファイル: Cart.cs プロジェクト: janiukjf/CURTeCommerce
 public Cart Save() {
     EcommercePlatformDataContext db = new EcommercePlatformDataContext();
     try {
         Cart c = new Cart {
             cust_id = 0,
             date_created = DateTime.UtcNow,
             shipping_price = 0
         };
         db.Carts.InsertOnSubmit(c);
         db.SubmitChanges();
         return c;
     } catch { };
     return this;
 }
コード例 #3
0
		private void detach_Carts(Cart entity)
		{
			this.SendPropertyChanging();
			entity.Billing = null;
		}
コード例 #4
0
		private void attach_Carts1(Cart entity)
		{
			this.SendPropertyChanging();
			entity.Shipping = this;
		}
コード例 #5
0
		private void attach_Carts(Cart entity)
		{
			this.SendPropertyChanging();
			entity.Billing = this;
		}
コード例 #6
0
 partial void DeleteCart(Cart instance);
コード例 #7
0
 partial void UpdateCart(Cart instance);
コード例 #8
0
 partial void InsertCart(Cart instance);
コード例 #9
0
ファイル: Customer.cs プロジェクト: curt-labs/CURTeCommerce
        internal void GetFromStorage(HttpContext ctx) {

            HttpCookie cart_cookie = null;
            int cartID = 0;
            int custID = 0;
            Cart cart = new Cart();
            cart_cookie = ctx.Request.Cookies.Get("hdcart");
            if (cart_cookie != null && cart_cookie.Value != null && cart_cookie.Value.Length > 0) {
                cartID = Convert.ToInt32(cart_cookie.Value);
            }
            if (cartID == 0) {
                // cart doesn't exist yet / no cookie
                cart = cart.Save();
                cartID = cart.ID;
                HttpCookie cook = new HttpCookie("hdcart", cartID.ToString());
                if (this.remember) {
                    cook.Expires = DateTime.Now.AddDays(30);
                }
                ctx.Response.Cookies.Add(cook);
            } else {
                // cookie exists
                try {
                    // attempt to get cart
                    cart = new Cart().Get(cartID);
                    custID = cart.cust_id;
                } catch {
                    // no cart
                    cart = cart.Save();
                    cartID = cart.ID;
                    HttpCookie cook = new HttpCookie("hdcart", cartID.ToString());
                    if (this.remember) {
                        cook.Expires = DateTime.Now.AddDays(30);
                    }
                    ctx.Response.Cookies.Add(cook);
                }
            }

            Customer customer = new Customer();
            if (custID > 0) {
                // customer ID exists on cart. Get customer
                try {
                    customer = customer.Get(custID);
                } catch { }
            }
            customer.Cart = cart;

            this.ID = customer.ID;
            this.email = customer.email;
            this.fname = customer.fname;
            this.lname = customer.lname;
            this.phone = customer.phone;
            this.dateAdded = customer.dateAdded;
            this.isSuspended = customer.isSuspended;
            this.receiveNewsletter = customer.receiveNewsletter;
            this.receiveOffers = customer.receiveOffers;
            this.billingID = customer.billingID;
            this.shippingID = customer.shippingID;
            this.validator = customer.validator;
            this.Cart = customer.Cart;
            this.remember = customer.remember;
        }