demo20230512/ViewModels/CertificationViewModel.cs
2023-05-12 10:20:28 +08:00

79 lines
2.4 KiB
C#

using Resources;
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 Weee.Models;
namespace Weee.ViewModels
{
public class CertificationViewModel
{
[Display(Name = "LCAid", ResourceType = typeof(Resource))]
public int ID { get; set; }
//private string _LCAname = "";
//[JsonIgnore]
//[IgnoreDataMember]
[Display(Name = "LCAname", ResourceType = typeof(Resource))]
public string LCAname
{ get; set; }
[Display(Name = "LCAStartDate", ResourceType = typeof(Resource))]
public DateTime StartDate { get; set; }
[Display(Name = "LCAEndDate", ResourceType = typeof(Resource))]
public DateTime EndDate { get; set; }
private string _LCATypeName = "";
[Display(Name = "LCAType", ResourceType = typeof(Resource))]
public string LCATypeName
{
get { return _LCATypeName; }
set { _LCATypeName = value; }
}
[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;
}
}
}
[Display(Name = "LCADescription", ResourceType = typeof(Resource))]
public string Description { get; set; }
[Display(Name = "LCACreatedDate", ResourceType = typeof(Resource))]
[DisplayFormat(DataFormatString = "{0:yyyy/MM/dd HH:mm:ss}", ApplyFormatInEditMode = true)]
public DateTime CreatedDate { get; set; }
[Display(Name = "LCAitemName", ResourceType = typeof(Resource))]
public string LCAitemName { get; set; }
}
}