using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace NKC.Data.DbModels { // // This is here so CodeMaid doesn't reorganize this document // //[Index(nameof(Installazione), nameof(Active), nameof(DiskStatus))] [Table("RemnantsList")] public partial class RemnantsModel { /// /// Primary Key AUTO /// [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int RemnID { get; set; } /// /// Ext ref for Material /// public int MatID { get; set; } /// /// Location /// public string Location { get; set; } = ""; /// /// Qty available on wharehouse /// public int QtyAvail { get; set; } = 0; /// /// DateTime last modification /// public DateTime DtMod { get; set; } = DateTime.Now.AddYears(10); /// /// Remnant's Lenght /// public decimal LMm { get; set; } = 0; /// /// Remnant's Width /// public decimal WMm { get; set; } = 0; /// /// Remnant's Thikness /// public decimal TMm { get; set; } = 0; [NotMapped] public decimal LIn { get => Math.Round(LMm / (decimal)25.4, 3); } [NotMapped] public decimal WIn { get => Math.Round(WMm / (decimal)25.4, 3); } [NotMapped] public decimal TIn { get => Math.Round(TMm / (decimal)25.4, 3); } /// /// Note (optional) /// public string Note { get; set; } = ""; [NotMapped] public decimal Area { get => LMm * WMm; } [NotMapped] public string RemDtmx { get { string answ = $"MT99999999-{LMm * 1000:00000000}"; if (MaterialNav != null) { answ = $"MT{MaterialNav.MatExtCode:00000000}-{LMm * 1000:00000000}"; } return answ; } } /// /// Navigation property to Material /// [ForeignKey("MatID")] public virtual MaterialModel MaterialNav { get; set; } = null!; } }