using System; namespace FspWebApp.Entity.Client { /// /// Specify how a item mesured, by volumn (galon) or piece. /// public enum PosItemUnitId { VOL, PCS } /// /// POCO for Pos Item /// Same sort of product could use the same itemId with diff barcode. /// barcode should always be unique. /// public class PosItem { //[DatabaseGenerated(DatabaseGeneratedOption.Identity)] //public Guid Id { get; set; } ///// ///// predefined by business. ///// could have one itemid correlated to multiple BarCode, one icecream with diff colors?? ///// ////[Index("IX_ItemIdChangesetBarCode", 1, IsUnique = true)] //[Index("IX_ItemId", IsUnique = false)] //[Required] //[MaxLength(20)] public string ItemId { get; set; } /// /// predefined by business. /// could have one itemid correlated to multiple BarCode, one icecream with diff colors?? /// public string BarCode { get; set; } /// /// for keep all history item, import this version /// //[Index("IX_ItemIdChangesetBarCode", 3, IsUnique = true)] //[Index("IX_BarCodeChangeset", 2, IsUnique = true)] //public Guid? ChangesetId { get; set; } //[ForeignKey("ChangesetId")] //public virtual Changeset Changeset { get; set; } ///// ///// predefined by business ///// //[Required] //[MaxLength(100)] public string ItemName { get; set; } //public PosItemUnitId UnitId { get; set; } public decimal Price { get; set; } //public DateTime DateToActivate { get; set; } //public DateTime DateToDeactivate { get; set; } ///// ///// Gets or sets the datetime when this PosItem created and saved into database. ///// normally this time should be automatically set at the saving time (to db). ///// //[Index("IX_CreatedDateTime", IsUnique = false)] //public DateTime CreatedDateTime { get; set; } public bool IsFuelItem { get; set; } ///// ///// Gets or sets if this item had been marked as deleted, and will not allow to sale anymore. ///// //public bool IsMarkedAsDeletion { get; set; } ///// ///// defined and involved in which Pos Discount definition. ///// The PosDiscount typically downloaded and parsed from a table download or BOS download. ///// ////public virtual List AppliedInPosDiscounts { get; set; } ///// ///// A PosItem should only belongs to one Group, but why we not setup a simple Foreign key property ///// here? because the Group must be chained with the BU of this PosItem assgined(a BU have ONLY ONE specified BU system at a time). ///// think about the case, a PosItem under BU A set with Group B, someday someone changed its BU to C, then the B for this Item ///// is not available anymore, we have to anually maintain(update B to something else, otherwise the item is still with the old group which even may not under the new group system) ///// this 2 properties' relation otherwise this object is in a wrong state, which is bad. ///// the solution is to create a dedicated DB tables to maintain the PosItem and Group relation, rather to do that, ///// why not choose a ManyToMany property which EF support originally. ///// //public virtual List AppliedInPosItemGroups { get; set; } //public virtual Guid TargetBusinessUnitId { get; set; } } }