demo20230512/Models/Product.cs

76 lines
2.8 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.Runtime.Serialization;
using System.Web;
using Newtonsoft.Json;
using Resources;
namespace Weee.Models
{
public class Product
{
public Product()
{
}
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Key]
public int ID { get; set; }
[Display(Name = "ProductName", ResourceType = typeof(Resource))]
[Required(ErrorMessageResourceType = typeof(Resource),
ErrorMessageResourceName = "RequiredMessage")]
[StringLength(50, ErrorMessageResourceType = typeof(Resource),
ErrorMessageResourceName = "ProductNameMaxLength")]
public string Name { get; set; }
[Display(Name = "ProductSpec", ResourceType = typeof(Resource))]
[Required(ErrorMessageResourceType = typeof(Resource),
ErrorMessageResourceName = "RequiredMessage")]
[StringLength(300, ErrorMessageResourceType = typeof(Resource),
ErrorMessageResourceName = "ProductSpecMaxLength")]
public string SpecDescription { get; set; }
[Display(Name = "ProductWeight", ResourceType = typeof(Resource))]
[Range(0, Int32.MaxValue)]
public decimal? Weight { get; set; }
[Display(Name = "ProductAreaSize", ResourceType = typeof(Resource))]
[Range(0, Int32.MaxValue)]
public decimal? AreaSize { get; set; }
[Display(Name = "ProductPcsPerYear", ResourceType = typeof(Resource))]
[Range(0, Int32.MaxValue)]
public decimal? PcsPerYear { get; set; }
[Display(Name = "ProductPhotoUrl", ResourceType = typeof(Resource))]
public string PhotoUrl { get; set; }
[Display(Name = "ProductEcoFriendlyDescription", ResourceType = typeof(Resource))]
public string EcoFriendlyDescription { get; set; }
[Display(Name = "ProductEcoFriendlySymbol", ResourceType = typeof(Resource))]
public string EcoFriendlySymbol { get; set; }
[Display(Name = "ProductSerialNumber", ResourceType = typeof(Resource))]
public string SerialNumber { get; set; }
//20140818 回覆盤查時改用特定 LCAs 回覆
//public ProductSurveyForm SurveyFormTemplate { get; set; }//此屬性單純為回覆盤查指令之template , 非產品之詳細detail , 產品detail不存在於系統範圍內
[InverseProperty("TargetProduct")]
[JsonIgnore][IgnoreDataMember]
public virtual ICollection<ProductLCA> LCAs { get; set; }
public int CompanyID { get; set; }
[ForeignKey("CompanyID")]
[JsonIgnore][IgnoreDataMember]
public NormalCompany OwnerCompany { get; set; }
}
}