demo20230512/Models/LCA/CommonSurveyForm.cs

266 lines
7.5 KiB
C#
Raw Normal View History

2023-05-12 10:20:28 +08:00
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
{
#region PowerUsageSheet
[Table("LCACommonSurveyForm_PowerUsages")]
public class PowerUsage : MonthlyData, SheetData
{
public int ID { get; set; }
public decimal? Peak { get; set; }
public decimal? HalfPeak { get; set; }
public decimal? SaturdayHalfPeak { get; set; }
public decimal? OffPeak { get; set; }
public string ReferenceFileLink { get; set; }
public string Description { get; set; }
public int Index { get; set; }
public decimal Scalar { get; set; }
public decimal KgCO2e { get; set; }
public string Area { get; set; }
public string Year { get; set; }
public int LCAID { get; set; }
[ForeignKey("LCAID")]
[JsonIgnore][IgnoreDataMember]
public virtual LCA OwnerLCA { get; set; }
[NotMapped]
[JsonIgnore][IgnoreDataMember]
public int StartBase
{
get
{
if (OwnerLCA == null) return 0;
return OwnerLCA.StartDate.Month;
}
}
public int? ParameterID { get; set; }
[ForeignKey("ParameterID")]
[JsonIgnore]
[IgnoreDataMember]
public virtual YearlyParameter Parameter { get; set; }
}
#endregion
#region Vehicle
[Table("LCACommonSurveyForm_Vehicles")]
public class Vehicle : CommonProperty, SheetData
{
public int ID { get; set; }
public string CarPlateNo { get; set; }
public VehicleType Type { get; set; }
public enum VehicleType
{
owned,
rental
}
public string ReferenceFileUrl { get; set; }
public string ReferencePhotoUrl { get; set; }
public int? ParameterID { get; set; }
[ForeignKey("ParameterID")]
[JsonIgnore][IgnoreDataMember]
public virtual YearlyParameter Parameter { get; set; }
public int LCAID { get; set; }
[ForeignKey("LCAID")]
[JsonIgnore][IgnoreDataMember]
public virtual LCA OwnerLCA { get; set; }
}
#endregion
#region Refrigerant
[Table("LCACommonSurveyForm_Refrigerants")]
public class Refrigerant : CommonProperty, SheetData
{
public int ID { get; set; }
public string ModelNumber { get; set; }
public int TotalNumber { get; set; }
public int? ParameterID { get; set; }
[ForeignKey("ParameterID")]
[JsonIgnore][IgnoreDataMember]
public virtual NonYearlyParameter Parameter { get; set; }
public int? ParameterID2 { get; set; }
[ForeignKey("ParameterID2")]
[JsonIgnore][IgnoreDataMember]
public virtual NonYearlyParameter Factor { get; set; }
public int LCAID { get; set; }
[ForeignKey("LCAID")]
[JsonIgnore][IgnoreDataMember]
public virtual LCA OwnerLCA { get; set; }
}
#endregion
#region SteamUsage
[Table("LCACommonSurveyForm_SteamUsages")]
public class SteamUsage : MonthlyData, SheetData
{
public SteamUsage()
{
}
public int ID { get; set; }
public string Area { get; set; }
public string Year { get; set; }
public string ReferenceFileLink { get; set; }
public decimal Scalar { get; set; }
public decimal KgCO2e { get; set; }
public string Description { get; set; }
public int Index { get; set; }
public int? ParameterID { get; set; }
[ForeignKey("ParameterID")]
[JsonIgnore][IgnoreDataMember]
public virtual YearlyParameter Parameter { get; set; }
public int LCAID { get; set; }
[ForeignKey("LCAID")]
[JsonIgnore][IgnoreDataMember]
public virtual LCA OwnerLCA { get; set; }
[NotMapped]
[JsonIgnore][IgnoreDataMember]
public int StartBase
{
get
{
if (OwnerLCA == null) return 0;
return OwnerLCA.StartDate.Month;
}
}
}
#endregion
#region WorkHourSheet
[Table("LCACommonSurveyForm_WorkHours")]
public class WorkHour : MonthlyData, SheetData
{
public int ID { get; set; }
public decimal WorkerNumber { get; set; }
public decimal WorkDay { get; set; }
public decimal AverageHourPerDay { get; set; }
public WorkHourType Type { get; set; }
public int Index { get; set; }
public decimal Scalar { get; set; }
public decimal KgCO2e { get; set; }
public string Description { get; set; }
public enum WorkHourType
{
Direct,
Indirect
}
public int LCAID { get; set; }
[ForeignKey("LCAID")]
[JsonIgnore]
[IgnoreDataMember]
public virtual LCA OwnerLCA { get; set; }
[NotMapped]
[JsonIgnore]
[IgnoreDataMember]
public int StartBase
{
get
{
if (OwnerLCA == null) return 0;
return OwnerLCA.StartDate.Month;
}
}
//this property has no meaning on workhour sheet
[NotMapped]
public int? ParameterID { get; set; }
}
#endregion
#region GasolineEquipment
[Table("LCACommonSurveyForm_GasolineEquipments")]
public class GasolineEquipment : CommonProperty, SheetData
{
public int ID { get; set; }
public string ReferenceFileUrl { get; set; }
public string ReferencePhotoUrl { get; set; }
public int? ParameterID { get; set; }
[ForeignKey("ParameterID")]
[JsonIgnore]
[IgnoreDataMember]
public virtual YearlyParameter Parameter { get; set; }
public int LCAID { get; set; }
[ForeignKey("LCAID")]
[JsonIgnore]
[IgnoreDataMember]
public virtual LCA OwnerLCA { get; set; }
}
#endregion
#region Kitchen
[Table("LCACommonSurveyForm_Kitchens")]
public class Kitchen : CommonProperty, SheetData
{
public int ID { get; set; }
public string ReferenceFileUrl { get; set; }
public string ReferencePhotoUrl { get; set; }
public int? ParameterID { get; set; }
[ForeignKey("ParameterID")]
[JsonIgnore]
[IgnoreDataMember]
public virtual YearlyParameter Parameter { get; set; }
public KitchenType Type { get; set; }
public enum KitchenType
{
owned,
outsourcing,
other
}
public int LCAID { get; set; }
[ForeignKey("LCAID")]
[JsonIgnore]
[IgnoreDataMember]
public virtual LCA OwnerLCA { get; set; }
}
#endregion
#region FireEquipment
[Table("LCACommonSurveyForm_FireEquipments")]
public class FireEquipment : CommonProperty, SheetData
{
public int ID { get; set; }
public int Quantity { get; set; }
public int? ParameterID { get; set; }
[ForeignKey("ParameterID")]
[JsonIgnore]
[IgnoreDataMember]
public virtual NonYearlyParameter Parameter { get; set; }
public int LCAID { get; set; }
[ForeignKey("LCAID")]
[JsonIgnore]
[IgnoreDataMember]
public virtual LCA OwnerLCA { get; set; }
}
#endregion
}