296 lines
8.2 KiB
C#
296 lines
8.2 KiB
C#
using Ease.Core.DataAccess;
|
|
using Ease.Core.Model;
|
|
using Ease.Core.Utility;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using HRM.BO;
|
|
|
|
namespace HRM.DA
|
|
{
|
|
public class PayScaleDetailService : ServiceTemplate, IPayScaleDetailService
|
|
{
|
|
public PayScaleDetailService()
|
|
{
|
|
}
|
|
|
|
private void MapObject(PayScaleDetail oPayScaleDetail, DataReader oReader)
|
|
{
|
|
base.SetObjectID(oPayScaleDetail, oReader.GetInt32("PAYSCALEITEMID").Value);
|
|
oPayScaleDetail.PayscaleID = oReader.GetInt32("PAYSCALEID", 0);
|
|
oPayScaleDetail.GradeID = oReader.GetInt32("GradeID", 0);
|
|
oPayScaleDetail.StepNo = oReader.GetInt32("SCALESERIALNO").Value;
|
|
oPayScaleDetail.Amount = oReader.GetDouble("AMOUNT").Value;
|
|
oPayScaleDetail.StepAmount = oReader.GetDouble("SLABAMOUNT").Value;
|
|
oPayScaleDetail.StepIncrement = oReader.GetDouble("StepIncrement").Value;
|
|
this.SetObjectState(oPayScaleDetail, Ease.Core.ObjectState.Saved);
|
|
}
|
|
|
|
protected override T CreateObject<T>(DataReader oReader)
|
|
{
|
|
PayScaleDetail oPayScaleDetail = new PayScaleDetail();
|
|
MapObject(oPayScaleDetail, oReader);
|
|
return oPayScaleDetail as T;
|
|
}
|
|
|
|
#region Service implementation
|
|
|
|
public PayScaleDetail Get(int id)
|
|
{
|
|
PayScaleDetail oPayScaleDetail = null;
|
|
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
DataReader oreader = new DataReader(PayScaleDetailDA.Get(tc, id));
|
|
if (oreader.Read())
|
|
{
|
|
oPayScaleDetail = this.CreateObject<PayScaleDetail>(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
|
|
}
|
|
|
|
return oPayScaleDetail;
|
|
}
|
|
|
|
public PayScaleDetail Get(TransactionContext tc, int id)
|
|
{
|
|
PayScaleDetail oPayScaleDetail = null;
|
|
try
|
|
{
|
|
DataReader oreader = new DataReader(PayScaleDetailDA.Get(tc, id));
|
|
if (oreader.Read())
|
|
{
|
|
oPayScaleDetail = this.CreateObject<PayScaleDetail>(oreader);
|
|
}
|
|
|
|
oreader.Close();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
ExceptionLog.Write(e);
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return oPayScaleDetail;
|
|
}
|
|
|
|
public List<PayScaleDetail> GetByPayScale(int payscaleID)
|
|
{
|
|
List<PayScaleDetail> payScaleDetails = new List<PayScaleDetail>();
|
|
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
|
|
DataReader dr = new DataReader(PayScaleDetailDA.GetByPayScale(tc, payscaleID));
|
|
payScaleDetails = this.CreateObjects<PayScaleDetail>(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
|
|
}
|
|
|
|
|
|
return payScaleDetails;
|
|
}
|
|
|
|
public List<PayScaleDetail> GetByPayScale(TransactionContext tc, int payscaleID)
|
|
{
|
|
List<PayScaleDetail> payScaleDetails = new List<PayScaleDetail>();
|
|
|
|
try
|
|
{
|
|
DataReader dr = new DataReader(PayScaleDetailDA.GetByPayScale(tc, payscaleID));
|
|
payScaleDetails = this.CreateObjects<PayScaleDetail>(dr);
|
|
dr.Close();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
ExceptionLog.Write(e);
|
|
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
|
|
|
|
return payScaleDetails;
|
|
}
|
|
|
|
public List<PayScaleDetail> GetByGradeID(int GradeID, int payrollTypeID)
|
|
{
|
|
List<PayScaleDetail> payScaleDetails = new List<PayScaleDetail>();
|
|
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
|
|
DataReader dr = new DataReader(PayScaleDetailDA.GetByGradeID(tc, GradeID, payrollTypeID));
|
|
payScaleDetails = this.CreateObjects<PayScaleDetail>(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
|
|
}
|
|
|
|
return payScaleDetails;
|
|
}
|
|
|
|
|
|
public List<PayScaleDetail> Get(int GradeID, int AllowID)
|
|
{
|
|
List<PayScaleDetail> payScaleDetails = new List<PayScaleDetail>();
|
|
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
|
|
DataReader dr = new DataReader(PayScaleDetailDA.Get(tc, GradeID, AllowID));
|
|
payScaleDetails = this.CreateObjects<PayScaleDetail>(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
|
|
}
|
|
|
|
return payScaleDetails;
|
|
}
|
|
|
|
|
|
public List<PayScaleDetail> Get()
|
|
{
|
|
List<PayScaleDetail> payScaleDetails = new List<PayScaleDetail>();
|
|
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
|
|
DataReader dr = new DataReader(PayScaleDetailDA.Get(tc));
|
|
payScaleDetails = this.CreateObjects<PayScaleDetail>(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
|
|
}
|
|
|
|
return payScaleDetails;
|
|
}
|
|
|
|
public int Save(PayScaleDetail oPayScaleDetail)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
int id = tc.GenerateID("PayScaleDetail", "PayScaleDetailID");
|
|
base.SetObjectID(oPayScaleDetail, id);
|
|
PayScaleDetailDA.Insert(tc, oPayScaleDetail);
|
|
tc.End();
|
|
return oPayScaleDetail.ID;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
public void Delete(int id)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
PayScaleDetailDA.Delete(tc, id);
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |