207 lines
7.0 KiB
C#
207 lines
7.0 KiB
C#
|
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
|
|||
|
{
|
|||
|
public abstract class LCA
|
|||
|
{
|
|||
|
public LCA()
|
|||
|
{
|
|||
|
//LCAname = "";
|
|||
|
StartDate = DateTime.UtcNow;
|
|||
|
EndDate = DateTime.UtcNow;
|
|||
|
StatusHistory = new HashSet<LCAStatusLog>();
|
|||
|
Status = LCAStatus.New;
|
|||
|
//CreatedDate = DateTime.UtcNow;
|
|||
|
CreatedDate = DateTime.Now;//DL-13
|
|||
|
Comments = new HashSet<Comment>();
|
|||
|
WorkHourSheet = new HashSet<WorkHour>();
|
|||
|
KitchenSheet = new HashSet<Kitchen>();
|
|||
|
GasolineEquipmentSheet = new HashSet<GasolineEquipment>();
|
|||
|
FireEquipmentSheet = new HashSet<FireEquipment>();
|
|||
|
VehicleSheet = new HashSet<Vehicle>();
|
|||
|
RefrigerantSheet = new HashSet<Refrigerant>();
|
|||
|
PowerUsageSheet = new HashSet<PowerUsage>();
|
|||
|
SteamUsageSheet = new HashSet<SteamUsage>();
|
|||
|
}
|
|||
|
|
|||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|||
|
[Key]
|
|||
|
[Display(Name = "LCAid", ResourceType = typeof(Resource))]
|
|||
|
public int ID { get; set; }
|
|||
|
|
|||
|
//[JsonIgnore]
|
|||
|
//[IgnoreDataMember]
|
|||
|
[Display(Name = "LCAname", ResourceType = typeof(Resource))]
|
|||
|
public string LCAname { get; set; }
|
|||
|
|
|||
|
public string LCAStarter { get; set; }
|
|||
|
|
|||
|
[Display(Name = "UserDepartment", ResourceType = typeof(Resource))]
|
|||
|
public string LCAStarterDepartment { get; set; }
|
|||
|
|
|||
|
[Display(Name = "UserPhoneNumber", ResourceType = typeof(Resource))]
|
|||
|
public string LCAStarterPhone { get; set; }
|
|||
|
|
|||
|
[Display(Name = "UserJob", ResourceType = typeof(Resource))]
|
|||
|
public string LCAStarterJob { get; set; }
|
|||
|
|
|||
|
[Display(Name = "UserEmail", ResourceType = typeof(Resource))]
|
|||
|
public string LCAStarterEmail { get; set; }
|
|||
|
|
|||
|
public string InterrogationResultUrl { get; set; }
|
|||
|
|
|||
|
public string ProductInventoryResultUrl { get; set; }
|
|||
|
|
|||
|
public string CarbonFootprintDocxUrl { get; set; }
|
|||
|
public string CertificationFeedbackZipUrl { get; set; }//CFT-89
|
|||
|
public string UploadZipReportUrl { get; set; }//CFT-89
|
|||
|
|
|||
|
[Column(TypeName = "DateTime2")]
|
|||
|
[Display(Name = "LCACreatedDate", ResourceType = typeof(Resource))]
|
|||
|
[DisplayFormat(DataFormatString = "{0:yyyy/MM/dd HH:mm:ss}", ApplyFormatInEditMode = true)]
|
|||
|
public DateTime CreatedDate { get; set; }
|
|||
|
|
|||
|
[Column(TypeName = "DateTime2")]
|
|||
|
[Display(Name = "LCAStartDate", ResourceType = typeof(Resource))]
|
|||
|
[Required(ErrorMessageResourceType = typeof(Resource),
|
|||
|
ErrorMessageResourceName = "RequiredMessage")]
|
|||
|
public DateTime StartDate { get; set; }
|
|||
|
|
|||
|
[Column(TypeName = "DateTime2")]
|
|||
|
[Display(Name = "LCAEndDate", ResourceType = typeof(Resource))]
|
|||
|
[Required(ErrorMessageResourceType = typeof(Resource),
|
|||
|
ErrorMessageResourceName = "RequiredMessage")]
|
|||
|
public DateTime EndDate { get; set; }
|
|||
|
|
|||
|
[Display(Name = "LCADeadLine", ResourceType = typeof(Resource))]
|
|||
|
public DateTime? DeadLine { get; set; }
|
|||
|
|
|||
|
[Display(Name = "LCADescription", ResourceType = typeof(Resource))]
|
|||
|
[MaxLength(200, ErrorMessageResourceType = typeof(Resource),
|
|||
|
ErrorMessageResourceName = "LCADescriptionMaxLength")]
|
|||
|
public string Description { get; set; }
|
|||
|
|
|||
|
[Display(Name = "CustomerPartNumber", ResourceType = typeof(Resource))]
|
|||
|
public string CustomerPartNumber { get; set; }
|
|||
|
|
|||
|
[InverseProperty("CommentTarget")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<Comment> Comments { get; set; }
|
|||
|
|
|||
|
[InverseProperty("OwnerLCA")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<WorkHour> WorkHourSheet { get; set; }
|
|||
|
|
|||
|
[InverseProperty("OwnerLCA")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<Kitchen> KitchenSheet { get; set; }
|
|||
|
|
|||
|
[InverseProperty("OwnerLCA")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<GasolineEquipment> GasolineEquipmentSheet { get; set; }
|
|||
|
|
|||
|
[InverseProperty("OwnerLCA")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<FireEquipment> FireEquipmentSheet { get; set; }
|
|||
|
|
|||
|
[InverseProperty("OwnerLCA")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<Vehicle> VehicleSheet { get; set; }
|
|||
|
|
|||
|
[InverseProperty("OwnerLCA")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<Refrigerant> RefrigerantSheet { get; set; }
|
|||
|
|
|||
|
[InverseProperty("OwnerLCA")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<PowerUsage> PowerUsageSheet { get; set; }
|
|||
|
|
|||
|
[InverseProperty("OwnerLCA")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<SteamUsage> SteamUsageSheet { get; set; }
|
|||
|
|
|||
|
[NotMapped]
|
|||
|
[Display(Name = "LCAType", ResourceType = typeof(Resource))]
|
|||
|
public Type LCAType
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return ObjectContext.GetObjectType(this.GetType());
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
[NotMapped]
|
|||
|
public string LCATypeDisplayName
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (this.LCAType == typeof(OrganizationLCA))
|
|||
|
{
|
|||
|
return Resource.StaticLabelOrganizationLCA;
|
|||
|
}
|
|||
|
else if (this.LCAType == typeof(ProductLCA))
|
|||
|
{
|
|||
|
return Resource.StaticLabelProductLCA;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
return Resource.StaticLabelChildProductLCA;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public int? OwnerID { get; set; }
|
|||
|
|
|||
|
[ForeignKey("OwnerID")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
[Display(Name = "LCAOwner", ResourceType = typeof(Resource))]
|
|||
|
public virtual NormalCompany Owner { get; set; }
|
|||
|
|
|||
|
public int? VerifierCompanyID { get; set; }
|
|||
|
|
|||
|
[ForeignKey("VerifierCompanyID")]
|
|||
|
[Display(Name = "CertificationUnit", ResourceType = typeof(Resource))]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual CertificationCompany VerifyBy { get; set; }
|
|||
|
|
|||
|
[Display(Name = "LCAStatus", ResourceType = typeof(Resource))]
|
|||
|
public LCAStatus Status { get; set; }
|
|||
|
|
|||
|
[NotMapped]
|
|||
|
public string StatusDisplayName
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return Status.DisplayString();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
[InverseProperty("LCA")]
|
|||
|
public virtual ICollection<LCAStatusLog> StatusHistory { get; set; }
|
|||
|
}
|
|||
|
}
|