919 lines
31 KiB
C#
919 lines
31 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;
|
|||
|
using Payroll.Service;
|
|||
|
|
|||
|
namespace HRM.DA
|
|||
|
{
|
|||
|
public class ObjectiveSetService : ServiceTemplate, IObjectiveSetService
|
|||
|
{
|
|||
|
#region Object Mapping
|
|||
|
|
|||
|
private void MapObject(ObjectiveSet oObjectiveSet, DataReader oReader)
|
|||
|
{
|
|||
|
SetObjectID(oObjectiveSet, oReader.GetInt32("ObjectiveSetID", 0));
|
|||
|
oObjectiveSet.PMPYearID = oReader.GetInt32("PMPYearID", 0);
|
|||
|
oObjectiveSet.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
oObjectiveSet.EmployeeNodeID = oReader.GetInt32("EmployeeNodeID", 0);
|
|||
|
oObjectiveSet.LMID = oReader.GetInt32("LMID", 0);
|
|||
|
oObjectiveSet.LMNodeID = oReader.GetInt32("LMNodeID", 0);
|
|||
|
oObjectiveSet.OverallOBRating = oReader.GetDouble("OverallOBRating").Value == 0.0
|
|||
|
? 0.0
|
|||
|
: oReader.GetDouble("OverallOBRating").Value;
|
|||
|
oObjectiveSet.OverallValuesRating = oReader.GetDouble("OverallValuesRating").Value == 0.0
|
|||
|
? 0.0
|
|||
|
: oReader.GetDouble("OverallValuesRating").Value;
|
|||
|
oObjectiveSet.OBEmpComplete = oReader.GetBoolean("OBEmpComplete").Value;
|
|||
|
oObjectiveSet.OBLMComplete = (EnumObjectiveFlowStatus)oReader.GetInt32("OBLMComplete");
|
|||
|
oObjectiveSet.MYEmpComplete = (EnumObjectiveFlowStatus)oReader.GetInt32("MYEmpComplete");
|
|||
|
oObjectiveSet.MYLMComplete = (EnumObjectiveFlowStatus)oReader.GetInt32("MYLMComplete");
|
|||
|
oObjectiveSet.MYEmpAgreed = (EnumObjectiveFlowStatus)oReader.GetInt32("MYEmpAgreed");
|
|||
|
oObjectiveSet.YEEmpComplete = (EnumObjectiveFlowStatus)oReader.GetInt32("YEEmpComplete");
|
|||
|
oObjectiveSet.YELMComplete = (EnumObjectiveFlowStatus)oReader.GetInt32("YELMComplete");
|
|||
|
oObjectiveSet.YEEmpAgreed = (EnumObjectiveFlowStatus)oReader.GetInt32("YEEmpAgreed");
|
|||
|
oObjectiveSet.YEESendLMCmplete = (EnumObjectiveFlowStatus)oReader.GetInt32("YEESendLMCmplete");
|
|||
|
oObjectiveSet.DevelopmentPlanSubmit = (EnumObjectiveFlowStatus)oReader.GetInt32("DevelopmentPlanSubmit");
|
|||
|
oObjectiveSet.LMDevelopmentPlanSubmit =
|
|||
|
(EnumObjectiveFlowStatus)oReader.GetInt32("LMDevelopmentPlanSubmit");
|
|||
|
oObjectiveSet.YEDirectorCmplete = (EnumObjectiveFlowStatus)oReader.GetInt32("YEDirectorCmplete");
|
|||
|
oObjectiveSet.OverallEmpComments = oReader.GetString("OverallEmpComments");
|
|||
|
oObjectiveSet.OverallLMComments = oReader.GetString("OverallLMComments");
|
|||
|
oObjectiveSet.OverallSecondLMComments = oReader.GetString("OverallSecondLMComments");
|
|||
|
oObjectiveSet.OverallDirectorComments = oReader.GetString("OverallDirectorComments");
|
|||
|
oObjectiveSet.AuthorizedDPEmployeeID = oReader.GetInt32("AuthorizedDPEmployeeID", 0);
|
|||
|
oObjectiveSet.AuthorizedMYEmployeeID = oReader.GetInt32("AuthorizedMYEmployeeID", 0);
|
|||
|
oObjectiveSet.AuthorizedOBEmployeeID = oReader.GetInt32("AuthorizedOBEmployeeID", 0);
|
|||
|
oObjectiveSet.AuthorizedYEEmployeeID = oReader.GetInt32("AuthorizedYEEmployeeID", 0);
|
|||
|
oObjectiveSet.RevertComment = oReader.GetString("RevertComment");
|
|||
|
oObjectiveSet.SecondLMAgreed = oReader.GetBoolean("SecondLMAgreed").Value;
|
|||
|
oObjectiveSet.DirectorAgreed = oReader.GetBoolean("DirectorAgreed").Value;
|
|||
|
oObjectiveSet.IsLMRecommend = oReader.GetBoolean("IsLMRecommend").Value;
|
|||
|
oObjectiveSet.IsSecondLMRecommend = oReader.GetBoolean("IsSecondLMRecommend").Value;
|
|||
|
oObjectiveSet.IsDirectorRecommend = oReader.GetBoolean("IsDirectorRecommend").Value;
|
|||
|
oObjectiveSet.OBEmpCompleteDate = oReader.GetDateTime("OBEmpCompleteDate").HasValue
|
|||
|
? oReader.GetDateTime("OBEmpCompleteDate").Value
|
|||
|
: DateTime.MinValue;
|
|||
|
oObjectiveSet.OBLMCompleteDate = oReader.GetDateTime("OBLMCompleteDate").HasValue
|
|||
|
? oReader.GetDateTime("OBLMCompleteDate").Value
|
|||
|
: DateTime.MinValue;
|
|||
|
oObjectiveSet.NotificationStatus = oReader.GetInt32("NotificationStatus").HasValue
|
|||
|
? (EnumPMSNotificationStatus)oReader.GetInt32("NotificationStatus").Value
|
|||
|
: EnumPMSNotificationStatus.None;
|
|||
|
oObjectiveSet.EMPOBJRating = oReader.GetDouble("EMPOBJRATING", 0);
|
|||
|
oObjectiveSet.EMPValueRating = oReader.GetDouble("EMPVALUERATING", 0);
|
|||
|
oObjectiveSet.EMPOverallRating = oReader.GetDouble("EMPOverallRating", 0);
|
|||
|
oObjectiveSet.YeTotalObjectiveEmpMark = oReader.GetDouble("YeTotalObjectiveEmpMark").HasValue ? oReader.GetDouble("YeTotalObjectiveEmpMark").Value : null;
|
|||
|
oObjectiveSet.LMOBJRating = oReader.GetDouble("LMOBJRATING", 0);
|
|||
|
oObjectiveSet.LMValueRating = oReader.GetDouble("LMVALUERATING", 0);
|
|||
|
oObjectiveSet.LMOverallRating = oReader.GetDouble("LMOverallRating", 0);
|
|||
|
oObjectiveSet.YeTotalObjectiveLmMark = oReader.GetDouble("YeTotalObjectiveLmMark").HasValue ? oReader.GetDouble("YeTotalObjectiveLmMark").Value : null;
|
|||
|
oObjectiveSet.IsEditing = oReader.GetBoolean("IsEditing", false);
|
|||
|
oObjectiveSet.PreCalibrationRating = oReader.GetInt32("PreCalibrationRating", true, 0);
|
|||
|
oObjectiveSet.KeyPerformance = oReader.GetString("KeyPerformance", true, String.Empty);
|
|||
|
oObjectiveSet.Strength = oReader.GetString("Strength", true, String.Empty);
|
|||
|
oObjectiveSet.Opportunity = oReader.GetString("Opportunity", true, String.Empty);
|
|||
|
oObjectiveSet.SecondLMObjRating = oReader.GetDouble("SecondLMObjRating").HasValue ? oReader.GetDouble("SecondLMObjRating").Value : null;
|
|||
|
oObjectiveSet.SecondLMValueRating = oReader.GetDouble("SecondLMValueRating").HasValue ? oReader.GetDouble("SecondLMValueRating").Value : null;
|
|||
|
oObjectiveSet.SecondLMOverallRating = oReader.GetDouble("SecondLMOverallRating").HasValue ? oReader.GetDouble("SecondLMOverallRating").Value : null;
|
|||
|
this.SetObjectState(oObjectiveSet, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
protected override T CreateObject<T>(DataReader oReader)
|
|||
|
{
|
|||
|
ObjectiveSet oObjectiveSet = new ObjectiveSet();
|
|||
|
MapObject(oObjectiveSet, oReader);
|
|||
|
return oObjectiveSet as T;
|
|||
|
}
|
|||
|
|
|||
|
private List<Objective> CreateObjectives(DataReader oReader)
|
|||
|
{
|
|||
|
List<Objective> oObjectives = new List<Objective>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
Objective oObjective = new Objective();
|
|||
|
MapoObjectivesObject(oObjective, oReader);
|
|||
|
oObjectives.Add(oObjective);
|
|||
|
}
|
|||
|
|
|||
|
return oObjectives;
|
|||
|
}
|
|||
|
|
|||
|
private void MapoObjectivesObject(Objective oObjective, DataReader oReader)
|
|||
|
{
|
|||
|
base.SetObjectID(oObjective, oReader.GetInt32("ObjectiveID", 0));
|
|||
|
oObjective.ObjectiveSetID = oReader.GetInt32("ObjectiveSetID", 0);
|
|||
|
oObjective.PMPYearID = oReader.GetInt32("PMPYearID", 0);
|
|||
|
oObjective.Description = oReader.GetString("Description");
|
|||
|
oObjective.Activities = oReader.GetString("Activities");
|
|||
|
oObjective.MeasuresOfSuccess = oReader.GetString("MeasuresOfSuccess");
|
|||
|
oObjective.Weightages = oReader.GetDouble("Weightages").Value;
|
|||
|
oObjective.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
oObjective.EmployeeNodeID = oReader.GetInt32("EmployeeNodeID", 0);
|
|||
|
oObjective.ObjectiveDate = oReader.GetDateTime("ObjectiveDate").HasValue
|
|||
|
? oReader.GetDateTime("ObjectiveDate").Value
|
|||
|
: DateTime.MinValue;
|
|||
|
oObjective.LMID = oReader.GetInt32("LMID", 0);
|
|||
|
oObjective.LMNodeID = oReader.GetInt32("LMNodeID", 0);
|
|||
|
oObjective.LMRatingID = oReader.GetInt32("LMRatingID").GetValueOrDefault();
|
|||
|
oObjective.RagingDate = oReader.GetDateTime("RagingDate").HasValue
|
|||
|
? oReader.GetDateTime("RagingDate").Value
|
|||
|
: DateTime.MinValue;
|
|||
|
oObjective.MYEmployeeComments = oReader.GetString("MYEmployeeComments");
|
|||
|
oObjective.MYLMComments = oReader.GetString("MYLMComments");
|
|||
|
oObjective.IsDraft = oReader.GetBoolean("IsDraft").Value;
|
|||
|
oObjective.ObjectiveType = oReader.GetInt32("ObjectiveType").Value;
|
|||
|
oObjective.YEEmployeeComments = oReader.GetString("YEEmployeeComments");
|
|||
|
oObjective.YELMComments = oReader.GetString("YELMComments");
|
|||
|
oObjective.PriorityPercent = oReader.GetDouble("PriorityPercent").Value;
|
|||
|
|
|||
|
|
|||
|
this.SetObjectState(oObjective, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region IObjectiveSetService Members
|
|||
|
|
|||
|
#region Get All
|
|||
|
|
|||
|
public List<ObjectiveSet> Get()
|
|||
|
{
|
|||
|
List<ObjectiveSet> oObjectiveSet = null;
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(ObjectiveSetDA.Get(tc));
|
|||
|
oObjectiveSet = this.CreateObjects<ObjectiveSet>(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 oObjectiveSet;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Get By ID
|
|||
|
|
|||
|
public ObjectiveSet Get(int id)
|
|||
|
{
|
|||
|
ObjectiveSet oObjectiveSet = null;
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(ObjectiveSetDA.Get(tc, id));
|
|||
|
if (oreader.Read())
|
|||
|
{
|
|||
|
oObjectiveSet = this.CreateObject<ObjectiveSet>(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 oObjectiveSet;
|
|||
|
}
|
|||
|
|
|||
|
public DataTable GetSubordinatesAppraisalRating(int pmpYearId, string InEmpSQL)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
DataTable dtAppraisalRating = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
DataSet ds = ObjectiveSetDA.GetSubordinatesAppraisalRating(tc, pmpYearId, InEmpSQL);
|
|||
|
dtAppraisalRating = (ds != null && (ds.Tables != null && ds.Tables.Count > 0))
|
|||
|
? ds.Tables[0]
|
|||
|
: new DataTable();
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return dtAppraisalRating;
|
|||
|
}
|
|||
|
|
|||
|
public DataTable GetSubordinatesAppraisalRatingStatus(int pmpYearId, string InEmpSQL)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
DataTable dtAppraisalRating = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
DataSet ds = ObjectiveSetDA.GetSubordinatesAppraisalRatingStatus(tc, pmpYearId, InEmpSQL);
|
|||
|
dtAppraisalRating = (ds != null && (ds.Tables != null && ds.Tables.Count > 0))
|
|||
|
? ds.Tables[0]
|
|||
|
: new DataTable();
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return dtAppraisalRating;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region Get By Objective Set ID From Objective
|
|||
|
|
|||
|
public List<Objective> GetByObjectiveSetID(int iD)
|
|||
|
{
|
|||
|
List<Objective> oObjectives = null;
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(ObjectiveSetDA.GetByObjectiveSetID(tc, iD));
|
|||
|
oObjectives = this.CreateObjectives(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 oObjectives;
|
|||
|
}
|
|||
|
|
|||
|
public List<ObjectiveSet> GetByPMPYear(int nPMPYearID, string InEmpSQL)
|
|||
|
{
|
|||
|
List<ObjectiveSet> oObjectives = null;
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(ObjectiveSetDA.GetByPMPYear(tc, nPMPYearID, InEmpSQL));
|
|||
|
oObjectives = this.CreateObjects<ObjectiveSet>(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 oObjectives;
|
|||
|
}
|
|||
|
|
|||
|
public List<ObjectiveSet> GetByPMPYear(int nPMPYearID)
|
|||
|
{
|
|||
|
List<ObjectiveSet> oObjectives = null;
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(ObjectiveSetDA.GetByPMPYear(tc, nPMPYearID));
|
|||
|
oObjectives = this.CreateObjects<ObjectiveSet>(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 oObjectives;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Get By EmployeeID From Objective
|
|||
|
|
|||
|
public ObjectiveSet GetByEmployeeID(int EmpiD, int pmpYID)
|
|||
|
{
|
|||
|
ObjectiveSet oObjectives = null;
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(ObjectiveSetDA.GetByEmployeeID(tc, EmpiD, pmpYID));
|
|||
|
if (oreader.Read())
|
|||
|
{
|
|||
|
oObjectives = this.CreateObject<ObjectiveSet>(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 oObjectives;
|
|||
|
}
|
|||
|
|
|||
|
public ObjectiveSet GetSetByObjectiveID(int objectiveID)
|
|||
|
{
|
|||
|
ObjectiveSet oObjectives = null;
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(ObjectiveSetDA.GetByObjectiveID(tc, objectiveID));
|
|||
|
if (oreader.Read())
|
|||
|
{
|
|||
|
oObjectives = this.CreateObject<ObjectiveSet>(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 oObjectives;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
public ObjectiveSet GetObjectiveSetWithChild(int empId, int pmpId)
|
|||
|
{
|
|||
|
ObjectiveSet item = null;
|
|||
|
TransactionContext tc = null;
|
|||
|
ObjectiveService objectiveService = new ObjectiveService();
|
|||
|
ObjectiveSetRemarksService objectiveSetRemarksService = new ObjectiveSetRemarksService();
|
|||
|
YearEndValuesRatingService yearEndValuesRatingService = new YearEndValuesRatingService();
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(ObjectiveSetDA.GetByEmployeeID(tc, empId, pmpId));
|
|||
|
if (oreader.Read())
|
|||
|
{
|
|||
|
item = this.CreateObject<ObjectiveSet>(oreader);
|
|||
|
}
|
|||
|
oreader.Close();
|
|||
|
tc.End();
|
|||
|
if (item != null)
|
|||
|
{
|
|||
|
item.Objectives = objectiveService.GetByEmployeeID(empId, pmpId, false);
|
|||
|
item.ObjectiveSetRemarks = objectiveSetRemarksService.GetByObjectiveSetID(item.ID);
|
|||
|
item.YearEndValuesRatings = yearEndValuesRatingService.GetByObjectiveSetID(item.ID);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
item = new ObjectiveSet();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return item;
|
|||
|
}
|
|||
|
public List<ObjectiveSet> GetObjectiveSetByDepartment(int deptId, int pmpYearId)
|
|||
|
{
|
|||
|
List<ObjectiveSet> objectiveSets = null;
|
|||
|
TransactionContext tc = TransactionContext.Begin();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dataReader = new DataReader(ObjectiveSetDA.GetObjectiveSetByDepartment(tc, deptId, pmpYearId));
|
|||
|
objectiveSets = this.CreateObjects<ObjectiveSet>(dataReader);
|
|||
|
dataReader.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 objectiveSets;
|
|||
|
}
|
|||
|
|
|||
|
public ObjectiveSet GetByEmployeeID(TransactionContext tc, int EmpiD, int pmpYID)
|
|||
|
{
|
|||
|
ObjectiveSet oObjectives = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader oreader = new DataReader(ObjectiveSetDA.GetByEmployeeID(tc, EmpiD, pmpYID));
|
|||
|
if (oreader.Read())
|
|||
|
{
|
|||
|
oObjectives = this.CreateObject<ObjectiveSet>(oreader);
|
|||
|
}
|
|||
|
|
|||
|
oreader.Close();
|
|||
|
}
|
|||
|
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oObjectives;
|
|||
|
}
|
|||
|
|
|||
|
public List<ObjectiveSet> GetByEmployeeID(int EmpiD)
|
|||
|
{
|
|||
|
List<ObjectiveSet> oObjectives = null;
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(ObjectiveSetDA.GetByEmployeeID(tc, EmpiD));
|
|||
|
oObjectives = this.CreateObjects<ObjectiveSet>(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 oObjectives;
|
|||
|
}
|
|||
|
public List<ObjectiveSet> GetByEmpIds(int pmpYearId, string empIds)
|
|||
|
{
|
|||
|
List<ObjectiveSet> items = new List<ObjectiveSet>();
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(ObjectiveSetDA.GetByEmpIds(tc, pmpYearId, empIds));
|
|||
|
items = this.CreateObjects<ObjectiveSet>(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 items;
|
|||
|
}
|
|||
|
|
|||
|
public DataSet GetObjectiveRatingDataset(int id, string InEmpSQL)
|
|||
|
{
|
|||
|
DataSet dSet = null;
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
dSet = ObjectiveSetDA.GetObjectiveRatingDataset(tc, id, InEmpSQL);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return dSet;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Get Objective Set Remarks
|
|||
|
|
|||
|
public List<ObjectiveSetRemarks> GetObjectiveSetRemarks(int iD)
|
|||
|
{
|
|||
|
List<ObjectiveSetRemarks> oObjectiveSetRemarks = null;
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(ObjectiveSetDA.GetObjectiveSetRemarks(tc, iD));
|
|||
|
oObjectiveSetRemarks = this.CreateObjects<ObjectiveSetRemarks>(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 oObjectiveSetRemarks;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Get Year End Recomendations
|
|||
|
|
|||
|
public List<YearEndRecomendation> GetYearEndRecomendations(int iD)
|
|||
|
{
|
|||
|
List<YearEndRecomendation> oYearEndRecomendation = null;
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(ObjectiveSetDA.GetYearEndRecomendation(tc, iD));
|
|||
|
oYearEndRecomendation = this.CreateObjects<YearEndRecomendation>(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 oYearEndRecomendation;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region Insert
|
|||
|
|
|||
|
public int Save(ObjectiveSet item)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
if (item.IsNew)
|
|||
|
{
|
|||
|
int id = tc.GenerateID("ObjectiveSet", "ObjectiveSetID");
|
|||
|
base.SetObjectID(item, (id));
|
|||
|
ObjectiveSetDA.Save(tc, item);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ObjectiveSetDA.Update(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
tc.End();
|
|||
|
return item.ID;
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void SaveWithChild(ObjectiveSet item)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
if (item.IsNew)
|
|||
|
{
|
|||
|
int id = tc.GenerateID("ObjectiveSet", "ObjectiveSetID");
|
|||
|
base.SetObjectID(item, (id));
|
|||
|
ObjectiveSetDA.Save(tc, item);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ObjectiveSetDA.Update(tc, item);
|
|||
|
}
|
|||
|
if (item.ObjectiveSetRemarks.IsNew)
|
|||
|
{
|
|||
|
int id = tc.GenerateID("ObjectiveSetRemarks", "ObjectiveSetRemarksID");
|
|||
|
base.SetObjectID(item.ObjectiveSetRemarks, (id));
|
|||
|
item.ObjectiveSetRemarks.ObjectiveSetID = item.ID;
|
|||
|
ObjectiveSetRemarksDA.Save(tc, item.ObjectiveSetRemarks);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ObjectiveSetRemarksDA.Update(tc, item.ObjectiveSetRemarks);
|
|||
|
}
|
|||
|
|
|||
|
foreach (Objective itemObjective in item.Objectives)
|
|||
|
{
|
|||
|
if (itemObjective.IsNew)
|
|||
|
{
|
|||
|
int id = tc.GenerateID("ObjectiveSet", "ObjectiveSetID");
|
|||
|
base.SetObjectID(itemObjective, (id));
|
|||
|
ObjectiveDA.Insert(tc, itemObjective);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ObjectiveDA.Update(tc, itemObjective);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
foreach (YearEndValuesRating yearEndValuesRating in item.YearEndValuesRatings)
|
|||
|
{
|
|||
|
if (yearEndValuesRating.IsNew)
|
|||
|
{
|
|||
|
int id = tc.GenerateID("YearEndValuesRating", "YearEndValuesRatingID");
|
|||
|
base.SetObjectID(yearEndValuesRating, (id));
|
|||
|
YearEndValuesRatingDA.Save(tc, yearEndValuesRating);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
YearEndValuesRatingDA.Update(tc, yearEndValuesRating);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public void UpdateObjectivesetForReplace(ObjectiveSet sObjName)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
ObjectiveSetDA.UpdateObjectivesetForReplace(tc, sObjName);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void UpdateObjectivesetStatus(int objID, EnumPMSNotificationStatus status)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
ObjectiveSetDA.UpdateObjectivesetStatus(tc, objID, status);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void UpdateObjectiveForReplace(Objective sObjName)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
ObjectiveSetDA.UpdateObjectiveForReplace(tc, sObjName);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void UpdateObjectiveEmployeeForReplace(ObjectiveEmployees sObjName)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
ObjectiveSetDA.UpdateObjectiveEmployeeForReplace(tc, sObjName);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void UpdateOldObjectiveFlag(Objective sObj)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
ObjectiveSetDA.UpdateOldObjectiveFlag(tc, sObj);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Delete
|
|||
|
|
|||
|
public void Delete(int id)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
ObjectiveSetDA.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
|
|||
|
}
|
|||
|
}
|