176 lines
5.8 KiB
C#
176 lines
5.8 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using Ease.CoreV35;
|
|
using Ease.CoreV35.Model;
|
|
using Ease.CoreV35.DataAccess;
|
|
using System.Collections.Generic;
|
|
using Payroll.BO;
|
|
using Ease.CoreV35.Caching;
|
|
|
|
namespace Payroll.Service
|
|
{
|
|
#region UnAuthorizeLeaveParameter Service
|
|
[Serializable]
|
|
public class UnAuthorizeLeaveParameterService : ServiceTemplate, IUnAuthorizeLeaveParameterService
|
|
{
|
|
#region Private functions and declaration
|
|
Cache _cache = new Cache(typeof(UnAuthorizeLeaveParamDetail));
|
|
|
|
#endregion
|
|
|
|
public UnAuthorizeLeaveParameterService() { }
|
|
|
|
private void MapObject(UnAuthorizeLeaveParamDetail oUnAuthorizeLeaveParameter, DataReader oReader)
|
|
{
|
|
base.SetObjectID(oUnAuthorizeLeaveParameter, oReader.GetID("ParamDetailID"));
|
|
oUnAuthorizeLeaveParameter.LeaveID = oReader.GetID("LeaveID");
|
|
oUnAuthorizeLeaveParameter.AllowanceID = oReader.GetID("ALLOWANCEID");
|
|
oUnAuthorizeLeaveParameter.UNLeaveParamID = oReader.GetID("UaLeaveParamID");
|
|
oUnAuthorizeLeaveParameter.ValueInPercent = oReader.GetDouble("VALUEINPERCENT").Value;
|
|
oUnAuthorizeLeaveParameter.Type = (EnumSalaryComponent)oReader.GetInt32("Type").Value;
|
|
this.SetObjectState(oUnAuthorizeLeaveParameter, Ease.CoreV35.ObjectState.Saved);
|
|
}
|
|
|
|
protected override T CreateObject<T>(DataReader oReader)
|
|
{
|
|
UnAuthorizeLeaveParamDetail oUnAuthorizeLeaveParameter = new UnAuthorizeLeaveParamDetail();
|
|
MapObject(oUnAuthorizeLeaveParameter, oReader);
|
|
return oUnAuthorizeLeaveParameter as T;
|
|
}
|
|
|
|
protected UnAuthorizeLeaveParamDetail CreateObject(DataReader oReader)
|
|
{
|
|
UnAuthorizeLeaveParamDetail oUnAuthorizeLeaveParameter = new UnAuthorizeLeaveParamDetail();
|
|
MapObject(oUnAuthorizeLeaveParameter, oReader);
|
|
return oUnAuthorizeLeaveParameter;
|
|
}
|
|
|
|
#region Service implementation
|
|
|
|
public UnAuthorizeLeaveParamDetail Get(ID id)
|
|
{
|
|
UnAuthorizeLeaveParamDetail oUnAuthorizeLeaveParameter = new UnAuthorizeLeaveParamDetail();
|
|
#region Cache Header
|
|
oUnAuthorizeLeaveParameter = _cache["Get", id] as UnAuthorizeLeaveParamDetail;
|
|
if (oUnAuthorizeLeaveParameter != null)
|
|
return oUnAuthorizeLeaveParameter;
|
|
#endregion
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
DataReader oreader = new DataReader(UnAuthorizeLeaveParameterDA.Get(tc, id));
|
|
if (oreader.Read())
|
|
{
|
|
oUnAuthorizeLeaveParameter = this.CreateObject<UnAuthorizeLeaveParamDetail>(oreader);
|
|
}
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
throw new ServiceException(e.Message, e);
|
|
#endregion
|
|
}
|
|
#region Cache Footer
|
|
_cache.Add(oUnAuthorizeLeaveParameter, "Get", id);
|
|
#endregion
|
|
return oUnAuthorizeLeaveParameter;
|
|
}
|
|
|
|
public ObjectsTemplate<UnAuthorizeLeaveParamDetail> Get()
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<UnAuthorizeLeaveParamDetail> unAuthorizeLeaveParameters = _cache["Get"] as ObjectsTemplate<UnAuthorizeLeaveParamDetail>;
|
|
if (unAuthorizeLeaveParameters != null)
|
|
return unAuthorizeLeaveParameters;
|
|
|
|
#endregion
|
|
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
|
|
DataReader dr = new DataReader(UnAuthorizeLeaveParameterDA.Get(tc));
|
|
unAuthorizeLeaveParameters = this.CreateObjects<UnAuthorizeLeaveParamDetail>(dr);
|
|
dr.Close();
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(unAuthorizeLeaveParameters, "Get");
|
|
|
|
#endregion
|
|
|
|
return unAuthorizeLeaveParameters;
|
|
}
|
|
|
|
public ObjectsTemplate<UnAuthorizeLeaveParamDetail> GetDetail(ID nUnLeaveParamID)
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<UnAuthorizeLeaveParamDetail> unAuthorizeLeaveParameters = _cache["GetDetail", nUnLeaveParamID] as ObjectsTemplate<UnAuthorizeLeaveParamDetail>;
|
|
if (unAuthorizeLeaveParameters != null)
|
|
return unAuthorizeLeaveParameters;
|
|
|
|
#endregion
|
|
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
|
|
DataReader dr = new DataReader(UnAuthorizeLeaveParameterDA.GetDetail(tc, nUnLeaveParamID));
|
|
unAuthorizeLeaveParameters = this.CreateObjects<UnAuthorizeLeaveParamDetail>(dr);
|
|
dr.Close();
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(unAuthorizeLeaveParameters, "GetDetail", nUnLeaveParamID);
|
|
|
|
#endregion
|
|
|
|
return unAuthorizeLeaveParameters;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
#endregion
|
|
}
|