using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Data.Entity.Core.Objects; using System.Linq; using System.Web; using System.Runtime.Serialization; using Resources; using Newtonsoft.Json; using Weee.Models.Survey_form_metadata; using Weee.Models.ExtensionMethods; namespace Weee.Models { [Table("ProductLCA")] public class ProductLCA : LCA { public ProductLCA() : base() { Materials = new HashSet(); TransportSheet = new HashSet(); WaterUsageSheet = new HashSet(); WasteSheet = new HashSet(); WasteTransportSheet = new HashSet(); OtherCompoundSheet = new HashSet(); } public int? PCRID { get; set; } [ForeignKey("PCRID")] [JsonIgnore] [IgnoreDataMember] public virtual PCR PCR { get; set; } [InverseProperty("OwnerLCA")] [JsonIgnore] [IgnoreDataMember] public virtual ICollection Materials { get; set; } [InverseProperty("OwnerLCA")] [JsonIgnore] [IgnoreDataMember] public virtual ICollection WaterUsageSheet { get; set; } [InverseProperty("OwnerLCA")] [JsonIgnore] [IgnoreDataMember] public virtual ICollection TransportSheet { get; set; } [InverseProperty("OwnerLCA")] [JsonIgnore] [IgnoreDataMember] public virtual ICollection WasteSheet { get; set; } [InverseProperty("OwnerLCA")] [JsonIgnore] [IgnoreDataMember] public virtual ICollection WasteTransportSheet { get; set; } [InverseProperty("OwnerLCA")] [JsonIgnore] [IgnoreDataMember] public virtual ICollection OtherCompoundSheet { get; set; } [JsonIgnore] [IgnoreDataMember] public virtual AbandonedStage AbandonedStage { get; set; } [InverseProperty("RepliedByWhichLCA")] [JsonIgnore] [IgnoreDataMember] public virtual ICollection RepliedRequests { get; set; } public int? ProductID { get; set; } [ForeignKey("ProductID")] [JsonIgnore] [IgnoreDataMember] public virtual Product TargetProduct { get; set; } public int? FabID { get; set; } [ForeignKey("FabID")] [JsonIgnore] [IgnoreDataMember] public virtual Fab TargetFab { get; set; } public int? InventoryStageDataID { get; set; } [ForeignKey("InventoryStageDataID")] [JsonIgnore] [IgnoreDataMember] public virtual InventoryStageData TargetInventoryStageData { get; set; } [JsonIgnore] [IgnoreDataMember] public virtual SnapShotSurveyResult SnapShotSurveyResult { get; set; } public decimal? FabProductionWeight { get; set; } public decimal? FabProductionArea { get; set; } public decimal? FabProductionHour { get; set; } public decimal? ProductProductionPcs { get; set; } public decimal? ProductProductionHour { get; set; } public decimal? DistributeKgCO2eInWeight { get; set; } public decimal? DistributeKgCO2eInArea { get; set; } public decimal? DistributeKgCO2eInWorkHour { get; set; } [NotMapped] public bool CanReplyOtherRequest { get { return PCRID == null && Status == LCAStatus.Confirmed; } } [NotMapped] [JsonIgnore] [IgnoreDataMember] public ICollection SentRequests { get { var a = Materials.Where(x => x.RequestSent != null).Select(x => x.RequestSent).ToList(); return a; } } } }