Models: Update Payment models

This commit is contained in:
2024-01-05 09:53:05 +01:00
parent eb46955b3b
commit ba55692cbe
3 changed files with 15 additions and 10 deletions

View File

@ -16,6 +16,14 @@ namespace Elwig.Models.Entities {
[Column("avnr")] [Column("avnr")]
public int AvNr { get; set; } public int AvNr { get; set; }
[Column("net_amount")]
public long NetAmountValue { get; set; }
[NotMapped]
public decimal NetAmount {
get => Variant.Season.DecFromDb(NetAmountValue);
set => NetAmountValue = Variant.Season.DecToDb(value);
}
[Column("mod_abs")] [Column("mod_abs")]
public long ModAbsValue { get; set; } public long ModAbsValue { get; set; }
[NotMapped] [NotMapped]
@ -33,12 +41,9 @@ namespace Elwig.Models.Entities {
} }
[Column("amount")] [Column("amount")]
public long? AmountValue { get; set; } public long AmountValue { get; private set; }
[NotMapped] [NotMapped]
public decimal? Amount { public decimal Amount => Variant.Season.DecFromDb(AmountValue);
get => AmountValue != null ? Variant.Season.DecFromDb(AmountValue.Value) : null;
set => AmountValue = value != null ? Variant.Season.DecToDb(value.Value) : null;
}
[ForeignKey("Year, AvNr")] [ForeignKey("Year, AvNr")]
public virtual PaymentVar Variant { get; private set; } public virtual PaymentVar Variant { get; private set; }

View File

@ -39,12 +39,9 @@ namespace Elwig.Models.Entities {
} }
[Column("amount")] [Column("amount")]
public long AmountValue { get; set; } public long AmountValue { get; private set; }
[NotMapped] [NotMapped]
public decimal Amount { public decimal Amount => Variant.Season.DecFromDb(AmountValue);
get => Variant.Season.DecFromDb(AmountValue);
set => AmountValue = Variant.Season.DecToDb(value);
}
[ForeignKey("Year, AvNr")] [ForeignKey("Year, AvNr")]
public virtual PaymentVar Variant { get; private set; } public virtual PaymentVar Variant { get; private set; }

View File

@ -51,6 +51,9 @@ namespace Elwig.Models.Entities {
[InverseProperty("Variant")] [InverseProperty("Variant")]
public virtual ISet<PaymentMember> MemberPayments { get; private set; } public virtual ISet<PaymentMember> MemberPayments { get; private set; }
[InverseProperty("Variant")]
public virtual ISet<PaymentDeliveryPart> DeliveryPartPayments { get; private set; }
[InverseProperty("Variant")] [InverseProperty("Variant")]
public virtual ISet<Credit> Credits { get; private set; } public virtual ISet<Credit> Credits { get; private set; }
} }