using Newtonsoft.Json; 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.Runtime.Serialization; using System.Web; using Weee.Models; namespace Weee.ViewModels { public class CompanyViewModel { public int ID { get; set; } public Guid UID { get; set; } public string LogoUrl { get; set; } [Display(Name = "CompanyName", ResourceType = typeof(Resource))] //[Required(ErrorMessageResourceType = typeof(Resource), // ErrorMessageResourceName = "RequiredMessage")] [StringLength(100, ErrorMessageResourceType = typeof(Resource), ErrorMessageResourceName = "CompanyNameMaxLength")] public string Name { get; set; } [Display(Name = "EnglishName", ResourceType = typeof(Resource))] //[Required(ErrorMessageResourceType = typeof(Resource), ErrorMessageResourceName = "RequiredMessage")] public string EnglishName { get; set; } [Display(Name = "CompanyAddress", ResourceType = typeof(Resource))] //[Required(ErrorMessageResourceType = typeof(Resource), // ErrorMessageResourceName = "RequiredMessage")] [StringLength(300, ErrorMessageResourceType = typeof(Resource), ErrorMessageResourceName = "CompanyAddressMaxLength")] public string Address { get; set; } [Display(Name = "CompanyVATNumber", ResourceType = typeof(Resource))] public string VATNumber { get; set; } [Display(Name = "CEOName", ResourceType = typeof(Resource))] public string CEOName { get; set; } [Display(Name = "CompanyIndustryDescription", ResourceType = typeof(Resource))] public string IndustryDescription { get; set; } [Display(Name = "CompanyDescription", ResourceType = typeof(Resource))] public string Description { get; set; } [Display(Name = "Capital", ResourceType = typeof(Resource))] [Range(0, Int32.MaxValue)] public int Capital { get; set; } [Display(Name = "CompanyWebSiteUrl", ResourceType = typeof(Resource))] [StringLength(50, ErrorMessageResourceType = typeof(Resource), ErrorMessageResourceName = "CompanyWebSiteUrlMaxLength")] public string WebSiteUrl { get; set; } [Display(Name = "CompanyRegisterDate", ResourceType = typeof(Resource))] public DateTime RegisterDate { get; set; } [Display(Name = "CompanyLastStatusUpdateDate", ResourceType = typeof(Resource))] public DateTime LastStatusUpdateDate { get; set; } [Display(Name = "EnabledStatus", ResourceType = typeof(Resource))] public CompanyStatus Status { get; set; } [Display(Name = "UserName", ResourceType = typeof(Resource))] public string UserName { get; set; } [NotMapped] [JsonIgnore] [IgnoreDataMember] public Type CompanyType { get { return ObjectContext.GetObjectType(this.GetType()); } } [NotMapped] [JsonIgnore] [IgnoreDataMember] public string CompanyTypeDisplayName { get { if (this.CompanyType == typeof(NormalCompany)) { return Resource.StaticLabelNormalCompany; } else { return Resource.StaticLabelCertificationCompany; } } } } }