88 lines
2.6 KiB
C#
88 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using gehGassiApp.Domain.Base;
|
|
using gehGassiApp.Domain.Common;
|
|
|
|
namespace gehGassiApp.Domain.Lookup
|
|
{
|
|
/// <summary>
|
|
/// Lookup für dogOwner und DogWalker
|
|
/// </summary>
|
|
public class AppUserLookup : SyncEntity
|
|
{
|
|
/// <summary>
|
|
/// Vorname
|
|
/// </summary>
|
|
public string FirstName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Nachname
|
|
/// </summary>
|
|
public string LastName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Optional - Foto des Benutzers
|
|
/// </summary>
|
|
public string Photo { get; set; }
|
|
|
|
/// <summary>
|
|
/// Typ der Entität
|
|
/// </summary>
|
|
public AppUserType Type { get; set; }
|
|
|
|
/// <summary>
|
|
/// Hinweis auf den Ort wo jemand zu Hause ist
|
|
/// </summary>
|
|
public string LocationHint { get; set; }
|
|
|
|
/// <summary>
|
|
/// Breitengrad der Adresse
|
|
/// </summary>
|
|
public double Lat { get; set; }
|
|
|
|
/// <summary>
|
|
/// Längengrad der Adresse
|
|
/// </summary>
|
|
public double Lng { get; set; }
|
|
|
|
/// <summary>
|
|
/// Distanz zum Lookup
|
|
/// </summary>
|
|
public double Distance { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gibt die Initialien zurück
|
|
/// </summary>
|
|
public string Initials
|
|
{
|
|
get
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(FirstName) && !string.IsNullOrWhiteSpace(LastName))
|
|
return $"{FirstName.Substring(0, 1)}{LastName.Substring(0, 1)}";
|
|
else if(!string.IsNullOrWhiteSpace(FirstName) && FirstName.Length >= 2 && string.IsNullOrWhiteSpace(LastName))
|
|
return $"{FirstName.Substring(0, 2)}";
|
|
else if (string.IsNullOrWhiteSpace(FirstName) && string.IsNullOrWhiteSpace(LastName) && LastName.Length >= 2)
|
|
return $"{LastName.Substring(0, 2)}";
|
|
else
|
|
return "??";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Voller Name
|
|
/// </summary>
|
|
public string FullName => $"{FirstName} {LastName}";
|
|
|
|
/// <summary>
|
|
/// Vorname + Nachname erster Buchstabe + Punkt, oder nur Vorname wenn kein Nachname
|
|
/// </summary>
|
|
[NotMapped]
|
|
public string FullNameShort => string.IsNullOrWhiteSpace(LastName) ? FirstName : $"{FirstName} {LastName[..1]}.";
|
|
}
|
|
}
|