76 lines
2.0 KiB
C#
76 lines
2.0 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace gehGassi.Domain.Common
|
|
{
|
|
/// <summary>
|
|
/// Repräsentiert eine Adresse
|
|
/// </summary>
|
|
public class Address
|
|
{
|
|
/// <summary>
|
|
/// Optionale Adresszeile 1
|
|
/// </summary>
|
|
[MaxLength(100)]
|
|
public string AddressLine1 { get; set; }
|
|
|
|
/// <summary>
|
|
/// Optionale Adresszeile 2
|
|
/// </summary>
|
|
[MaxLength(100)]
|
|
public string AddressLine2 { get; set; }
|
|
|
|
/// <summary>
|
|
/// Optional: Stadt / Ort
|
|
/// </summary>
|
|
[MaxLength(100)]
|
|
public string City { get; set; }
|
|
|
|
/// <summary>
|
|
/// Optinale PLZ
|
|
/// </summary>
|
|
[MaxLength(20)]
|
|
public string Zip { get; set; }
|
|
|
|
/// <summary>
|
|
/// Bundesland / Staat
|
|
/// </summary>
|
|
[MaxLength(100)]
|
|
public string State { get; set; }
|
|
|
|
/// <summary>
|
|
/// ISO2 Ländercode
|
|
/// </summary>
|
|
[Required]
|
|
[MaxLength(2)]
|
|
public string CountryCode { get; set; }
|
|
|
|
public Address Clone()
|
|
{
|
|
var address = new Address()
|
|
{
|
|
AddressLine1 = AddressLine1,
|
|
AddressLine2 = AddressLine2,
|
|
City = City,
|
|
Zip = Zip,
|
|
State = State,
|
|
CountryCode = CountryCode
|
|
};
|
|
return address;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gibt zurück ob die Adresse alle notwendigen Informationen für den PaymentProvider beinhaltet
|
|
/// </summary>
|
|
/// <returns>true wenn verwendbar, false sonst</returns>
|
|
public bool ValidForPaymentProvider()
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(AddressLine1) && !string.IsNullOrWhiteSpace(City) && !string.IsNullOrWhiteSpace(Zip) && !string.IsNullOrWhiteSpace(State) && !string.IsNullOrWhiteSpace(CountryCode))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|