Gremlin/Gremlin_BlazorServer/Data/EntityClasses/Quote.cs

74 lines
2.6 KiB
C#

namespace Gremlin_BlazorServer.Data.EntityClasses
{
public class Quote : IMetadata
{
//primary key:
public uint QuoteId { get; set; }
//foreign keys:
public uint ContactId { get; set; }
//navigation properties:
public Contact Recipient { get; set; } = new Contact();
public IList<LineItem> LineItems { get; set; } = new List<LineItem>();
//class properties:
public Contact SalesRep { get; set; } = new Contact();
public string QuotationNumber { get; set; } = string.Empty;
public DateTime QuotationDate { get; set; } = DateTime.Now;
public DateTime ValidUntil { get; set; } = DateTime.Now.AddDays(60);
public byte ValidFor { get; set; } = 60;
public decimal TotalListprice { get; set; }
public decimal TotalDiscount { get; set; }
public decimal TotalNet { get; set; }
public float VAT { get; set; } = 19f;
public decimal TotalGross { get; set; }
public bool QuoteContains3PP { get; set; }
public bool QuoteContainsRB { get; set; }
public string QuoteTemplate { get; set; } = string.Empty;
public int Warranty { get; set; } = 12;
public decimal TotalFreightOnly { get; set; }
public decimal TotalFreight { get; set; }
public decimal TotalVAT { get; set; }
public decimal Freight { get; set; } = 3;
public bool IsPriceInformation { get; set; }
public bool ShowSinglePrices { get; set; } = true;
public bool ShowDiscounts { get; set; } = true;
public bool ShowBrutto { get; set; } = true;
public string QuoteDescription { get; set; } = string.Empty;
public string Tex {get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public string Path { get; set; } = Directory.GetCurrentDirectory();
//new properties
//metadata:
public DateTime DataCreationDate { get; set; } = DateTime.Now;
public string DataModificationByUser { get; set; } = string.Empty;
public DateTime DataModificationDate { get; set; } = DateTime.Now;
public string DataStatus { get; set; } = "Active";
public DateTime DataValidFrom { get; set; } = DateTime.Now;
public DateTime DataValidUntil { get; set; } = DateTime.MaxValue;
public string DataVersionComment { get; set; } = string.Empty;
public uint DataVersionNumber { get; set; }
//constructor
public Quote() { }
public Quote(Contact salesRep, bool randomQuoteNumber = true)
{
SalesRep = salesRep;
if (randomQuoteNumber)
{
Random random = new();
QuotationNumber = SalesRep.LastName switch
{
"Woitschetzki" => $"DE-83PE89-{DateTime.Now:My}-{random.Next(999999)}",
"Welsch" => $"DE-83RE32-{DateTime.Now:My}-{random.Next(999999)}",
_ => $"DE-XXYYXX-{DateTime.Now:My}-{random.Next(999999)}",
};
}
}
}
}