using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.CoreV35; using Ease.CoreV35.Model; using Ease.CoreV35.Caching; using System.Data.Linq.Mapping; using System.Data; namespace Payroll.BO { #region OPIPayment [Serializable] public class OPIPayment : BasicBaseObject { #region Cache Store private static Cache _cache = new Cache(typeof(OPIPayment)); #endregion #region Constructor public OPIPayment() { _oPIItemID = null; _employeeID = null; _paymentDate = DateTime.Today; _amount = 0; _changedAmount = 0; _changeTaxAmount = 0; _taxAmount = 0; _remarks = string.Empty; } #endregion #region Properties #region OPIItemID : ID private ID _oPIItemID; public ID OPIItemID { get { return _oPIItemID; } set { base.OnPropertyChange("opiitemid", _oPIItemID, value); _oPIItemID = value; } } #endregion #region EmployeeID : ID private ID _employeeID; public ID EmployeeID { get { return _employeeID; } set { base.OnPropertyChange("employeeid", _employeeID, value); _employeeID = value; } } #endregion #region PaymentDate : DateTime private DateTime _paymentDate; public DateTime PaymentDate { get { return _paymentDate; } set { base.OnPropertyChange("paymentdate", _paymentDate, value); _paymentDate = value; } } #endregion #region Amount : double private double _amount; public double Amount { get { return _amount; } set { base.OnPropertyChange("amount", _amount, value); _amount = value; } } #endregion #region ChangedAmount : double private double _changedAmount; public double ChangedAmount { get { return _changedAmount; } set { base.OnPropertyChange("ChangedAmount", _changedAmount, value); _changedAmount = value; } } #endregion #region ChangedAmount : double private double _changeTaxAmount; public double ChangeTaxAmount { get { return _changeTaxAmount; } set { base.OnPropertyChange("ChangeTaxAmount", _changeTaxAmount, value); _changeTaxAmount = value; } } #endregion #region TaxAmount : double private double _taxAmount; public double TaxAmount { get { return _taxAmount; } set { base.OnPropertyChange("taxamount", _taxAmount, value); _taxAmount = value; } } #endregion #region Remarks : string private string _remarks; public string Remarks { get { return _remarks; } set { base.OnPropertyChange("remarks", _remarks, value); _remarks = value; } } #endregion #region Service Factory IOPIPaymentService : IOPIPaymentService internal static IOPIPaymentService Service { get { return Services.Factory.CreateService(typeof(IOPIPaymentService)); } } #endregion #endregion #region Functions public static OPIPayment Get(ID nOPIPaymentID) { OPIPayment oOPIPayment = null; #region Cache Header oOPIPayment = (OPIPayment)_cache["Get", nOPIPaymentID]; if (oOPIPayment != null) return oOPIPayment; #endregion oOPIPayment = OPIPayment.Service.Get(nOPIPaymentID); #region Cache Footer _cache.Add(oOPIPayment, "Get", nOPIPaymentID); #endregion return oOPIPayment; } public string GetNextCode() { return OPIPayment.Service.GetNextCode(); } public static ObjectsTemplate Get() { #region Cache Header ObjectsTemplate oOPIPayments = _cache["Get"] as ObjectsTemplate; if (oOPIPayments != null) return oOPIPayments; #endregion try { oOPIPayments = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(oOPIPayments, "Get"); #endregion return oOPIPayments; } public static DataSet GetDataSetOfPaymentEmployees(ID nOpiItemID, EnumOpiType nOpiType) { DataSet dsEmployees = null; dsEmployees = OPIPayment.Service.GetDataSetOfPaymentEmployees(nOpiItemID, nOpiType); return dsEmployees; } public ID Save() { this.SetAuditTrailProperties(); return OPIPayment.Service.Save(this); } public void Save(ObjectsTemplate opiPaymets) { this.SetAuditTrailProperties(); OPIPayment.Service.Save(opiPaymets); } public void Delete(ID id) { OPIPayment.Service.Delete(id); } #endregion } #endregion #region IOPIPayment Service public interface IOPIPaymentService { OPIPayment Get(ID id); ObjectsTemplate Get(); DataSet GetDataSetOfPaymentEmployees(ID nOpiItemID, EnumOpiType nOpiType); string GetNextCode(); ID Save(OPIPayment item); void Save(ObjectsTemplate opiPaymets); void Delete(ID id); } #endregion }