195 lines
5.0 KiB
C#
195 lines
5.0 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 Resources;
|
|||
|
using Newtonsoft.Json;
|
|||
|
using Weee.Models.Survey_form_metadata;
|
|||
|
using Weee.Models.ExtensionMethods;
|
|||
|
|
|||
|
namespace Weee.Models
|
|||
|
{
|
|||
|
[Table("ProductLCAReplyRequests")]
|
|||
|
public class ProductLCAReplyRequest
|
|||
|
{
|
|||
|
public ProductLCAReplyRequest()
|
|||
|
{
|
|||
|
Uid = Guid.NewGuid();
|
|||
|
//CreatedDate = DateTime.UtcNow;//DL-13
|
|||
|
CreatedDate = DateTime.Now;
|
|||
|
AcceptDate = null;
|
|||
|
ReplyDate = null;
|
|||
|
AcceptReplyDate = null;
|
|||
|
}
|
|||
|
public int ID { get; set; }
|
|||
|
|
|||
|
public string Distribute { get; set; }
|
|||
|
public decimal? RepliedValue { get; set; }
|
|||
|
public string ReferenceFileLink { get; set; }
|
|||
|
public string DescriptionFromReceiver { get; set; }
|
|||
|
public string DescriptionFromSender { get; set; }
|
|||
|
|
|||
|
public DivideByOptions DivideBy { get; set; }
|
|||
|
|
|||
|
public enum DivideByOptions
|
|||
|
{
|
|||
|
[Display(Name = "Weight", ResourceType = typeof(Resource))]
|
|||
|
byWeight,
|
|||
|
[Display(Name = "AreaB", ResourceType = typeof(Resource))]
|
|||
|
byArea,
|
|||
|
[Display(Name = "WorkHour", ResourceType = typeof(Resource))]
|
|||
|
byWorkHour
|
|||
|
}
|
|||
|
|
|||
|
[Column(TypeName = "DateTime2")]
|
|||
|
public DateTime CreatedDate { get; set; }
|
|||
|
|
|||
|
[Column(TypeName = "DateTime2")]
|
|||
|
public DateTime? AcceptDate { get; set; }
|
|||
|
|
|||
|
[Column(TypeName = "DateTime2")]
|
|||
|
public DateTime? ReplyDate { get; set; }
|
|||
|
|
|||
|
[Column(TypeName = "DateTime2")]
|
|||
|
public DateTime? AcceptReplyDate { get; set; }
|
|||
|
|
|||
|
[Column(TypeName = "DateTime2")]
|
|||
|
public DateTime? LastResentDate { get; set; }
|
|||
|
|
|||
|
[Required]
|
|||
|
public string SenderCompanyName { get; set; }
|
|||
|
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual Material SentByWhichMaterial { get; set; }
|
|||
|
|
|||
|
public Guid Uid { get; set; }
|
|||
|
|
|||
|
public int? RepliedLCAID { get; set; }
|
|||
|
[ForeignKey("RepliedLCAID")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ProductLCA RepliedByWhichLCA { get; set; }
|
|||
|
|
|||
|
[NotMapped]
|
|||
|
public string MaterialSupplierName
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return SentByWhichMaterial.SupplierCompanyName;
|
|||
|
}
|
|||
|
}
|
|||
|
[NotMapped]
|
|||
|
public string MaterialSupplierEmail
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return SentByWhichMaterial.SupplierCompanyEmail;
|
|||
|
}
|
|||
|
}
|
|||
|
[NotMapped]
|
|||
|
public string MaterialPartNumber
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return SentByWhichMaterial.PartNumber;
|
|||
|
}
|
|||
|
}
|
|||
|
[NotMapped]
|
|||
|
public string MaterialName
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return SentByWhichMaterial.Name;
|
|||
|
}
|
|||
|
}
|
|||
|
[NotMapped]
|
|||
|
public string ReplyStatusDisplay
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (RepliedValue == null)
|
|||
|
return Resource.NoReply;
|
|||
|
else
|
|||
|
return Resource.Replied;
|
|||
|
}
|
|||
|
}
|
|||
|
[NotMapped]
|
|||
|
public string RequestLink
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return Weee.ProgramConstants.RequestLink + Uid.ToString();
|
|||
|
}
|
|||
|
}
|
|||
|
[NotMapped]
|
|||
|
public string AnonymousReplyLink
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return Weee.ProgramConstants.AnonymousReplyLink + Uid.ToString();
|
|||
|
}
|
|||
|
}
|
|||
|
[NotMapped]
|
|||
|
public string SupplierLCAStatus
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (RepliedByWhichLCA != null)
|
|||
|
return RepliedByWhichLCA.StatusDisplayName;
|
|||
|
else if (RepliedValue != null)
|
|||
|
return Resource.AnonymousReply;
|
|||
|
else
|
|||
|
return null;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
[NotMapped]
|
|||
|
public bool CanBeReplied
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return AcceptReplyDate == null;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
[NotMapped]
|
|||
|
public bool CanBeDelete
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return ReceiverCompanyID == null && AcceptReplyDate == null;
|
|||
|
}
|
|||
|
}
|
|||
|
[NotMapped]
|
|||
|
public bool CanBeApply
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return AcceptReplyDate == null && RepliedValue != null;
|
|||
|
}
|
|||
|
}
|
|||
|
[NotMapped]
|
|||
|
public int SendLCAID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return SentByWhichMaterial.LCAID;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
public int? ReceiverCompanyID { get; set; }
|
|||
|
[ForeignKey("ReceiverCompanyID")]
|
|||
|
[Display(Name = "LCAReceiveby", ResourceType = typeof(Resource))]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual NormalCompany ReceiveBy { get; set; }
|
|||
|
}
|
|||
|
|
|||
|
}
|