public CreateOrderRequest(IOrderConfiguration configuration, int shipMethodID, IEnumerable<IShoppingCartItem> items, ShippingAddress address) { WarehouseID = configuration.WarehouseID; PriceType = configuration.PriceTypeID; CurrencyCode = configuration.CurrencyCode; OrderDate = DateTime.Now; OrderType = ExigoWebService.OrderType.ShoppingCart; OrderStatus = OrderStatusType.Incomplete; ShipMethodID = shipMethodID; Details = items.Select(c => (OrderDetailRequest)(c as ShoppingCartItem)).ToArray(); FirstName = address.FirstName; LastName = address.LastName; Email = address.Email; Phone = address.Phone; Address1 = address.Address1; Address2 = address.Address2; City = address.City; State = address.State; Zip = address.Zip; Country = address.Country; }
public CreateAutoOrderRequest(IAutoOrderConfiguration configuration, AutoOrderPaymentType paymentType, DateTime startDate, int shipMethodID, IEnumerable<IShoppingCartItem> items, ShippingAddress address) { WarehouseID = configuration.WarehouseID; PriceType = configuration.PriceTypeID; CurrencyCode = configuration.CurrencyCode; StartDate = startDate; PaymentType = paymentType; ProcessType = AutoOrderProcessType.AlwaysProcess; ShipMethodID = shipMethodID; Details = items.Select(c => (OrderDetailRequest)(c as ShoppingCartItem)).ToArray(); FirstName = address.FirstName; LastName = address.LastName; Email = address.Email; Phone = address.Phone; Address1 = address.Address1; Address2 = address.Address2; City = address.City; State = address.State; Zip = address.Zip; Country = address.Country; }
public AutoOrder() { ShippingAddress = new ShippingAddress(); Details = new List <AutoOrderDetail>(); }
public AutoOrder() { Recipient = new ShippingAddress(); }
public static void UpdateCustomerAutoOrderShippingAddress(int customerID, int autoOrderID, ShippingAddress address) { //var context = Exigo.OData(); // Get the autoorder //var autoOrder = context.AutoOrders // .Where(c => c.CustomerID == customerID) // .Where(c => c.AutoOrderID == autoOrderID) // .FirstOrDefault(); //get auto orders from sql using following stored procedures AutoOrder autoOrder = new AutoOrder(); using (var Context = Exigo.Sql()) { string SPGetCustomerAutoOrders = string.Format("GetCustomerAutoOrders {0},{1}", customerID, autoOrderID); autoOrder = Context.Query <AutoOrder>(SPGetCustomerAutoOrders).FirstOrDefault(); } if (autoOrder == null) { return; } // Re-create the autoorder var request = GetCreateOverridenAutoOrderRequest(customerID, autoOrderID); request.FirstName = address.FirstName; request.LastName = address.LastName; request.Company = address.Company; request.Address1 = address.Address1; request.Address2 = address.Address2; request.City = address.City; request.State = address.State; request.Zip = address.Zip; request.Country = address.Country; request.Email = address.Email; request.Phone = address.Phone; // Update the autoorder var response = Exigo.WebService().CreateAutoOrder(request); }
// Auto Order Manager public static void UpdateCustomerAutoOrderShippingAddress(int customerID, int autoOrderID, ShippingAddress address) { var context = Exigo.OData(); // Get the autoorder var autoOrder = context.AutoOrders .Where(c => c.CustomerID == customerID) .Where(c => c.AutoOrderID == autoOrderID) .FirstOrDefault(); if (autoOrder == null) { return; } // Re-create the autoorder var request = GetCreateOverridenAutoOrderRequest(customerID, autoOrderID); request.FirstName = address.FirstName; request.LastName = address.LastName; request.Company = address.Company; request.Address1 = address.Address1; request.Address2 = address.Address2; request.City = address.City; request.State = address.State; request.Zip = address.Zip; request.Country = address.Country; request.Email = address.Email; request.Phone = address.Phone; request.Frequency = FrequencyType.Monthly; // Update the autoorder var response = Exigo.WebService().CreateAutoOrder(request); }
public bool HasValidShippingAddress(ShippingAddress address) { return address != null && address.IsComplete; }
// Auto Order Manager public static void UpdateCustomerAutoOrderShippingAddress(int customerID, int autoOrderID, ShippingAddress address) { var context = Exigo.OData(); // Get the autoorder var autoOrder = context.AutoOrders .Where(c => c.CustomerID == customerID) .Where(c => c.AutoOrderID == autoOrderID) .FirstOrDefault(); if (autoOrder == null) return; // Re-create the autoorder var request = GetCreateOverridenAutoOrderRequest(customerID, autoOrderID); request.FirstName = address.FirstName; request.LastName = address.LastName; request.Company = address.Company; request.Address1 = address.Address1; request.Address2 = address.Address2; request.City = address.City; request.State = address.State; request.Zip = address.Zip; request.Country = address.Country; request.Email = address.Email; request.Phone = address.Phone; // Update the autoorder var response = Exigo.WebService().CreateAutoOrder(request); }
public bool HasSelectedCountry(ShippingAddress address) { return address != null && !address.Country.IsEmpty(); }
public ActionResult Shipping(ShippingAddress address, bool overrideValidation = false) { if (address.Country == "US") { // Validate the address var response = new ExigoService.VerifyAddressResponse() { IsValid = false }; if (!overrideValidation) { response = Exigo.VerifyAddress(address as Address); address.Address1 = address.Address1; address.Address2 = address.Address2; address.City = address.City; address.State = address.State; address.Zip = address.Zip; address.Country = address.Country; PropertyBag.ShippingAddress = address; Exigo.PropertyBags.Update(PropertyBag); } if (response.IsValid || overrideValidation) { if (!overrideValidation) { address.Address1 = response.VerifiedAddress.Address1; address.Address2 = response.VerifiedAddress.Address2; address.City = response.VerifiedAddress.City; address.State = response.VerifiedAddress.State; address.Zip = response.VerifiedAddress.Zip; address.Country = response.VerifiedAddress.Country; PropertyBag.ShippingAddress = address; } // Save the address to the customer's account if applicable if (Request.IsAuthenticated && address.AddressType == AddressType.New) { Exigo.SetCustomerAddressOnFile(Identity.Customer.CustomerID, address as Address); } // If Auto Order Items are in Cart Ensure Defaults are set if (ShoppingCart.Items.Where(c => c.Type == ShoppingCartItemType.AutoOrder).Count() > 0) { // Ensure we have a valid frequency type if (!GlobalSettings.AutoOrders.AvailableFrequencyTypes.Contains(PropertyBag.AutoOrderFrequencyType)) { PropertyBag.AutoOrderFrequencyType = Identity.Customer.Market.Configuration.AutoOrders.DefaultFrequencyType; } // Ensure we have a valid start date based on the frequency if (PropertyBag.AutoOrderStartDate == DateTime.MinValue) { PropertyBag.AutoOrderStartDate = GlobalUtilities.GetNextAvailableAutoOrderStartDate(DateTime.Today.AddMonths(1)).ToLocalTime(); } } PropertyBag.ShippingAddress = address; Exigo.PropertyBags.Update(PropertyBag); return LogicProvider.GetNextAction(); } else { return RedirectToAction("Shipping", new { validate = "Unable to verify address" }); } } else { // If Auto Order Items are in Cart Ensure Defaults are set if (ShoppingCart.Items.Where(c => c.Type == ShoppingCartItemType.AutoOrder).Count() > 0) { // Ensure we have a valid frequency type if (!GlobalSettings.AutoOrders.AvailableFrequencyTypes.Contains(PropertyBag.AutoOrderFrequencyType)) { PropertyBag.AutoOrderFrequencyType = Identity.Customer.Market.Configuration.AutoOrders.DefaultFrequencyType; } // Ensure we have a valid start date based on the frequency if (PropertyBag.AutoOrderStartDate == DateTime.MinValue) { PropertyBag.AutoOrderStartDate = GlobalUtilities.GetNextAvailableAutoOrderStartDate(DateTime.Today.AddMonths(1)).ToLocalTime(); } } PropertyBag.ShippingAddress = address; Exigo.PropertyBags.Update(PropertyBag); return LogicProvider.GetNextAction(); } }
public ActionResult UpdateAutoOrderShippingAddress(ShippingAddress recipient) { if (!recipient.IsComplete) { return new JsonNetResult(new { success = false, message = "Please Enter A CompleteAddress" //message = Resources.Common.PleaseEnterACompleteAddress }); } try { var autoorderid = Convert.ToInt32(Request.Form["autoorderid"]); Exigo.UpdateCustomerAutoOrderShippingAddress(Identity.Customer.CustomerID, autoorderid, recipient); // Get Partial to update the AutoOrder var model = Exigo.GetCustomerAutoOrder(Identity.Customer.CustomerID, autoorderid); var partial = RenderPartialViewToString("displaytemplates/autoorderrow", model); return new JsonNetResult(new { success = true, html = partial, autoorderid = autoorderid }); } catch (Exception ex) { return new JsonNetResult(new { success = false, message = ex.Message }); } }