Modifier: change Rel type from double to decimal

This commit is contained in:
2023-09-01 17:18:52 +02:00
parent c1d3a9042d
commit 286e3515d4
2 changed files with 11 additions and 9 deletions

View File

@ -10,7 +10,7 @@ namespace Elwig.Helpers.Billing {
private readonly int AvNr; private readonly int AvNr;
private readonly AppDbContext Context; private readonly AppDbContext Context;
private readonly Dictionary<string, string> Attributes; private readonly Dictionary<string, string> Attributes;
private readonly Dictionary<string, (decimal?, double?)> Modifiers; private readonly Dictionary<string, (decimal?, decimal?)> Modifiers;
private readonly Dictionary<string, (string, string?, string?, string?, int?, int?, decimal?)> AreaComTypes; private readonly Dictionary<string, (string, string?, string?, string?, int?, int?, decimal?)> AreaComTypes;
public Billing(int year, int avnr) { public Billing(int year, int avnr) {

View File

@ -23,16 +23,18 @@ namespace Elwig.Models {
[NotMapped] [NotMapped]
public decimal? Abs { public decimal? Abs {
get { get => AbsValue != null ? Season.DecFromDb(AbsValue.Value) : null;
return AbsValue != null ? Season.DecFromDb(AbsValue.Value) : null; set => AbsValue = value != null ? Season.DecToDb(value.Value) : null;
}
set {
AbsValue = value != null ? Season.DecToDb(value.Value) : null;
}
} }
[Column("rel")] [Column("rel")]
public double? Rel { get; set; } public double? RelValue { get; set; }
[NotMapped]
public decimal? Rel {
get => (decimal?)RelValue;
set => RelValue = (double?)value;
}
[Column("standard")] [Column("standard")]
public bool IsStandard { get; set; } public bool IsStandard { get; set; }
@ -45,7 +47,7 @@ namespace Elwig.Models {
public string ValueStr => public string ValueStr =>
(Abs != null) ? $"{Utils.GetSign(Abs.Value)}{Math.Abs(Abs.Value)}\u00a0{Season.Currency.Symbol}/kg" : (Abs != null) ? $"{Utils.GetSign(Abs.Value)}{Math.Abs(Abs.Value)}\u00a0{Season.Currency.Symbol}/kg" :
(Rel != null) ? $"{Utils.GetSign(Rel.Value)}{(Math.Abs(Rel.Value) < 0.1 ? "\u2007" : "")}{Math.Abs(Rel.Value):0.00##\u00a0%}" : (Rel != null) ? $"{Utils.GetSign(Rel.Value)}{(Math.Abs(Rel.Value) < 0.1m ? "\u2007" : "")}{Math.Abs(Rel.Value):0.00##\u00a0%}" :
""; "";
public override string ToString() { public override string ToString() {