Files
BeWoPlaner/Shared/DataContracts/Compact/ClientPartials/CompactCustomerDC.cs
2020-07-07 16:09:48 +02:00

184 lines
4.3 KiB
C#

using System;
using System.Linq;
using System.Windows.Media;
namespace BS.Shared.DataContracts.Compact
{
public partial class CompactCustomerDC : IFilterableDC, IInvoiceRecipient
{
public string AddressString
{
get
{
string address = this.Street;
if (address != null && address.Length > 0)
{
address += ", ";
}
return address + this.PostalCode + " " + this.Town;
}
}
public string DateOfBirthString
{
get
{
if (this.DateOfBirth != null)
{
return "*" + this.DateOfBirth.Value.ToShortDateString();
}
return null;
}
}
public decimal? DefaultAmount
{
get
{
return this.EquityContribution;
}
}
public string DetailDescription
{
get
{
return this.ToString();
}
}
public string FilterRelevants
{
get
{
string lResult = this.FirstName + " " + this.LastName + " " + CustomerAlias + " ";
if (this.CostBearerReferenceNumbers != null)
{
lResult += string.Join(" ", this.CostBearerReferenceNumbers.Values.ToArray());
}
return lResult;
}
}
/// <summary>
/// Vorname Nachname
/// </summary>
public string FullName
{
get
{
return this.FirstName + " " + this.LastName;
}
}
public string IconPath
{
get
{
return @"..\Ressources\Icons\UserHomeMaleDisabled.png";
}
}
public string InvoiceAddressString
{
get
{
return this.Street + Environment.NewLine + this.PostalCode + " " + this.Town;
}
}
public bool IsArchived
{
get { return ActivationType == ActivationTypeId.Archived; }
}
public bool IsDeleted => ActivationType == ActivationTypeId.Deleted;
public string Name
{
get
{
return this.FullName;
}
}
public long? Oid
{
get
{
return this.CustomerOid;
}
}
public SolidColorBrush FilterableBrush { get { return new SolidColorBrush(Colors.Transparent); } }
public string SimpleDescription
{
get
{
if (!String.IsNullOrEmpty(CustomerAlias))
{
return String.Format("{0} ({1})", ToString(), CustomerAlias);
}
return ToString();
}
}
public bool SupportsActivationType
{
get
{
return true;
}
}
public long Version
{
get
{
return this.CustomerVersion;
}
set
{
this.CustomerVersion = value;
}
}
public override bool Equals(object obj)
{
if (obj is CompactCustomerDC)
{
return this.CustomerOid == ((CompactCustomerDC)obj).CustomerOid;
}
return false;
}
public override int GetHashCode()
{
return this.GetType().Name.GetHashCode() ^ this.CustomerOid.GetHashCode();
}
public override string ToString()
{
if (String.IsNullOrEmpty(this.LastName))
return this.FirstName;
if (String.IsNullOrEmpty(this.FirstName))
return this.LastName;
return this.LastName + ", " + this.FirstName;
}
public string LastNameFirstName
{
get { return ToString(); }
}
}
}