[#20][#80] Elwig: Update member_history and add different types of shares
Test / Run tests (push) Successful in 2m25s

This commit is contained in:
2026-07-01 11:01:15 +02:00
parent 4ebe07f579
commit f04cbe7399
36 changed files with 843 additions and 262 deletions
+43 -9
View File
@@ -1,12 +1,23 @@
using Elwig.Helpers;
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Elwig.Models.Entities {
[Table("member_history"), PrimaryKey("MgNr", "DateString", "Type")]
[Table("member_history"), PrimaryKey("HistNr")]
public class MemberHistory {
[Column("mgnr")]
public int MgNr { get; set; }
[Column("histnr")]
public int HistNr { get; set; }
[Column("from_mgnr")]
public int? FromMgNr { get; set; }
[Column("from_type")]
public int? FromType { get; set; }
[Column("to_mgnr")]
public int? ToMgNr { get; set; }
[Column("to_type")]
public int? ToType { get; set; }
[Column("date")]
public required string DateString { get; set; }
@@ -16,16 +27,39 @@ namespace Elwig.Models.Entities {
set => value.ToString("yyyy-MM-dd");
}
[Column("type")]
public required string Type { get; set; }
[Column("reason")]
public required string Reason { get; set; }
[Column("business_shares")]
public int BusinessShares { get; set; }
[Column("source")]
public required string Source { get; set; }
[Column("shares")]
public int Shares { get; set; }
[Column("value_per_share")]
public long? ValuePerShareValue { get; set; }
[NotMapped]
public decimal? ValuePerShare {
get => ValuePerShareValue != null ? Utils.DecFromDb(ValuePerShareValue.Value, 2) : null;
set => ValuePerShareValue = value != null ? Utils.DecToDb(value.Value, 2) : null;
}
[NotMapped]
public decimal? TotalValue => Shares * ValuePerShare;
[Column("currency")]
public string? CurrencyCode { get; set; }
[Column("comment")]
public string? Comment { get; set; }
[ForeignKey("MgNr")]
public virtual Member Member { get; private set; } = null!;
[ForeignKey("FromMgNr")]
public virtual Member FromMember { get; private set; } = null!;
[ForeignKey("ToMgNr")]
public virtual Member ToMember { get; private set; } = null!;
[ForeignKey("CurrencyCode")]
public virtual Currency Currency { get; private set; } = null!;
}
}