using System; using System.Collections.Generic; using Tanshu.Accounts.Contracts; using Tanshu.Accounts.Contracts.Attributes; using Tanshu.Accounts.Entities.Auth; namespace Tanshu.Accounts.Entities { public class Voucher { protected Voucher() { Kots = new List(); Settlements = new List(); } public Voucher(User user) : this() { this._date = null; this.User = user; VoucherType = VoucherType.Regular; } public Voucher(User user, Customer customer, string table, Waiter waiter ,bool printed, bool isVoid, string narration ) : this(user) { Customer = customer; TableID = table; Waiter = waiter; _printed = printed; Void = isVoid; Narration = narration; VoucherType = VoucherType.Regular; } protected int _voucherID; public virtual int VoucherID { get { return _voucherID; } } protected DateTime? _date; public virtual DateTime? Date { get { return _date; } } public virtual int Pax { get; set; } [NotNull] public virtual User User { get; set; } protected DateTime _creationDate; [NotNull] public virtual DateTime CreationDate { get { return _creationDate; } } protected DateTime _lastEditDate; [NotNull] public virtual DateTime LastEditDate { get { return _lastEditDate; } } protected string _billID; [NotNull] public virtual string BillID { get { return _billID; } } [NotNull] public virtual string TableID { get; set; } [NotNull] public virtual Waiter Waiter { get; set; } [NotNull] public virtual Customer Customer { get; set; } [Cascade] public virtual IList Settlements { get; set; } public virtual string Narration { get; set; } [NotNull] public virtual bool Void { get; set; } [AllowNull] public virtual string VoidReason { get; set; } protected bool _printed; [NotNull] public virtual bool Printed { get { return _printed; } set { if (_printed) return; if (value == false) return; _date = null; _printed = value; } } public virtual VoucherType VoucherType { get; set; } private string _kotID; [NotNull] public virtual string KotID { get { return _kotID; } } [Cascade] public virtual IList Kots { get; set; } } }