211 lines
6.6 KiB
C#
211 lines
6.6 KiB
C#
|
using System;
|
|||
|
using System.Data;
|
|||
|
using Ease.Core.Model;
|
|||
|
using Ease.Core.DataAccess;
|
|||
|
using Ease.Core;
|
|||
|
using System.Collections.Generic;
|
|||
|
using Ease.Core.Utility;
|
|||
|
using HRM.BO;
|
|||
|
|
|||
|
namespace HRM.DA
|
|||
|
{
|
|||
|
#region ReplaceEmployeesObjectives Service
|
|||
|
|
|||
|
public class ReplaceEmployeesObjectivesService : ServiceTemplate
|
|||
|
{
|
|||
|
#region Private functions and declaration
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
public ReplaceEmployeesObjectivesService()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
private void MapObject(ReplaceEmployeesObjectives oReplaceEmployeesObjectives, DataReader oReader)
|
|||
|
{
|
|||
|
base.SetObjectID(oReplaceEmployeesObjectives, oReader.GetInt32("ReplaceEmployeesObjectivesID", 0));
|
|||
|
oReplaceEmployeesObjectives.RequestedEmployeeID = oReader.GetInt32("RequestedEmployeeID", 0);
|
|||
|
oReplaceEmployeesObjectives.AssignedForEmployeeID = oReader.GetInt32("AssignedForEmployeeID", 0);
|
|||
|
oReplaceEmployeesObjectives.AssignedToEmployeeID = oReader.GetInt32("AssignedToEmployeeID", 0);
|
|||
|
oReplaceEmployeesObjectives.PMPYearID = oReader.GetInt32("PMPYearID", 0);
|
|||
|
oReplaceEmployeesObjectives.IsApproved = oReader.GetBoolean("IsApproved").Value;
|
|||
|
oReplaceEmployeesObjectives.ApprovalDate = oReader.GetDateTime("ApprovalDate").Value;
|
|||
|
oReplaceEmployeesObjectives.ApprovedBy = oReader.GetInt32("ApprovedBy", 0);
|
|||
|
|
|||
|
|
|||
|
//oReplaceEmployeesObjectives.Status = (((EnumStatus)))oReader.GetInt32("Status").Value;
|
|||
|
|
|||
|
this.SetObjectState(oReplaceEmployeesObjectives, Ease.Core.ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
protected override T CreateObject<T>(DataReader oReader)
|
|||
|
{
|
|||
|
ReplaceEmployeesObjectives oReplaceEmployeesObjectives = new ReplaceEmployeesObjectives();
|
|||
|
MapObject(oReplaceEmployeesObjectives, oReader);
|
|||
|
return oReplaceEmployeesObjectives as T;
|
|||
|
}
|
|||
|
|
|||
|
protected ReplaceEmployeesObjectives CreateObject(DataReader oReader)
|
|||
|
{
|
|||
|
ReplaceEmployeesObjectives oReplaceEmployeesObjectives = new ReplaceEmployeesObjectives();
|
|||
|
MapObject(oReplaceEmployeesObjectives, oReader);
|
|||
|
return oReplaceEmployeesObjectives;
|
|||
|
}
|
|||
|
|
|||
|
#region Service implementation
|
|||
|
|
|||
|
public List<ReplaceEmployeesObjectives> Get()
|
|||
|
{
|
|||
|
List<ReplaceEmployeesObjectives> ReplaceEmployeesObjectivess = new List<ReplaceEmployeesObjectives>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
|
|||
|
DataReader dr = new DataReader(ReplaceEmployeesObjectivesDA.Get(tc));
|
|||
|
ReplaceEmployeesObjectivess = this.CreateObjects<ReplaceEmployeesObjectives>(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 ReplaceEmployeesObjectivess;
|
|||
|
}
|
|||
|
|
|||
|
public List<ReplaceEmployeesObjectives> Get(int nPMPYearID)
|
|||
|
{
|
|||
|
List<ReplaceEmployeesObjectives> ReplaceEmployeesObjectivess = new List<ReplaceEmployeesObjectives>();
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
|
|||
|
DataReader dr = new DataReader(ReplaceEmployeesObjectivesDA.Get(tc, nPMPYearID));
|
|||
|
ReplaceEmployeesObjectivess = this.CreateObjects<ReplaceEmployeesObjectives>(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 ReplaceEmployeesObjectivess;
|
|||
|
}
|
|||
|
|
|||
|
public List<ReplaceEmployeesObjectives> Get(int nPMPYearID, int nEmpID)
|
|||
|
{
|
|||
|
List<ReplaceEmployeesObjectives> ReplaceEmployeesObjectivess = new List<ReplaceEmployeesObjectives>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
|
|||
|
DataReader dr = new DataReader(ReplaceEmployeesObjectivesDA.Get(tc, nPMPYearID, nEmpID));
|
|||
|
ReplaceEmployeesObjectivess = this.CreateObjects<ReplaceEmployeesObjectives>(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 ReplaceEmployeesObjectivess;
|
|||
|
}
|
|||
|
|
|||
|
public int Save(ReplaceEmployeesObjectives oReplaceEmployeesObjectives)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
if (oReplaceEmployeesObjectives.IsNew)
|
|||
|
{
|
|||
|
int id = tc.GenerateID("ReplaceEmployeesObjectives", "ReplaceEmployeesObjectivesID");
|
|||
|
base.SetObjectID(oReplaceEmployeesObjectives, (id));
|
|||
|
ReplaceEmployeesObjectivesDA.Insert(tc, oReplaceEmployeesObjectives);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ReplaceEmployeesObjectivesDA.Update(tc, oReplaceEmployeesObjectives);
|
|||
|
}
|
|||
|
|
|||
|
tc.End();
|
|||
|
return oReplaceEmployeesObjectives.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);
|
|||
|
ReplaceEmployeesObjectivesDA.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
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|