/// <summary> /// The save customer order. /// </summary> /// <param name="customerOrder"> /// The customer order. /// </param> /// <returns> /// The save customer order. /// </returns> public static bool SaveCustomerOrder(CustomerOrder_V01 customerOrder) { if (customerOrder == null) { return(false); } using (var proxy = ServiceClientProvider.GetCustomerOrderServiceProxy()) { try { var request = new SaveCustomerOrderRequest_V01 { Order = customerOrder }; var response = proxy.SaveOrder(new SaveOrderRequest(request)).SaveOrderResult as SaveCustomerOrderResponse_V01; if (response.Status == ServiceResponseStatusType.Success) { return(true); } } catch (Exception ex) { WebUtilities.LogServiceExceptionWithContext(ex, proxy); // ExceptionPolicy.HandleException(ex, ProviderPolicies.SYSTEM_EXCEPTION); LoggerHelper.Error(string.Format("SaveCustomerOrder OrderID:{0} ERR:{1}", customerOrder.OrderID, ex)); return(false); } } return(false); }
/// <summary> /// The get customer order details. /// </summary> /// <param name="custOrder"> /// The cust order. /// </param> /// <returns> /// </returns> private static CustomerOrderDetail getCustomerOrderDetails(CustomerOrder_V01 custOrder) { var orderDetail = new CustomerOrderDetail(); orderDetail.CustomerOrderID = custOrder.OrderID; orderDetail.EmailAddress = custOrder.EmailAddress; orderDetail.FirstName = ((CustomerShippingInfo_V01)custOrder.Shipping).Recipient.First; orderDetail.LastName = ((CustomerShippingInfo_V01)custOrder.Shipping).Recipient.Last; orderDetail.MiddleName = ((CustomerShippingInfo_V01)custOrder.Shipping).Recipient.Middle; orderDetail.OrderDate = custOrder.Created; orderDetail.CustomerPaymentPreference = custOrder.PaymentMethodChoice.ToString(); orderDetail.ContactPreference = "HL"; orderDetail.Telephone = ((CustomerShippingInfo_V01)custOrder.Shipping).Phone; orderDetail.CustomerComments = custOrder.CustomerNote; return(orderDetail); }
/// <summary> /// GetCustomerAddress /// </summary> /// <param name="custOrder"></param> /// <param name="useAddressValidation"></param> /// <returns></returns> private static ShippingAddress_V02 GetCustomerAddress(CustomerOrder_V01 custOrder, bool useAddressValidation) { var custAddress = new ShippingAddress_V02(); custAddress.Phone = ((CustomerShippingInfo_V01)custOrder.Shipping).Phone; custAddress.FirstName = ((CustomerShippingInfo_V01)custOrder.Shipping).Recipient.First; custAddress.LastName = ((CustomerShippingInfo_V01)custOrder.Shipping).Recipient.Last; var address = new ServiceProvider.ShippingSvc.Address_V01(); address.City = ((CustomerShippingInfo_V01)custOrder.Shipping).Address.City; address.Country = ((CustomerShippingInfo_V01)custOrder.Shipping).Address.Country; address.CountyDistrict = ((CustomerShippingInfo_V01)custOrder.Shipping).Address.CountyDistrict; address.Line1 = ((CustomerShippingInfo_V01)custOrder.Shipping).Address.Line1; address.Line2 = ((CustomerShippingInfo_V01)custOrder.Shipping).Address.Line2; address.Line3 = ((CustomerShippingInfo_V01)custOrder.Shipping).Address.Line3; address.PostalCode = ((CustomerShippingInfo_V01)custOrder.Shipping).Address.PostalCode; address.StateProvinceTerritory = ((CustomerShippingInfo_V01)custOrder.Shipping).Address.StateProvinceTerritory; custAddress.Address = address; custAddress.FirstName = ((CustomerShippingInfo_V01)custOrder.Shipping).Recipient.First; custAddress.LastName = ((CustomerShippingInfo_V01)custOrder.Shipping).Recipient.Last; custAddress.MiddleName = ((CustomerShippingInfo_V01)custOrder.Shipping).Recipient.Middle; custAddress.Recipient = custAddress.FirstName + " " + custAddress.MiddleName + " " + custAddress.LastName; if (useAddressValidation) { if (!ShippingProvider.GetShippingProvider(custOrder.ProcessingCountry).CustomerAddressIsValid(custOrder.ProcessingCountry, ref custAddress)) { return(null); } } return(custAddress); }
protected void Page_Load(object sender, EventArgs e) { SessionInfo sessionInfo = SessionInfo.GetSessionInfo(DistributorID, Locale); CustomerOrder_V01 customerOrderV01 = CustomerOrderingProvider.GetCustomerOrderByOrderID(ShoppingCart.CustomerOrderDetail.CustomerOrderID); if (customerOrderV01 != null) { lblCustomerOrderDate.Text = customerOrderV01.Submitted.HasValue ? customerOrderV01.Submitted.Value.ToString() : String.Empty; lblCustomerOrderNumber.Text = customerOrderV01.FriendlyId; lblCustomerName.Text = String.Format("{0} {1} {2}", ((CustomerShippingInfo_V01)customerOrderV01.Shipping).Recipient .First, ((CustomerShippingInfo_V01)customerOrderV01.Shipping).Recipient .Middle, ((CustomerShippingInfo_V01)customerOrderV01.Shipping).Recipient .Last); lblOrderStatus.Text = GetCustomerOrderStatus(customerOrderV01.OrderStatus); lblCustomerComments.Text = customerOrderV01.CustomerNote; lblCustomerPaymentPreference.Text = GetPaymentMethodChoice(customerOrderV01); lblCustomerPrefferedShippingMethod.Text = GetCustomerShippingSpeed(((ServiceProvider.CustomerOrderSvc.CustomerShippingInfo_V01)customerOrderV01.Shipping).ShippingSpeed); //((CustomerShippingInfo_V01) customerOrderV01.Shipping).ShippingSpeed.ToString(); } if (!sessionInfo.CustomerOrderAddressWasValid) { lblErrors.Visible = true; lblErrors.Text = GetLocalResourceObject("CustomerAddressNotValid").ToString(); } var dictionary = new Dictionary <string, string>(); var orderTagValues = Enum.GetNames(typeof(CustomerOrderStatusTag)).ToList(); var entries = GlobalResourceHelper.GetGlobalEnumeratorElements("DistributorSelfNoteTags"); dictionary.Add("0", GetLocalResourceObject("Select").ToString()); foreach (var entry in entries.Where(entry => orderTagValues.Contains(entry.Key) && (CustomerOrderStatusTag) Enum.Parse(typeof(CustomerOrderStatusTag), entry.Key) != CustomerOrderStatusTag.None)) { dictionary.Add(entry.Key, entry.Value); } ddlNotesToSelf.DataSource = dictionary; ddlNotesToSelf.DataTextField = "Value"; ddlNotesToSelf.DataValueField = "Key"; ddlNotesToSelf.DataBind(); if (ShoppingCart.CustomerOrderDetail != null) { if (customerOrderV01 != null) { ListItem liSelectedTag = ddlNotesToSelf.Items.FindByValue(customerOrderV01.StatusTag.ToString()); if (liSelectedTag != null) { liSelectedTag.Selected = true; } } } if (!String.IsNullOrEmpty(sessionInfo.OrderNumber)) { ddlNotesToSelf.Enabled = false; if (customerOrderV01.PaymentMethodChoice == ServiceProvider.CustomerOrderSvc.CustomerPaymentMethodChoice.CreditCardOnline) { dvPaymentStatus.Visible = true; AuthorizationClientResponseType paymentStatus = GetPaymentStatus(customerOrderV01.CardAuthorizations); if (paymentStatus == AuthorizationClientResponseType.Approved) { lblCustomerPaymentStatus.Text = GetLocalResourceObject("PaymentStatusApproved").ToString(); } else { lblCustomerPaymentStatus.Text = GetLocalResourceObject("PaymentStatusDeclined").ToString(); } } } }