using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwCoreLib.Lux.Data.DbModel
{
//
// This is here so CodeMaid doesn't reorganize this document
//
[Table("OrderRowList")]
public class OrderRowModel
{
///
/// ID del record
///
[Key]
public int OrderRowID { get; set; }
///
/// Riferimento Ordine
///
public int OrderID { get; set; }
///
/// Riga Ordine
///
public int RowNum { get; set; } = 0;
///
/// Codice calcolato Ordine ANNO.NUMERO.REV
///
[NotMapped]
public string OrderRowCode
{
get => $"{OrderRowID:0000}.{RowNum:000}";
}
///
/// ID dell'articolo di vendita Orderto
///
public int SellingItemID { get; set; }
///
/// Costo (standard / senza listini)
///
public double Cost { get; set; } = 0;
///
/// Margine percentuale standard
///
public double Qty { get; set; } = 1;
[NotMapped]
public double TotalCost
{
get => Qty * Cost;
}
///
/// Valore serializzato della composizione articolo (in formato JWD x finestra)
///
public string SerStruct { get; set; } = "";
///
/// Json contenente la serializzazione delle fasi previste per la stima dei tempi e costi in formato SerializedPhasePreview; potrebbe contenere anche altre info accessorie x definire dati logistico/gestionali
///
public string ItemSPP { get; set; } = "";
///
/// Note libere
///
public string Note { get; set; } = "";
#if false
///
/// Stack degli ultimi item serializzati per Uno/Redo actions
///
[NotMapped]
public List UndoRedoSerStruct { get; set; } = new List();
#endif
///
/// DataOra inserimento
///
public DateTime Inserted { get; set; } = DateTime.Now;
///
/// DataOra ultima modifica
///
public DateTime Modified { get; set; } = DateTime.Now;
///
/// Navigazione Order
///
[ForeignKey("OrderID")]
public virtual OrderModel OrderNav { get; set; } = null!;
///
/// Navigazione Item
///
[ForeignKey("SellingItemID")]
public virtual SellingItemModel SellingItemNav { get; set; } = null!;
}
}