CEL_Payroll/Payroll.BO/Basic/ApproveFinantialData.cs

256 lines
7.0 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
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<short>("FinanatialDataType", (short)_finanatialDataType, (short)value);
_finanatialDataType = value;
}
}
#endregion
#region EmployeeID : ID
private ID _employeeID;
public ID EmployeeID
{
get { return _employeeID; }
set
{
base.OnPropertyChange<ID>("EmployeeID", _employeeID, value);
_employeeID = value;
}
}
#endregion
#region ObjectID : int
private int _objectID;
public int ObjectID
{
get { return _objectID; }
set
{
base.OnPropertyChange<int>("ObjectID", _objectID, value);
_objectID = value;
}
}
#endregion
#region SalaryMonth : ID
private DateTime _salaryMonth;
public DateTime SalaryMonth
{
get { return _salaryMonth; }
set
{
base.OnPropertyChange<DateTime>("SalaryMonth", _salaryMonth, value);
_salaryMonth = value;
}
}
#endregion
#region Approvedby : int
private int _approvedby;
public int Approvedby
{
get { return _approvedby; }
set
{
base.OnPropertyChange<int>("Approvedby", _approvedby, value);
_approvedby = value;
}
}
#endregion
#region ApprovedDate : DateTime
private DateTime _approvedDate;
public DateTime ApprovedDate
{
get { return _approvedDate; }
set
{
base.OnPropertyChange<DateTime>("ApprovedDate", _approvedDate, value);
_approvedDate = value;
}
}
#endregion
#region Service Factory IApproveFinantialDataService : IApproveFinantialDataService
internal static IApproveFinantialDataService Service
{
get { return Services.Factory.CreateService<IApproveFinantialDataService>(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<ApproveFinantialData> Get(ID nObjectID)
{
#region Cache Header
ObjectsTemplate<ApproveFinantialData> ApproveFinantialDatas = _cache["Get",nObjectID] as ObjectsTemplate<ApproveFinantialData>;
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<ApproveFinantialData> GetByMonth(DateTime dtStart,DateTime dtEnd)
{
#region Cache Header
ObjectsTemplate<ApproveFinantialData> ApproveFinantialDatas = _cache["GetByMonth", dtStart, dtEnd] as ObjectsTemplate<ApproveFinantialData>;
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<ApproveFinantialData> Get()
{
#region Cache Header
ObjectsTemplate<ApproveFinantialData> ApproveFinantialDatas = _cache["Get"] as ObjectsTemplate<ApproveFinantialData>;
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<ApproveFinantialData> 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<ApproveFinantialData> Get(ID id);
ObjectsTemplate<ApproveFinantialData> Get();
ObjectsTemplate<ApproveFinantialData> GetByMonth(DateTime dtStart, DateTime dtEnd);
void Save(ObjectsTemplate<ApproveFinantialData> items);
void Delete(ApproveFinantialData item);
}
#endregion
}