Add DeliveryAdminWindow
This commit is contained in:
@ -44,11 +44,14 @@ namespace Elwig.Models {
|
||||
|
||||
public string ShortName => GivenName + " " + FamilyName;
|
||||
|
||||
public string AdministrativeName =>
|
||||
FamilyName.ToUpper() + " " +
|
||||
public string AdministrativeName => AdministrativeName1 + " " + AdministrativeName2;
|
||||
|
||||
public string AdministrativeName1 => FamilyName.ToUpper();
|
||||
|
||||
public string AdministrativeName2 =>
|
||||
(Prefix != null ? Prefix + " " : "") +
|
||||
GivenName +
|
||||
(MiddleName != null ? " " + MiddleName: "") +
|
||||
(MiddleName != null ? " " + MiddleName : "") +
|
||||
(Suffix != null ? " " + Suffix : "");
|
||||
|
||||
[Column("birthday")]
|
||||
@ -174,6 +177,8 @@ namespace Elwig.Models {
|
||||
[InverseProperty("Member")]
|
||||
public virtual ISet<Delivery> Deliveries { get; private set; }
|
||||
|
||||
public string FullAddress => $"{Address}, {PostalDest.AtPlz.Plz} {PostalDest.AtPlz.Ort.Name}";
|
||||
|
||||
public int SearchScore(IEnumerable<string> keywords) {
|
||||
keywords = keywords.Where(s => s.Length >= 2 || (s.Length > 0 && s.All(c => char.IsAsciiDigit(c))));
|
||||
if (!keywords.Any())
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Elwig.Models {
|
||||
@ -38,5 +39,12 @@ namespace Elwig.Models {
|
||||
[ForeignKey("Year")]
|
||||
public virtual Season Season { get; private set; }
|
||||
|
||||
public string ValueStr => (Abs != null) ?
|
||||
$"{(Abs < 0 ? " -" : "+")}{Math.Abs(Abs.Value)} {Season.Currency.Symbol}/kg" :
|
||||
$"{(Rel < 0 ? " -" : "+")}{Math.Abs(Rel.Value):P2}";
|
||||
|
||||
public override string ToString() {
|
||||
return Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
|
||||
namespace Elwig.Models {
|
||||
[Table("wine_origin"), PrimaryKey("HkId"), Index("Name", IsUnique = true)]
|
||||
@ -22,5 +24,21 @@ namespace Elwig.Models {
|
||||
|
||||
[InverseProperty("Origin")]
|
||||
public virtual ISet<WbGem> Gems { get; private set; }
|
||||
|
||||
[InverseProperty("Parent")]
|
||||
public virtual ISet<WineOrigin> Children { get; private set; }
|
||||
|
||||
public int Level => (Parent?.Level + 1) ?? 0;
|
||||
|
||||
public string HkIdLevel => $"{new string(' ', Level * 2)}{HkId}";
|
||||
|
||||
public int TotalChildNum => 1 + Children.Select(c => c.TotalChildNum).Sum();
|
||||
|
||||
private int SortKey1 => (Parent?.SortKey1 ?? 0) | (TotalChildNum << ((3 - Level) * 8));
|
||||
public int SortKey => SortKey1 | ((Level < 3) ? (-1 >>> (Level * 8 + 8)) : 0);
|
||||
|
||||
public override string ToString() {
|
||||
return Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,5 +15,11 @@ namespace Elwig.Models {
|
||||
|
||||
[Column("comment")]
|
||||
public string? Comment { get; private set; }
|
||||
|
||||
public string NameWithComment => Name + ((Comment != null) ? $" ({Comment})" : "");
|
||||
|
||||
public override string ToString() {
|
||||
return Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user