private List <EmailParty> GetEmailAddressPartiesFromShippingMethods(List <ShippingMethodInputModelItem> inputModelList) { List <EmailParty> emailPartyList = null; if (inputModelList != null && inputModelList.Any()) { var i = 1; foreach (var inputModel in inputModelList) { if (ShippingOptionType.ElectronicDelivery == System.Convert.ToInt32(inputModel.ShippingPreferenceType, CultureInfo.InvariantCulture)) { if (emailPartyList == null) { emailPartyList = new List <EmailParty>(); } var party = new EmailParty(); party.ExternalId = Guid.NewGuid().ToString(); party.Name = $"Shipping_Email_{i}"; party.Email = inputModel.ElectronicDeliveryEmail; party.Text = inputModel.ElectronicDeliveryEmailContent; emailPartyList.Add(party); // Set the party id to the newly created email party in order to create the association in CS. inputModel.PartyId = party.ExternalId; i++; } } } return(emailPartyList); }
/// <summary> /// Gets the email address parties from shipping methods. /// </summary> /// <param name="inputModelList">The input model list.</param> /// <returns>A list of email parties if the email shipping method has been specified.</returns> protected virtual List <EmailParty> GetEmailAddressPartiesFromShippingMethods(List <ShippingMethodInputModelItem> inputModelList) { List <EmailParty> emailPartyList = null; if (inputModelList != null && inputModelList.Any()) { int i = 1; foreach (var inputModel in inputModelList) { if (ShippingOptionType.ElectronicDelivery == Convert.ToInt32(inputModel.ShippingPreferenceType, CultureInfo.InvariantCulture)) { if (emailPartyList == null) { emailPartyList = new List <EmailParty>(); } EmailParty party = new EmailParty(); party.ExternalId = Guid.NewGuid().ToString(); party.Name = string.Format(CultureInfo.InvariantCulture, "{0}{1}", CommerceServerStorefrontConstants.CartConstants.EmailAddressNamePrefix, i); party.Email = inputModel.ElectronicDeliveryEmail; party.Text = inputModel.ElectronicDeliveryEmailContent; emailPartyList.Add(party); // Set the party id to the newly created email party in order to create the association in CS. inputModel.PartyID = party.ExternalId; i++; } } } return(emailPartyList); }
/// <summary> /// Translates to email party. /// </summary> /// <param name="sourceAddress">The source address.</param> /// <param name="destinationParty">The destination party.</param> protected virtual void TranslateToEmailParty(OrderAddress sourceAddress, EmailParty destinationParty) { destinationParty.ExternalId = sourceAddress.OrderAddressId; destinationParty.Name = sourceAddress.Name; destinationParty.Email = sourceAddress.Email; destinationParty.FirstName = sourceAddress.FirstName; destinationParty.LastName = sourceAddress.LastName; destinationParty.Company = sourceAddress.Organization; destinationParty.Text = sourceAddress[CommerceServerStorefrontConstants.KnowWeaklyTypesProperties.EmailText] as string; this.TranslateToCustomAddressProperties(sourceAddress, destinationParty); }
/// <summary> /// Translates the email party. /// </summary> /// <param name="sourceParty">The source party.</param> /// <param name="destinationAddress">The destination address.</param> protected virtual void TranslateEmailParty([NotNull] EmailParty sourceParty, [NotNull] OrderAddress destinationAddress) { Assert.ArgumentNotNullOrEmpty(sourceParty.Name, "sourceParty.Name"); destinationAddress.Name = sourceParty.Name; destinationAddress.Email = sourceParty.Email; destinationAddress.FirstName = sourceParty.FirstName; destinationAddress.LastName = sourceParty.LastName; destinationAddress.Organization = sourceParty.Company; destinationAddress[CommerceServerStorefrontConstants.KnowWeaklyTypesProperties.EmailText] = sourceParty.Text; this.TranslateEmailPartyCustomProperties(sourceParty, destinationAddress); }
/// <summary> /// Translates to custom address properties. /// </summary> /// <param name="sourceAddress">The source address.</param> /// <param name="destinationParty">The destination party.</param> protected virtual void TranslateToCustomAddressProperties([NotNull] CommerceServer.Core.Runtime.Orders.OrderAddress sourceAddress, [NotNull] EmailParty destinationParty) { }
/// <summary> /// Translates the custom properties. /// </summary> /// <param name="sourceParty">The source party.</param> /// <param name="destinationAddress">The destination address.</param> protected virtual void TranslateEmailPartyCustomProperties([NotNull] EmailParty sourceParty, [NotNull] OrderAddress destinationAddress) { destinationAddress[CommerceServerStorefrontConstants.KnowWeaklyTypesProperties.PartyType] = 2; }
/// <summary> /// Translates the address. /// </summary> /// <param name="sourceAddress">The source address.</param> /// <param name="destinationParty">The destination party.</param> protected virtual void TranslateAddress(OrderAddress sourceAddress, EmailParty destinationParty) { TranslateOrderAddressToEntityRequest request = new TranslateOrderAddressToEntityRequest(sourceAddress, destinationParty); PipelineUtility.RunCommerceConnectPipeline <TranslateOrderAddressToEntityRequest, CommerceResult>(PipelineNames.TranslateOrderAddressToEntity, request); }
/// <summary> /// Translates to custom address properties. /// </summary> /// <param name="sourceAddress">The source address.</param> /// <param name="destinationParty">The destination party.</param> protected virtual void TranslateToCustomAddressProperties([NotNull] OrderAddress sourceAddress, [NotNull] EmailParty destinationParty) { }
/// <summary> /// Translates the address. /// </summary> /// <param name="sourceAddress">The source address.</param> /// <param name="destinationParty">The destination party.</param> protected virtual void TranslateAddress(CommerceServer.Core.Runtime.Orders.OrderAddress sourceAddress, EmailParty destinationParty) { RefSFArguments.TranslateOrderAddressToEntityRequest request = new RefSFArguments.TranslateOrderAddressToEntityRequest(sourceAddress, destinationParty); PipelineUtility.RunCommerceConnectPipeline <RefSFArguments.TranslateOrderAddressToEntityRequest, CommerceResult>(PipelineNames.TranslateOrderAddressToEntity, request); }