本文整理汇总了C#中Profile.Update方法的典型用法代码示例。如果您正苦于以下问题:C# Profile.Update方法的具体用法?C# Profile.Update怎么用?C# Profile.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile
的用法示例。
在下文中一共展示了Profile.Update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessCommerceParty
/// <summary>
/// Processes the commerce party.
/// </summary>
/// <param name="result">The result.</param>
/// <param name="customerProfile">The customer profile.</param>
/// <param name="partyToAdd">The party to add.</param>
/// <returns>Newly created party.</returns>
protected virtual Party ProcessCommerceParty(AddPartiesResult result, Profile customerProfile, RefSFModels.CommerceParty partyToAdd)
{
Assert.ArgumentNotNull(partyToAdd.Name, "partyToAdd.Name");
Assert.ArgumentNotNull(partyToAdd.ExternalId, "partyToAdd.ExternalId");
Profile addressProfile = null;
var response = this.CreateAddressProfile(partyToAdd.ExternalId, ref addressProfile);
if (!response.Success)
{
result.Success = false;
response.SystemMessages.ToList().ForEach(m => result.SystemMessages.Add(m));
return null;
}
var requestToCommerceProfile = new TranslateEntityToCommerceAddressProfileRequest(partyToAdd, addressProfile);
PipelineUtility.RunCommerceConnectPipeline<TranslateEntityToCommerceAddressProfileRequest, CommerceResult>(CommerceServerStorefrontConstants.PipelineNames.TranslateEntityToCommerceAddressProfile, requestToCommerceProfile);
addressProfile.Update();
ProfilePropertyListCollection<string> addressList;
var profileValue = customerProfile["GeneralInfo.address_list"].Value as object[];
if (profileValue != null)
{
var e = profileValue.Select(i => i.ToString());
addressList = new ProfilePropertyListCollection<string>(e);
}
else
{
addressList = new ProfilePropertyListCollection<string>();
}
addressList.Add(partyToAdd.ExternalId);
customerProfile["GeneralInfo.address_list"].Value = addressList.Cast<object>().ToArray();
if (partyToAdd.IsPrimary)
{
customerProfile["GeneralInfo.preferred_address"].Value = partyToAdd.ExternalId;
}
customerProfile.Update();
var newParty = this.EntityFactory.Create<RefSFModels.CommerceParty>("Party");
TranslateCommerceAddressProfileToEntityRequest requestToEntity = new TranslateCommerceAddressProfileToEntityRequest(addressProfile, newParty);
PipelineUtility.RunCommerceConnectPipeline<TranslateCommerceAddressProfileToEntityRequest, CommerceResult>(CommerceServerStorefrontConstants.PipelineNames.TranslateCommerceAddressProfileToEntity, requestToEntity);
return requestToEntity.DestinationParty;
}