89 lines
2.5 KiB
C#
89 lines
2.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using EveryThing.Models.CodeTable;
|
|
|
|
namespace EveryThing.Models.Project
|
|
{
|
|
public enum ProjectStatus
|
|
{
|
|
[Display(Name = "Odprt")]
|
|
Opened = 0,
|
|
|
|
[Display(Name = "V izdelavi")]
|
|
InProduction = 1,
|
|
|
|
[Display(Name = "Zaključen")]
|
|
Finished = 2,
|
|
[Display(Name = "Ponudba")]
|
|
Offer = 10
|
|
}
|
|
|
|
public class Project
|
|
{
|
|
[Key]
|
|
public int IdProject { get; set; }
|
|
|
|
[Required]
|
|
[ForeignKey("Company")]
|
|
public int IdCompanyFk { get; set; }
|
|
[Required]
|
|
[Display(Name = "Partner")]
|
|
[ForeignKey("Partner")]
|
|
public int IdPartnerFk { get; set; }
|
|
|
|
[Required]
|
|
[Display(Name = "Naziv")]
|
|
public string Title { get; set; }
|
|
|
|
[Display(Name = "Številka naročila kupca")]
|
|
public string BuyersOrderNumber { get; set; }
|
|
|
|
[Display(Name = "Opis")]
|
|
public string Description { get; set; }
|
|
|
|
[Required]
|
|
public int ProjectNumber { get; set; } = 0;
|
|
|
|
[Required]
|
|
public int ProjectYear { get; set; } = 0;
|
|
|
|
[Required]
|
|
[Display(Name = "Status")]
|
|
public ProjectStatus Status { get; set; } = ProjectStatus.Opened;
|
|
|
|
[Display(Name = "Datum zaključka")]
|
|
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
|
|
public DateTime? FinishedDate { get; set; }
|
|
|
|
[NotMapped]
|
|
[Display(Name = "Številka projekta")]
|
|
public string ProjectNumberFormatted => $"{ProjectYear}-{ProjectNumber:D4}";
|
|
|
|
[NotMapped]
|
|
[Display(Name = "Prvi dobavni rok")]
|
|
public DateTime? FirstDeliveryDate { get; set; }
|
|
|
|
[NotMapped]
|
|
[Display(Name = "Prvi dobavni rok")]
|
|
public string FirstDeliveryDateString => FirstDeliveryDate == null || (DateTime)FirstDeliveryDate == DateTime.MaxValue
|
|
? ""
|
|
: ((DateTime)FirstDeliveryDate).ToString("dd.MM.yyyy");
|
|
|
|
// ForeignKey
|
|
public CodeTableCompany Company { get; set; }
|
|
public CodeTablePartner Partner { get; set; }
|
|
|
|
// ProjectPart
|
|
[InverseProperty("Project")]
|
|
public virtual ICollection<ProjectPart> ProjectProjectPart { get; set; }
|
|
|
|
[InverseProperty("Project")]
|
|
public virtual ICollection<Invoice.Invoice> Invoices { get; set; }
|
|
|
|
}
|
|
}
|