本文整理汇总了C#中AddressType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# AddressType.ToString方法的具体用法?C# AddressType.ToString怎么用?C# AddressType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AddressType
的用法示例。
在下文中一共展示了AddressType.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToString
/// <summary>
/// Converts the address to a string using the specified address type. The address type will become the prefix,
/// eg using a brefix of AddressType.Billing will generate strings containing BillingSurname, BillingFirstnames etc
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public string ToString(AddressType type) {
string prefix = type.ToString();
var builder = new StringBuilder();
builder.Append(BuildPropertyString(prefix, x => x.Surname, Surname));
builder.Append(BuildPropertyString(prefix, x => x.Firstnames, Firstnames));
builder.Append(BuildPropertyString(prefix, x => x.Address1, Address1));
builder.Append(BuildPropertyString(prefix, x => x.Address2, Address2, true));
builder.Append(BuildPropertyString(prefix, x => x.City, City));
builder.Append(BuildPropertyString(prefix, x => x.PostCode, PostCode));
builder.Append(BuildPropertyString(prefix, x => x.Country, Country));
builder.Append(BuildPropertyString(prefix, x => x.State, State, true));
builder.Append(BuildPropertyString(prefix, x => x.Phone, Phone, true));
return builder.ToString();
}
示例2: GenerateAddressValidated
/// <summary>
/// Generate Random Address Object.
/// </summary>
/// <returns></returns>
public static Mozu.Api.Contracts.Core.Address GenerateAddressValidated(AddressType addressType = AddressType.Residential)
{
Mozu.Api.Contracts.Core.Address address = ReturnValidAddresses();
return new Mozu.Api.Contracts.Core.Address()
{
Address1 = address.Address1,
Address2 = address.Address2,
Address3 = address.Address3,
Address4 = address.Address4,
CityOrTown = address.CityOrTown,
CountryCode = address.CountryCode,
PostalOrZipCode = address.PostalOrZipCode,
StateOrProvince = address.StateOrProvince,
AddressType = addressType.ToString(),
IsValidated = true
};
}
示例3: GenerateAddressRandom
/// <summary>
/// Generate Random Address Object.
/// </summary>
/// <returns></returns>
public static Mozu.Api.Contracts.Core.Address GenerateAddressRandom(AddressType addressType = AddressType.Residential)
{
return new Mozu.Api.Contracts.Core.Address()
{
Address1 = string.Format("{0} {1}", Generator.RandomString(8, Generator.RandomCharacterGroup.NumericOnly), Generator.RandomString(75, Generator.RandomCharacterGroup.AlphaNumericOnly)),
Address2 = Generator.RandomString(49, Generator.RandomCharacterGroup.AlphaNumericOnly),
Address3 = Generator.RandomString(20, Generator.RandomCharacterGroup.AlphaNumericOnly),
Address4 = Generator.RandomString(15, Generator.RandomCharacterGroup.AlphaNumericOnly),
CityOrTown = Generator.RandomString(25, Generator.RandomCharacterGroup.AlphaOnly),
CountryCode = Generator.RandomString(2, Generator.RandomCharacterGroup.AlphaOnly),
PostalOrZipCode = Generator.RandomString(5, Generator.RandomCharacterGroup.AlphaOnly),
StateOrProvince = RandomState(),
AddressType = addressType.ToString()
};
}
示例4: GenerateAddress
/// <summary>
/// Generates a new Address object using <see cref="Address" /> class.
/// </summary>
/// <param name="addr1"></param>
/// <param name="addr2"></param>
/// <param name="addr3"></param>
/// <param name="addr4"></param>
/// <param name="city"></param>
/// <param name="country"></param>
/// <param name="zip"></param>
/// <param name="state"></param>
/// <returns></returns>
public static Mozu.Api.Contracts.Core.Address GenerateAddress(string addr1, string addr2, string addr3, string addr4,
string city, string country, string zip, string state, AddressType addressType = AddressType.Residential)
{
return new Mozu.Api.Contracts.Core.Address()
{
Address1 = addr1,
Address2 = addr2,
Address3 = addr3,
Address4 = addr4,
CountryCode = country,
CityOrTown = city,
PostalOrZipCode = zip,
StateOrProvince = state,
AddressType = addressType.ToString()
};
}