namespace CAPI.Custom.Entities { using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; /// /// Result from dbo.sp_CAPI1_GetPartsAndAlternates /// public class PartResult { //SELECT[RowId],[itemID],[IsAlternate],[CEPNumber],[MasterNumber],[PartNumber],[AlternateNumber] //,[Description],[AdditionalDescription],[DimensionalDescription],[WeightKG] //,[CategoryName],[SubCategoryName],[MinorCodeName],[TotalAvailable],[IsVetted] //,[VettedBy],[UniqueNumber] public string AdditionalDescription { get; set; } public string AlternateNumber { get; set; } public string Category { get; set; } public string CEPNumber { get; set; } public string Description { get; set; } public string DimensionalDescription { get; set; } public int itemID { get; set; } public string MasterNumber { get; set; } public string MinorCode { get; set; } public string PartNumber { get; set; } public string SubCategory { get; set; } public int TotalAvailable { get; set; } public decimal WeightKG { get; set; } public bool IsAlternate => AlternateNumber.IsNotEmpty(); public PartResult() { } public PartResult(PartsMaster partsMaster) { this.AdditionalDescription = partsMaster.AdditionalDescription; this.AlternateNumber = string.Empty; this.Category = partsMaster.CategoryName ?? string.Empty; this.CEPNumber = partsMaster.CEPNumber ?? string.Empty; this.Description = partsMaster.Description ?? string.Empty; this.DimensionalDescription = partsMaster.DimensionalDescription ?? string.Empty; this.itemID = partsMaster.itemID; this.MasterNumber = partsMaster.MasterNumber ?? string.Empty; this.MinorCode = partsMaster.MinorCodeName ?? string.Empty; this.PartNumber = partsMaster.PartNumber ?? string.Empty; this.SubCategory = partsMaster.SubCategoryName ?? string.Empty; this.TotalAvailable = partsMaster.TotalAvailable.GetValueOrDefault(); this.WeightKG = partsMaster.WeightKG.GetValueOrDefault(); } } }