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; namespace Payroll.BO { #region ApproveFinantialData [Serializable] public class ApproveFinantialData : BasicBaseObject { #region Cache Store private static Cache _cache = new Cache(typeof(ApproveFinantialData)); #endregion #region Constructor public ApproveFinantialData() { _finanatialDataType = EnumApprovalFinancialData.Allowance; _employeeID = null; _objectID = 0; _salaryMonth = DateTime.Today; _approvedby = 0; _approvedDate = DateTime.Today; } #endregion #region Properties #region FinanatialDataType : ID private EnumApprovalFinancialData _finanatialDataType; public EnumApprovalFinancialData FinanatialDataType { get { return _finanatialDataType; } set { base.OnPropertyChange("FinanatialDataType", (short)_finanatialDataType, (short)value); _finanatialDataType = value; } } #endregion #region EmployeeID : ID private ID _employeeID; public ID EmployeeID { get { return _employeeID; } set { base.OnPropertyChange("EmployeeID", _employeeID, value); _employeeID = value; } } #endregion #region ObjectID : int private int _objectID; public int ObjectID { get { return _objectID; } set { base.OnPropertyChange("ObjectID", _objectID, value); _objectID = value; } } #endregion #region SalaryMonth : ID private DateTime _salaryMonth; public DateTime SalaryMonth { get { return _salaryMonth; } set { base.OnPropertyChange("SalaryMonth", _salaryMonth, value); _salaryMonth = value; } } #endregion #region Approvedby : int private int _approvedby; public int Approvedby { get { return _approvedby; } set { base.OnPropertyChange("Approvedby", _approvedby, value); _approvedby = value; } } #endregion #region ApprovedDate : DateTime private DateTime _approvedDate; public DateTime ApprovedDate { get { return _approvedDate; } set { base.OnPropertyChange("ApprovedDate", _approvedDate, value); _approvedDate = value; } } #endregion #region Service Factory IApproveFinantialDataService : IApproveFinantialDataService internal static IApproveFinantialDataService Service { get { return Services.Factory.CreateService(typeof(IApproveFinantialDataService)); } } #endregion #endregion #region Functions public static ApproveFinantialData Get(int EmpID,DateTime dt) { ApproveFinantialData oItem = null; #region Cache Header oItem = (ApproveFinantialData)_cache["Get", EmpID, dt]; if (oItem != null) return oItem; #endregion oItem = ApproveFinantialData.Service.Get(EmpID, dt); #region Cache Footer _cache.Add(oItem, "Get", EmpID, dt); #endregion return oItem; } public static ObjectsTemplate Get(ID nObjectID) { #region Cache Header ObjectsTemplate ApproveFinantialDatas = _cache["Get",nObjectID] as ObjectsTemplate; if (ApproveFinantialDatas != null) return ApproveFinantialDatas; #endregion try { ApproveFinantialDatas = Service.Get(nObjectID); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(ApproveFinantialDatas, "Get",nObjectID); #endregion return ApproveFinantialDatas; } public static ObjectsTemplate GetByMonth(DateTime dtStart,DateTime dtEnd) { #region Cache Header ObjectsTemplate ApproveFinantialDatas = _cache["GetByMonth", dtStart, dtEnd] as ObjectsTemplate; if (ApproveFinantialDatas != null) return ApproveFinantialDatas; #endregion try { ApproveFinantialDatas = Service.GetByMonth( dtStart, dtEnd); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(ApproveFinantialDatas, "GetByMonth", dtStart, dtEnd); #endregion return ApproveFinantialDatas; } public static ObjectsTemplate Get() { #region Cache Header ObjectsTemplate ApproveFinantialDatas = _cache["Get"] as ObjectsTemplate; if (ApproveFinantialDatas != null) return ApproveFinantialDatas; #endregion try { ApproveFinantialDatas = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(ApproveFinantialDatas, "Get"); #endregion return ApproveFinantialDatas; } public void Save( ObjectsTemplate items) { this.SetAuditTrailProperties(); ApproveFinantialData.Service.Save(items); } public void Delete(ApproveFinantialData item) { ApproveFinantialData.Service.Delete(item); } #endregion } #endregion #region IApproveFinantialData Service public interface IApproveFinantialDataService { ApproveFinantialData Get(int EmpID, DateTime dt); ObjectsTemplate Get(ID id); ObjectsTemplate Get(); ObjectsTemplate GetByMonth(DateTime dtStart, DateTime dtEnd); void Save(ObjectsTemplate items); void Delete(ApproveFinantialData item); } #endregion }