本文整理汇总了C#中IAddress.TrySplitFirstName方法的典型用法代码示例。如果您正苦于以下问题:C# IAddress.TrySplitFirstName方法的具体用法?C# IAddress.TrySplitFirstName怎么用?C# IAddress.TrySplitFirstName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAddress
的用法示例。
在下文中一共展示了IAddress.TrySplitFirstName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAddressRequest
/// <summary>
/// Creates an <see cref="AddressRequest"/>.
/// </summary>
/// <param name="address">
/// The address.
/// </param>
/// <returns>
/// The <see cref="AddressRequest"/>.
/// </returns>
public AddressRequest CreateAddressRequest(IAddress address)
{
return new AddressRequest()
{
FirstName = address.TrySplitFirstName(),
LastName = address.TrySplitLastName(),
Company = address.Organization,
StreetAddress = address.Address1,
ExtendedAddress = address.Address2,
Locality = address.Locality,
Region = address.Region,
PostalCode = address.PostalCode,
CountryCodeAlpha2 = address.CountryCode
};
}
示例2: IsEqual
/// <summary>
/// Performs an equality comparison between a Braintree <see cref="Address"/> and a Merchello <see cref="IAddress"/>.
/// </summary>
/// <param name="bta">
/// The Braintree address.
/// </param>
/// <param name="ma">
/// The Merchello address.
/// </param>
/// <returns>
/// Returns true if address properties match.
/// </returns>
private static bool IsEqual(this Address bta, IAddress ma)
{
var initial = bta.Company == ma.Organization && bta.StreetAddress == ma.Address1
&& bta.ExtendedAddress == ma.Address2 && bta.Locality == ma.Locality && bta.Region == ma.Region
&& bta.CountryCodeAlpha2 == ma.CountryCode && bta.PostalCode == ma.PostalCode;
if (!initial) return false;
if (!string.IsNullOrEmpty(ma.Name))
{
return bta.FirstName == ma.TrySplitFirstName() && bta.LastName == ma.TrySplitLastName();
}
return true;
}
示例3: CreateCreditCardAddressRequest
/// <summary>
/// Creates a <see cref="CreditCardRequest"/>.
/// </summary>
/// <param name="address">
/// The address.
/// </param>
/// <param name="isUpdate">
/// The is update.
/// </param>
/// <returns>
/// The <see cref="CreditCardAddressRequest"/>.
/// </returns>
public CreditCardAddressRequest CreateCreditCardAddressRequest(IAddress address, bool isUpdate = false)
{
return new CreditCardAddressRequest()
{
FirstName = address.TrySplitFirstName(),
LastName = address.TrySplitLastName(),
Company = address.Organization,
StreetAddress = address.Address1,
ExtendedAddress = address.Address2,
Locality = address.Locality,
Region = address.Region,
PostalCode = address.PostalCode,
CountryCodeAlpha2 = address.CountryCode,
Options = new CreditCardAddressOptionsRequest() { UpdateExisting = isUpdate }
};
}