65 lines
1.9 KiB
C#
65 lines
1.9 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 Microsoft.AspNet.Identity.EntityFramework;
|
|||
|
using Newtonsoft.Json;
|
|||
|
using Resources;
|
|||
|
using Weee.DAL;
|
|||
|
|
|||
|
namespace Weee.Models
|
|||
|
{
|
|||
|
[Table("NormalCompany")]
|
|||
|
public class NormalCompany : Company, IValidatableObject
|
|||
|
{
|
|||
|
public NormalCompany()
|
|||
|
: base()
|
|||
|
{
|
|||
|
Fabs = new HashSet<Fab>();
|
|||
|
Products = new HashSet<Product>();
|
|||
|
ReceiveRequests = new HashSet<ProductLCAReplyRequest>();
|
|||
|
SupplierList = new HashSet<Supplier>();
|
|||
|
HasLCAs = new HashSet<LCA>();
|
|||
|
}
|
|||
|
|
|||
|
[InverseProperty("Company")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<Supplier> SupplierList { get; set; }
|
|||
|
|
|||
|
[InverseProperty("OwnerCompany")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<Fab> Fabs { get; set; }
|
|||
|
|
|||
|
[InverseProperty("OwnerCompany")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<Product> Products { get; set; }
|
|||
|
|
|||
|
[InverseProperty("ReceiveBy")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<ProductLCAReplyRequest> ReceiveRequests { get; set; }
|
|||
|
|
|||
|
[InverseProperty("Owner")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<LCA> HasLCAs { get; set; }
|
|||
|
|
|||
|
[NotMapped]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public ICollection<ProductLCA> MyProductLCAs
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return HasLCAs.Where(x => ObjectContext.GetObjectType(x.GetType()) == typeof(ProductLCA)).Cast<ProductLCA>().ToList();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|