using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MagMan.Data.DbModels { // // This is here so CodeMaid doesn't reorganize this document // //[Index(nameof(Installazione), nameof(Active), nameof(DiskStatus))] [Table("ItemsList")] public partial class ItemModel { /// /// Primary Key AUTO /// [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int ItemID { get; set; } /// /// Ext ref for Material /// public int MatID { get; set; } = 0; /// /// Check if is a Remnant /// public bool IsRemn { get; set; } = false; /// /// 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); /// /// Item's Lenght /// public decimal LMm { get; set; } = 0; /// /// Item's Width /// public decimal WMm { get; set; } = 0; /// /// Item'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 ItemDtmx { 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!; } }