[#54] Member: Add IsJuridicalPerson
All checks were successful
Test / Run tests (push) Successful in 2m49s
All checks were successful
Test / Run tests (push) Successful in 2m49s
This commit is contained in:
@ -55,11 +55,13 @@ namespace Elwig.Services {
|
||||
vm.IsMemberSelected = true;
|
||||
vm.MgNrString = $"{m.MgNr}";
|
||||
vm.PredecessorMgNrString = $"{m.PredecessorMgNr}";
|
||||
vm.IsJuridicalPerson = m.IsJuridicalPerson;
|
||||
vm.EnableMemberReferenceButton = m.PredecessorMgNr != null;
|
||||
vm.Prefix = m.Prefix;
|
||||
vm.GivenName = m.GivenName;
|
||||
vm.FamilyName = m.FamilyName;
|
||||
vm.Name = m.Name;
|
||||
vm.Suffix = m.Suffix;
|
||||
vm.ForTheAttentionOf = m.ForTheAttentionOf;
|
||||
vm.Birthday = (m.Birthday != null) ? string.Join(".", m.Birthday.Split("-").Reverse()) : null;
|
||||
if (m.Birthday?.Length == 10) {
|
||||
vm.Age = Utils.GetAge(DateOnly.ParseExact(m.Birthday, "yyyy-MM-dd")).ToString();
|
||||
@ -109,7 +111,7 @@ namespace Elwig.Services {
|
||||
|
||||
var billingAddr = m.BillingAddress;
|
||||
if (billingAddr != null) {
|
||||
vm.BillingName = billingAddr.Name;
|
||||
vm.BillingName = billingAddr.FullName;
|
||||
vm.BillingAddress = billingAddr.Address;
|
||||
if (billingAddr.PostalDest.AtPlz is AT_PlzDest b) {
|
||||
vm.BillingPlzString = $"{b.Plz}";
|
||||
@ -150,8 +152,12 @@ namespace Elwig.Services {
|
||||
vm.StatusDeliveriesThisSeasonToolTip = d2Grid;
|
||||
|
||||
var c = m.ActiveAreaCommitments(ctx, Utils.CurrentLastSeason);
|
||||
var s = await ctx.Seasons.FindAsync(await ctx.Seasons.MaxAsync(s => s.Year));
|
||||
var (text, grid) = await AreaComService.GenerateToolTip(c, s?.MaxKgPerHa ?? 10_000);
|
||||
int maxKgPerHa = 10_000;
|
||||
try {
|
||||
var s = await ctx.Seasons.FindAsync(await ctx.Seasons.MaxAsync(s => s.Year));
|
||||
if (s != null) maxKgPerHa = s.MaxKgPerHa;
|
||||
} catch { }
|
||||
var (text, grid) = await AreaComService.GenerateToolTip(c, maxKgPerHa);
|
||||
vm.StatusAreaCommitmentInfo = $"{Utils.CurrentLastSeason}";
|
||||
vm.StatusAreaCommitment = text;
|
||||
vm.StatusAreaCommitmentToolTip = grid;
|
||||
@ -392,14 +398,14 @@ namespace Elwig.Services {
|
||||
} else if (vm.MemberListOrderByName) {
|
||||
query = query
|
||||
.OrderBy(m => m.Branch!.Name)
|
||||
.ThenBy(m => m.FamilyName)
|
||||
.ThenBy(m => m.Name)
|
||||
.ThenBy(m => m.GivenName)
|
||||
.ThenBy(m => m.MgNr);
|
||||
} else if (vm.MemberListOrderByOrt) {
|
||||
query = query
|
||||
.OrderBy(m => m.Branch!.Name)
|
||||
.ThenBy(m => m.DefaultWbKg!.AtKg.Name)
|
||||
.ThenBy(m => m.FamilyName)
|
||||
.ThenBy(m => m.Name)
|
||||
.ThenBy(m => m.GivenName)
|
||||
.ThenBy(m => m.MgNr);
|
||||
}
|
||||
@ -497,10 +503,12 @@ namespace Elwig.Services {
|
||||
var m = new Member {
|
||||
MgNr = oldMgNr ?? newMgNr,
|
||||
PredecessorMgNr = vm.PredecessorMgNr,
|
||||
Prefix = string.IsNullOrEmpty(vm.Prefix) ? null : vm.Prefix,
|
||||
GivenName = vm.GivenName!,
|
||||
FamilyName = vm.FamilyName!,
|
||||
Suffix = string.IsNullOrEmpty(vm.Suffix) ? null : vm.Suffix,
|
||||
IsJuridicalPerson = vm.IsJuridicalPerson,
|
||||
Prefix = vm.IsJuridicalPerson || string.IsNullOrWhiteSpace(vm.Prefix) ? null : vm.Prefix,
|
||||
GivenName = vm.IsJuridicalPerson || string.IsNullOrWhiteSpace(vm.GivenName) ? null : vm.GivenName,
|
||||
Name = vm.Name!,
|
||||
Suffix = vm.IsJuridicalPerson || string.IsNullOrWhiteSpace(vm.Suffix) ? null : vm.Suffix,
|
||||
ForTheAttentionOf = !vm.IsJuridicalPerson || string.IsNullOrWhiteSpace(vm.ForTheAttentionOf) ? null : vm.ForTheAttentionOf,
|
||||
Birthday = string.IsNullOrEmpty(vm.Birthday) ? null : string.Join("-", vm.Birthday!.Split(".").Reverse()),
|
||||
IsDeceased = vm.IsDeceased,
|
||||
CountryNum = 40, // Austria AT AUT
|
||||
@ -540,7 +548,7 @@ namespace Elwig.Services {
|
||||
var p = vm.BillingOrt;
|
||||
ctx.Add(new BillingAddr {
|
||||
MgNr = m.MgNr,
|
||||
Name = vm.BillingName,
|
||||
FullName = vm.BillingName,
|
||||
Address = vm.BillingAddress ?? "",
|
||||
CountryNum = p.CountryNum,
|
||||
PostalDestId = p.Id,
|
||||
|
Reference in New Issue
Block a user