using System; using System.Linq; using System.Windows.Media; using BS.Shared.DataContracts.ClientPartials; namespace BS.Shared.DataContracts.Compact { public partial class CompactCustomerDC : IFilterableDC, IInvoiceRecipient, IMoKSearchableDC { 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 + " " + AddressString + " " + MainAttendant + " " + Teams; if (this.CostBearerReferenceNumbers != null) { lResult += string.Join(" ", this.CostBearerReferenceNumbers.Values.ToArray()); } return lResult; } } /// /// Vorname Nachname /// 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 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 string Teams { get { return this.RelatedTeams; } } 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(); } } public long? Oid => CustomerOid; public long EntityOid => CustomerOid; } }