52 lines
1.7 KiB
C#
52 lines
1.7 KiB
C#
using Elwig.Helpers;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace Elwig.Models {
|
|
[Table("area_commitment_type"), PrimaryKey("VtrgId"), Index("SortId", "AttrId1", "AttrId2", "Discriminator")]
|
|
public class AreaComType {
|
|
[Column("vtrgid")]
|
|
public string VtrgId { get; set; }
|
|
|
|
[Column("sortid")]
|
|
public string SortId { get; set; }
|
|
|
|
[Column("attrid_1")]
|
|
public string? AttrId1 { get; set; }
|
|
|
|
[Column("attrid_2")]
|
|
public string? AttrId2 { get; set; }
|
|
|
|
[Column("disc")]
|
|
public string? Discriminator { get; set; }
|
|
|
|
[Column("min_kg_per_ha")]
|
|
public int? MinKgPerHa { get; set; }
|
|
|
|
[Column("max_kg_per_ha")]
|
|
public int? MaxKgPerHa { get; set; }
|
|
|
|
[Column("penalty_amount")]
|
|
public long? PenaltyAmoutValue { get; set; }
|
|
|
|
[NotMapped]
|
|
public decimal? PenaltyAmount {
|
|
get => PenaltyAmoutValue != null ? Utils.DecFromDb(PenaltyAmoutValue.Value, 4) : null;
|
|
set => PenaltyAmoutValue = value != null ? Utils.DecToDb(value.Value, 4) : null;
|
|
}
|
|
|
|
[ForeignKey("SortId")]
|
|
public virtual WineVar WineVar { get; private set; }
|
|
|
|
[ForeignKey("AttrId1")]
|
|
public virtual WineAttr? WineAttr1 { get; private set; }
|
|
|
|
[ForeignKey("AttrId2")]
|
|
public virtual WineAttr? WineAttr2 { get; private set; }
|
|
|
|
[NotMapped]
|
|
public string DisplayName => WineVar.Name + (WineAttr1 != null ? $" {WineAttr1.Name}" : "") +
|
|
(WineAttr2 != null ? $" {WineAttr2.Name}" : "") + (Discriminator != null ? $" ({Discriminator})" : "");
|
|
}
|
|
}
|