Files
elwig/Elwig/Models/Entities/PaymentCustom.cs
Lorenz Stechauner 4d89a17e80
All checks were successful
Test / Run tests (push) Successful in 2m8s
Billing: Allow users to add custom member modifiers before VAT
2024-08-13 14:43:12 +02:00

51 lines
1.6 KiB
C#

using Elwig.Helpers;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
namespace Elwig.Models.Entities {
[Table("payment_custom"), PrimaryKey("Year", "MgNr")]
public class PaymentCustom {
[Column("year")]
public int Year { get; set; }
[Column("mgnr")]
public int MgNr { get; set; }
[Column("mod_abs")]
public long? ModAbsValue { get; set; }
[NotMapped]
public decimal? ModAbs {
get => ModAbsValue != null ? Utils.DecFromDb(ModAbsValue.Value, 2) : null;
set => ModAbsValue = value != null ? Utils.DecToDb(value.Value, 2) : null;
}
[Column("mod_rel")]
public double? ModRelValue { get; set; }
[NotMapped]
public decimal? ModRel {
get => ModRelValue != null ? (decimal)ModRelValue.Value : null;
set => ModRelValue = value != null ? (double)value.Value : null;
}
[Column("mod_comment")]
public string? ModComment { get; set; }
[Column("amount")]
public long? AmountValue { get; set; }
[NotMapped]
public decimal? Amount {
get => AmountValue != null ? Utils.DecFromDb(AmountValue.Value, 2) : null;
set => AmountValue = value != null ? Utils.DecToDb(value.Value, 2) : null;
}
[Column("comment")]
public string? Comment { get; set; }
[ForeignKey("Year")]
public virtual Season Season { get; private set; } = null!;
[ForeignKey("MgNr")]
public virtual Member Member { get; private set; } = null!;
}
}