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

@ -23,16 +23,18 @@ namespace Elwig.Models {
[NotMapped]
public decimal? Abs {
get {
return AbsValue != null ? Season.DecFromDb(AbsValue.Value) : null;
}
set {
AbsValue = value != null ? Season.DecToDb(value.Value) : null;
}
get => AbsValue != null ? Season.DecFromDb(AbsValue.Value) : null;
set => AbsValue = value != null ? Season.DecToDb(value.Value) : null;
}
[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")]
public bool IsStandard { get; set; }
@ -45,7 +47,7 @@ namespace Elwig.Models {
public string ValueStr =>
(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() {