using CMS_CORE_Library.Models; using Newtonsoft.Json; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Runtime.Serialization; namespace Step.Model.DatabaseModels { [Table("family")] public class DbNcFamilyModel { [Key] [DatabaseGenerated(DatabaseGeneratedOption.None)] [Column("id")] public short FamilyId { get; set; } [Column("name")] public string Name { get; set; } [Column("type")] public byte ToolType { get; set; } [Column("right_size")] public byte RightSize { get; set; } [Column("left_size")] public byte LeftSize { get; set; } [Column("tcp_table")] public byte TcpTable { get; set; } [Column("gamma")] public byte Gamma { get; set; } [Column("rotation_type")] public byte RotationType { get; set; } [Column("cooling_byte")] public byte CoolingByte { get; set; } [Column("max_speed")] public int MaxSpeed { get; set; } [Column("max_load")] public byte MaxLoad { get; set; } [Column("min_load_pct_autoload")] public byte MinLoadPctAutoload { get; set; } [Column("max_load_pct_autoload")] public byte MaxLoadPctAutoload { get; set; } [Column("dynamic_compensation")] public byte DynamicCompensation { get; set; } [Column("min_load_dynamic_comp")] public byte MinLoadDynamicCompensation { get; set; } [Column("max_load_dynamic_comp")] public byte MaxLoadDynamicCompensation { get; set; } [Column("life_type")] public byte LifeType { get; set; } [Column("nominal_life")] public int NominalLife { get; set; } [Column("revive_delta")] public int ReviveDelta { get; set; } [JsonIgnore] [IgnoreDataMember] public List Tools { get; set; } public static explicit operator NcFamilyModel(DbNcFamilyModel obj) { return new NcFamilyModel() { FamilyId = (ushort)obj.FamilyId, ToolType = obj.ToolType, RightSize = obj.RightSize, LeftSize = obj.LeftSize, TcpTable = obj.TcpTable, Gamma = obj.Gamma, CoolingByte = obj.CoolingByte, RotationType = obj.RotationType, MaxLoad = obj.MaxLoad, MaxSpeed = (ushort)obj.MaxSpeed, MinLoadPctAutoload = obj.MinLoadPctAutoload, MaxLoadPctAutoload = obj.MaxLoadPctAutoload, MinLoadDynamicCompensation = obj.MinLoadDynamicCompensation, MaxLoadDynamicCompensation = obj.MaxLoadDynamicCompensation, DynamicCompensation = obj.DynamicCompensation, LifeType = obj.LifeType, NominalLife = obj.NominalLife, ReviveDelta = (ushort)obj.ReviveDelta }; } public static explicit operator DbNcFamilyModel(NcFamilyModel obj) { return new DbNcFamilyModel() { FamilyId = (short)obj.FamilyId, ToolType = obj.ToolType, RightSize = obj.RightSize, LeftSize = obj.LeftSize, TcpTable = obj.TcpTable, Gamma = obj.Gamma, CoolingByte = obj.CoolingByte, RotationType = obj.RotationType, MaxLoad = obj.MaxLoad, MaxSpeed = obj.MaxSpeed, MinLoadPctAutoload = obj.MinLoadPctAutoload, MaxLoadPctAutoload = obj.MaxLoadPctAutoload, MinLoadDynamicCompensation = obj.MinLoadDynamicCompensation, MaxLoadDynamicCompensation = obj.MaxLoadDynamicCompensation, DynamicCompensation = (byte)obj.DynamicCompensation, LifeType = obj.LifeType, NominalLife = obj.NominalLife, ReviveDelta = obj.ReviveDelta }; } } }