demo20230512/Models/LCA/ProductSurveyForm.cs
2023-05-12 10:20:28 +08:00

112 lines
3.7 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;
using Weee.Models.Survey_form_metadata;
using Weee.Models.Paramemter;
using Newtonsoft.Json;
using System.Runtime.Serialization;
namespace Weee.Models
{
[Table("ProductLCAProductSurveyForm_Materials")]
public class Material : SheetData
{
public Material()
{
}
public int ID { get; set; } //column A
public string Name { get; set; } //column E
public string LocalName { get; set; } //column F
public string Composite { get; set; } //column G
public string CompositePercentage { get; set; } //column H + I
public string CASNumber { get; set; } //column J
public DQI DQI { get; set; } //column N
public string Description { get; set; } //column O
//for direct material
public string PartNumber { get; set; } //column B+C
public int Quantity { get; set; } //column K
public decimal Scalar { get; set; }
public string Unit { get; set; }
public decimal HighLevelAnalyzeResult { get; set; }
public decimal KgCO2e { get; set; }
public MaterialType? MaterialType { get; set; }
public decimal? InputParameterValue { get; set; }
public bool? IncludedInInterrogation { get; set; }
public int? SupplierCompanyID { get; set; }
public string SupplierCompanyEmail { get; set; }
public string SupplierCompanyName { get; set; }
public int LCAID { get; set; }
[ForeignKey("LCAID")]
[JsonIgnore]
[IgnoreDataMember]
public virtual ProductLCA OwnerLCA { get; set; }
//this is actually category id
public int? ParameterTypeID { get; set; }
[ForeignKey("ParameterTypeID")]
[JsonIgnore]
[IgnoreDataMember]
public virtual SimaproParameterCategory AssignedParameterType { get; set; }
public int? ParameterID { get; set; }
[ForeignKey("ParameterID")]
[JsonIgnore]
[IgnoreDataMember]
public virtual SimaproParameter AssignedParameter { get; set; }
//public int? ReplyLCAID { get; set; }
//[ForeignKey("ReplyLCAID")]
[JsonIgnore]
[IgnoreDataMember]
public virtual ProductLCAReplyRequest RequestSent { get; set; }
public int? ParentMaterialID { get; set; }
[JsonIgnore]
[IgnoreDataMember]
[ForeignKey("ParentMaterialID")]
public virtual Material ParentMaterial { get; set; }
[InverseProperty("ParentMaterial")]
public virtual List<Material> ChildMaterials { get; set; }
[NotMapped]
public bool isChild
{
get { return ParentMaterialID != null; }
}
[NotMapped]
public string typeDisplayName
{
get
{
if (!MaterialType.HasValue)
return Resources.Resource.StaticLabelNotSelectedYet;
else if (MaterialType.Value == Weee.Models.MaterialType.DirectMaterial)
return Resources.Resource.MaterialDirectMaterial;
else if (MaterialType.Value == Weee.Models.MaterialType.IndirectMaterial)
return Resources.Resource.MaterialIndirectMaterial;
else
return Resources.Resource.MaterialWrapMaterial;
}
}
[NotMapped]
public string VendorCode { get; set; }
}
public enum MaterialType
{
DirectMaterial,
IndirectMaterial,
WrapMaterial
}
}