using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.CoreV35.Caching; using Ease.CoreV35.Model; namespace Payroll.BO { #region VendorBill [Serializable] public class VendorBill : BasicBaseObject { #region Cache Store private static Cache _cache = new Cache(typeof(VendorBill)); #endregion #region Constructor public VendorBill() { _nVendorID = null; _bIsFullPaid = false ; _bIsAdvance = false; _sRemarks = string.Empty; _dAmount = 0.0; _dEffectDate = DateTime.MinValue; _sChalanNumber = string.Empty; } #endregion #region Properties #region VendorID private ID _nVendorID; public ID VendorID { get { return _nVendorID; } set { _nVendorID = value; } } #endregion #region ChalanNumber private string _sChalanNumber; public string ChalanNumber { get { return _sChalanNumber; } set { _sChalanNumber = value; } } #endregion #region EffectDate private DateTime _dEffectDate; public DateTime EffectDate { get { return _dEffectDate; } set { _dEffectDate = value; } } #endregion #region Amount private double _dAmount; public double Amount { get { return _dAmount; } set { _dAmount = value; } } #endregion #region PaymentMode private EnumVendorPaymentMode _ePaymentMode; public EnumVendorPaymentMode PaymentMode { get { return _ePaymentMode; } set { _ePaymentMode = value; } } #endregion #region Remarks private string _sRemarks; public string Remarks { get { return _sRemarks; } set { _sRemarks = value; } } #endregion #region IsAdvance private bool _bIsAdvance; public bool IsAdvance { get { return _bIsAdvance; } set { _bIsAdvance = value; } } #endregion #region IsFullPaid private bool _bIsFullPaid; public bool IsFullPaid { get { return _bIsFullPaid; } set { _bIsFullPaid = value; } } #endregion #region Service Factory internal static IVendorBillService Service { get { return Services.Factory.CreateService(typeof(IVendorBillService)); } } #endregion #endregion #region Functions public static VendorBill Get(ID vendorBillId) { VendorBill oVendorBill = null; #region Cache Header oVendorBill = (VendorBill)_cache["Get", vendorBillId]; if (oVendorBill != null) return oVendorBill; #endregion oVendorBill = VendorBill.Service.Get(vendorBillId); #region Cache Footer _cache.Add(oVendorBill, "Get", vendorBillId); #endregion return oVendorBill; } public ID Save() { this.SetAuditTrailProperties(); return VendorBill.Service.Save(this); } public void Delete(ID id) { VendorBill.Service.Delete(id); } #endregion #region Collection Functions public static ObjectsTemplate Get() { #region Cache Header ObjectsTemplate vendorBills = _cache["Get"] as ObjectsTemplate; if (vendorBills != null) return vendorBills; #endregion vendorBills = VendorBill.Service.Get(); #region Cache Footer _cache.Add(vendorBills, "Get"); #endregion return vendorBills; } public static ObjectsTemplate Get(EnumVendorPaymentMode paymentMode) { #region Cache Header ObjectsTemplate vendorBills = _cache["Get", paymentMode] as ObjectsTemplate; if (vendorBills != null) return vendorBills; #endregion try { vendorBills = VendorBill.Service.Get(paymentMode); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(vendorBills, "Get", paymentMode); #endregion return vendorBills; } public static ObjectsTemplate GetByVendorID(ID id) { #region Cache Header ObjectsTemplate vendorBills = _cache["Get",id] as ObjectsTemplate; if (vendorBills != null) return vendorBills; #endregion vendorBills = VendorBill.Service.GetByVendorID(id); #region Cache Footer _cache.Add(vendorBills, "Get",id); #endregion return vendorBills; } #endregion } #endregion #region IVendorBill Service public interface IVendorBillService { VendorBill Get(ID id); ObjectsTemplate GetByVendorID(ID id); ObjectsTemplate Get(); ObjectsTemplate Get(EnumVendorPaymentMode paymentMode); ID Save(VendorBill oVendorBill); void Delete(ID id); } #endregion }