/// <summary> /// Sets a cookie for the customer and caches the customer object /// </summary> /// <param name="customer">The customer to establish</param> public void EstablishCustomer(Customer customer) { HttpContext context = HttpContext.Current; context.Response.Cookies.Add(new HttpCookie("Customer",customer.CustomerID.ToString()) { HttpOnly = true, Expires = DateTime.Now.AddDays(14), //TODO: Make configurable? }); context.Cache.Insert(String.Format("Customer:{0}", customer.CustomerID), customer); }
public Customer GetAnonymousCustomer() { var context = new Fashinon(); var customer = new Customer(); customer.FirstName = "Anonymous"; customer.LastName = "Anonymous"; context.Customers.Add(customer); context.SaveChanges(); return customer; }
public GetShippingDetailsResponse Execute() { NVPCodec encoder = new NVPCodec(); encoder["METHOD"] = METHOD; encoder["TOKEN"] = this.Token; var decoder = executorService.Execute(encoder); string strAck = decoder["ACK"].ToLower(); if (strAck != null && (strAck == "success" || strAck == "successwithwarning")) { var address = new Address() { Name = decoder["SHIPTONAME"], AddressLineOne = decoder["SHIPTOSTREET"], AddressLineTwo = decoder["SHIPTOSTREET2"], Town = decoder["SHIPTOCITY"], County = decoder["SHIPTOSTATE"], PostCode = decoder["SHIPTOZIP"], Country = decoder["SHIPTOCOUNTRYNAME"], CountryCode = decoder["SHIPTOCOUNTRYCODE"] }; var customer = new Customer() { FirstName = decoder["FIRSTNAME"], LastName = decoder["LASTNAME"], Email = decoder["EMAIL"], ContactAddress = address, ExternalReference = decoder["PAYERID"], CustomerType = "PayPal", DateCreated = DateTime.Now }; customer.Addresses = new List<Address>(); customer.Addresses.Add(address); return new GetShippingDetailsResponse() { ShippingAddress = address, Customer = customer }; } else { throw new PayPalExeception(decoder["L_ERRORCODE0"], decoder["L_SHORTMESSAGE0"], decoder["L_LONGMESSAGE0"]); } }
public Basket GetBasket(Customer customer) { Basket basket; basket = HttpRuntime.Cache.Get("basket") as Basket; //TODO: Get real user if (basket != null) { return basket; } else { basket = new Basket(); HttpRuntime.Cache.Insert("basket", basket); return basket; } }
public IEnumerable<Order> GetOrders(Customer customer) { throw new NotImplementedException(); }
public Basket(Customer customer) { this.TaxInclusive = true; //TODO: From site services or products }