using DocumentFormat.OpenXml.Office2010.Excel; using Ease.Core; using Ease.Core.DataAccess; using Ease.Core.Model; using Ease.Core.Utility; using HRM.BO; using HRM.BO.Configuration; using NPOI.SS.Formula.Functions; using Payroll.Service; using System; using System.Collections.Generic; using System.Data; 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.PayrollTypeID = oReader.GetInt32("PayrollTypeID").Value; oObjectiveSet.lmID = oReader.GetInt32("LMID", 0); oObjectiveSet.OverallValuesRating = oReader.GetDouble("OverallValuesRating", 0); oObjectiveSet.OBEmpComplete = (EnumObjectiveFlowStatus)oReader.GetInt32("OBEmpComplete",0); oObjectiveSet.obLmComplete = (EnumObjectiveFlowStatus)oReader.GetInt32("OBLMComplete", 0); oObjectiveSet.obSecondLmComplete = (EnumObjectiveFlowStatus)oReader.GetInt32("obSecondlmComplete", 0); oObjectiveSet.MYEmpComplete = (EnumObjectiveFlowStatus)oReader.GetInt32("MYEmpComplete", 0); oObjectiveSet.MYLMComplete = (EnumObjectiveFlowStatus)oReader.GetInt32("MYLMComplete", 0); oObjectiveSet.YEEmpComplete = (EnumObjectiveFlowStatus)oReader.GetInt32("YEEmpComplete", 0); oObjectiveSet.YELmComplete = (EnumObjectiveFlowStatus)oReader.GetInt32("YELMComplete", 0); oObjectiveSet.YESecondLMComplete = (EnumObjectiveFlowStatus)oReader.GetInt32("YESecondLMComplete", 0); oObjectiveSet.DevelopmentPlanSubmit = (EnumObjectiveFlowStatus)oReader.GetInt32("DevelopmentPlanSubmit",0); oObjectiveSet.LMDevelopmentPlanSubmit = (EnumObjectiveFlowStatus)oReader.GetInt32("LMDevelopmentPlanSubmit",0); oObjectiveSet.OverallEmpComments = oReader.GetString("OverallEmpComments"); oObjectiveSet.OverallLMComments = oReader.GetString("OverallLMComments"); oObjectiveSet.CareerExpectations = oReader.GetString("CareerExpectations"); oObjectiveSet.OverallSecondLMComments = oReader.GetString("OverallSecondLMComments"); oObjectiveSet.RevertComment = oReader.GetString("RevertComment"); oObjectiveSet.OBEmpCompleteDate = oReader.GetDateTime("OBEmpCompleteDate"); oObjectiveSet.obLmCompleteDate = oReader.GetDateTime("OBLMCompleteDate"); oObjectiveSet.obSecondLmCompleteDate = oReader.GetDateTime("obSecondlmCompleteDate"); oObjectiveSet.EMPObjRating = oReader.GetDouble("EMPOBJRating", 0); oObjectiveSet.EMPValueRating = oReader.GetDouble("EMPValueRating", 0); oObjectiveSet.EMPObjAchive = oReader.GetDouble("EMPOBJAchive", 0); oObjectiveSet.EMPValueAchive = oReader.GetDouble("EMPValueAchive", 0); oObjectiveSet.EMPRating = oReader.GetDouble("EMPRating", 0); oObjectiveSet.LMObjRating = oReader.GetDouble("LMOBJRATING", 0); oObjectiveSet.LMValueRating = oReader.GetDouble("LMVALUERATING", 0); oObjectiveSet.LMValueAchive = oReader.GetDouble("LMValueAchive", 0); oObjectiveSet.LMObjAchive = oReader.GetDouble("LMOBJAchive", 0); oObjectiveSet.LMRating = oReader.GetDouble("LMRating", 0); oObjectiveSet.OverallOBAchive = oReader.GetDouble("overallOBAchive", 0); oObjectiveSet.OverallOBRating = oReader.GetDouble("OverallOBRating", 0); oObjectiveSet.OverallPMPRating = oReader.GetDouble("OverallPMPRating", 0); 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 : 0; oObjectiveSet.SecondLMValueRating = oReader.GetDouble("SecondLMValueRating").HasValue ? oReader.GetDouble("SecondLMValueRating").Value : 0; oObjectiveSet.SecondLMOverallRating = oReader.GetDouble("SecondLMOverallRating").HasValue ? oReader.GetDouble("SecondLMOverallRating").Value : 0; oObjectiveSet.SecondLMAchive = oReader.GetDouble("SecondLMAchive").HasValue ? oReader.GetDouble("SecondLMAchive").Value : 0; oObjectiveSet.OverAllAchievement = oReader.GetDouble("OverAllAchievement").HasValue ? oReader.GetDouble("OverAllAchievement").Value : null; oObjectiveSet.OverAllRating = oReader.GetString("OverAllRating"); oObjectiveSet.ObjAssessRatingLM = oReader.GetInt32("ObjAssessRatingLM").HasValue ? (EnumAssessRating)oReader.GetInt32("ObjAssessRatingLM").Value : null; oObjectiveSet.LeadershipAssessRatingLM = oReader.GetInt32("LeadershipAssessRatingLM").HasValue ? (EnumAssessRating)oReader.GetInt32("LeadershipAssessRatingLM").Value : null; oObjectiveSet.AssessmentRemarksLM = oReader.GetString("AssessmentRemarksLM"); oObjectiveSet.AssessmentSubmitLM = oReader.GetBoolean("AssessmentSubmitLM", false); oObjectiveSet.ObjAssessRating2ndLM = oReader.GetInt32("ObjAssessRating2ndLM").HasValue ? (EnumAssessRating)oReader.GetInt32("ObjAssessRating2ndLM").Value : null; oObjectiveSet.LeadershipAssessRating2ndLM = oReader.GetInt32("LeadershipAssessRating2ndLM").HasValue ? (EnumAssessRating)oReader.GetInt32("LeadershipAssessRating2ndLM").Value : null; oObjectiveSet.AssessmentRemarks2ndLM = oReader.GetString("AssessmentRemarks2ndLM"); oObjectiveSet.AssessmentSubmit2ndLM = oReader.GetBoolean("AssessmentSubmit2ndLM", false); oObjectiveSet.ProgressStatus = oReader.GetDouble("ProgressStatus", 0); oObjectiveSet.IDPLMID = oReader.GetInt32("IDPLMID", true, 0); oObjectiveSet.IDPLMRDate = oReader.GetDateTime("IDPLMRDate").HasValue ? oReader.GetDateTime("IDPLMRDate").Value : (DateTime?)null; oObjectiveSet.IDPLMUserID = oReader.GetInt32("IDPLMUserID", true, 0); oObjectiveSet.IDPLMStatus = oReader.GetInt32("IDPLMStatus").HasValue ? (enumIDPStatus)oReader.GetInt32("IDPLMStatus").Value : (enumIDPStatus?)null; oObjectiveSet.IDPSecondLMID = oReader.GetInt32("IDPSecondLMID", true, 0); oObjectiveSet.IDPSecondLMRDate = oReader.GetDateTime("IDPSecondLMRDate").HasValue ? oReader.GetDateTime("IDPSecondLMRDate").Value : (DateTime?)null; oObjectiveSet.IDPSecondLMStatus = oReader.GetInt32("IDPSecondLMStatus").HasValue ? (enumIDPStatus)oReader.GetInt32("IDPSecondLMStatus").Value : (enumIDPStatus?)null; oObjectiveSet.ObjectiveUpdateStatus = oReader.GetInt32("ObjectiveUpdateStatus").HasValue ? (EnumObjectiveFlowStatus)oReader.GetInt32("ObjectiveUpdateStatus").Value : null; oObjectiveSet.IDPLMRemarks = oReader.GetString("IDPLMRemarks"); oObjectiveSet.CreatedBy = oReader.GetInt32("CreatedBy", 0); oObjectiveSet.CreatedDate = oReader.GetDateTime("CreatedDate", DateTime.MinValue); this.SetObjectState(oObjectiveSet, ObjectState.Saved); } protected override T CreateObject(DataReader oReader) { ObjectiveSet oObjectiveSet = new ObjectiveSet(); MapObject(oObjectiveSet, oReader); return oObjectiveSet as T; } private List CreateObjectives(DataReader oReader) { List oObjectives = new List(); 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.PayrollTypeID = oReader.GetInt32("PayrollTypeID", 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.KPIType = (EnumObjectiveType)oReader.GetInt32("KPIType").Value; oObjective.YEEmployeeComments = oReader.GetString("YEEmployeeComments"); oObjective.YELMComments = oReader.GetString("YELMComments"); oObjective.PriorityPercent = oReader.GetDouble("PriorityPercent").Value; oObjective.ProgressStatus = oReader.GetDouble("ProgressStatus", 0); this.SetObjectState(oObjective, ObjectState.Saved); } private void MapObject(ObjectiveAttachment item, DataReader oReader) { SetObjectID(item, oReader.GetInt32("AttachmentID", 0)); item.ObjectiveID = oReader.GetInt32("ObjectiveID", 0); item.FileName = oReader.GetString("FileName"); item.UploadDate = oReader.GetDateTime("UploadDate").HasValue ? oReader.GetDateTime("UploadDate").Value : DateTime.MinValue; item.PMSStage = (EnumPMSStage)oReader.GetInt32("PMSStage").GetValueOrDefault(); } // Note: GetObjectiveAttachments(TransactionContext, int) below only ever selects attachments // already joined to a real Objective row, so ObjectiveHistoryID is always NULL for these // results - not mapped here for that reason (see ObjectiveDA.GetObjectiveAttachmentsByHistoryID // / ObjectiveService.GetObjectiveAttachmentsByHistoryID for the pending/staged counterpart). public List GetObjectiveAttachments(TransactionContext tc, int objectiveSetid) { List list = new List(); try { DataReader dr = new DataReader(ObjectiveSetDA.GetObjectiveAttachments(tc, objectiveSetid)); while (dr.Read()) { ObjectiveAttachment item = new ObjectiveAttachment(); MapObject(item, dr); list.Add(item); } dr.Close(); } catch (Exception e) { if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); } return list; } #endregion #region IObjectiveSetService Members #region Get All public List Get() { List oObjectiveSet = null; TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(ObjectiveSetDA.Get(tc)); oObjectiveSet = this.CreateObjects(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(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 GetByObjectiveSetID(int iD) { List 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 GetByPMPYear(int nPMPYearID, string InEmpSQL) { List oObjectives = null; TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(ObjectiveSetDA.GetByPMPYear(tc, nPMPYearID, InEmpSQL)); oObjectives = this.CreateObjects(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 GetByPMPYear(int nPMPYearID) { List oObjectives = null; TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(ObjectiveSetDA.GetByPMPYear(tc, nPMPYearID)); oObjectives = this.CreateObjects(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 GetByPMPYear(int nPMPYearID, int nPayrollTypeID) { List oObjectives = null; TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(ObjectiveSetDA.GetByPMPYear(tc, nPMPYearID, nPayrollTypeID)); oObjectives = this.CreateObjects(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; ObjectiveSetRemarksService objectiveSetRemarksService = new ObjectiveSetRemarksService(); TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(ObjectiveSetDA.GetByEmployeeID(tc, EmpiD, pmpYID)); if (oreader.Read()) { oObjectives = this.CreateObject(oreader); } oreader.Close(); if (oObjectives != null) { oObjectives.ObjectiveSetRemarks = objectiveSetRemarksService.GetByObjectiveSetID(oObjectives.ID); } } 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(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, bool withMessage) { ObjectiveSet item = null; TransactionContext tc = null; ObjectiveService objectiveService = new ObjectiveService(); ObjectiveSetRemarksService objectiveSetRemarksService = new ObjectiveSetRemarksService(); PMPValueBehaviorSettingService yearEndValuesRatingService = new PMPValueBehaviorSettingService(); PMSObjectiveProgressService pmsObjectiveProgressService = new PMSObjectiveProgressService(); try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(ObjectiveSetDA.GetByEmployeeID(tc, empId, pmpId)); if (oreader.Read()) { item = this.CreateObject(oreader); } oreader.Close(); tc.End(); if (item != null) { item.Objectives = objectiveService.GetByEmployeeID(empId, pmpId, false); item.ObjectiveSetRemarks = objectiveSetRemarksService.GetByObjectiveSetID(item.ID); item.ValuesRatings = yearEndValuesRatingService.GetByObjectiveSetID(item.ID); #region Unread Message For Objective if (withMessage) { List objectiveIDsInt = new List(); item.Objectives.ForEach(o => objectiveIDsInt.Add(o.ID)); string objectiveIDs = String.Join(",", objectiveIDsInt); if(objectiveIDs != string.Empty) { List unreadEmployeeMessage = pmsObjectiveProgressService.GetUnreadMessage(objectiveIDs); item.Objectives.ForEach(o => { o.UnreadEmployeeMessage = unreadEmployeeMessage.FindAll(uem => uem.ObjectiveID == o.ID && uem.IsEmployee); o.UnreadLMMessage = unreadEmployeeMessage.FindAll(uem => uem.ObjectiveID == o.ID && !uem.IsEmployee); }); } } #endregion } else { //item = new ObjectiveSet(); item = null; } } 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 GetObjectiveSetByDepartment(int deptId, int pmpYearId) { List objectiveSets = null; TransactionContext tc = TransactionContext.Begin(); try { DataReader dataReader = new DataReader(ObjectiveSetDA.GetObjectiveSetByDepartment(tc, deptId, pmpYearId)); objectiveSets = this.CreateObjects(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(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 GetByEmployeeID(int EmpiD) { List oObjectives = null; TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(ObjectiveSetDA.GetByEmployeeID(tc, EmpiD)); oObjectives = this.CreateObjects(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 GetByEmpIds(int pmpYearId, string empIds) { List items = new List(); TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(ObjectiveSetDA.GetByEmpIds(tc, pmpYearId, empIds)); items = this.CreateObjects(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 GetObjectiveSetRemarks(int iD) { List oObjectiveSetRemarks = null; TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(ObjectiveSetDA.GetObjectiveSetRemarks(tc, iD)); oObjectiveSetRemarks = this.CreateObjects(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 GetYearEndRecomendations(int iD) { List oYearEndRecomendation = null; TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(ObjectiveSetDA.GetYearEndRecomendation(tc, iD)); oYearEndRecomendation = this.CreateObjects(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 void EndEditModeOfObjective(ObjectiveSet item) { TransactionContext tc = null; try { tc = TransactionContext.Begin(true); ObjectiveSetDA.EndEditModeOfObjective(tc, item); tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } #region Objective Settings Submission/Approval public void SubmitObjectivetoLineManager(ObjectiveSet item, int userID) { TransactionContext tc = null; try { item.OBEmpComplete = EnumObjectiveFlowStatus.Submit; item.OBEmpCompleteDate = DateTime.Today; tc = TransactionContext.Begin(true); ObjectiveSetDA.SubmitObjectivetoLineManager(tc, item); #region Notification var notification = new EmployeeNotification { EmployeeID = item.EmployeeID, Header = "KPI Submitted Successfully", Description = $"Your KPI objectives have been submitted to your N + 1 Manager and are awaiting review.", Link = "", CreatedDate = DateTime.Now, CreatedBy = userID, ReferenceID = item.ID, IsRead = 0, ReadDate = null, ReadBy = null }; new EmployeeNotificationService().Insert(tc, notification); #endregion 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 ApproveObjectiveByLineManager(ObjectiveSet item, int userID) { TransactionContext tc = null; try { item.obLmComplete = EnumObjectiveFlowStatus.Agreed; item.obLmCompleteDate = DateTime.Today; tc = TransactionContext.Begin(true); ObjectiveSetDA.ApproveObjectiveByLineManager(tc, item); if (item.Objectives != null) { foreach (Objective objective in item.Objectives) { ObjectiveDA.UpdateObjectiveSettingRemarksLM(tc, objective); } } 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.UpdateObjectiveLmRemarks(tc, item.ID, item.ObjectiveSetRemarks.obLmRemarks); #region Notification var notification = new EmployeeNotification { EmployeeID = item.EmployeeID, Header = "KPI Approved by N + 1 Manager", Description = $"Your KPI objectives have been reviewed and approved by your N + 1 Manager.", Link = "", CreatedDate = DateTime.Now, CreatedBy = userID, ReferenceID = item.ID, IsRead = 0, ReadDate = null, ReadBy = null }; new EmployeeNotificationService().Insert(tc, notification); #endregion 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 RevertObjectiveByLineManager(ObjectiveSet item, int userID) { TransactionContext tc = null; try { item.OBEmpComplete = EnumObjectiveFlowStatus.Not_yet_Agreed; item.obLmComplete = EnumObjectiveFlowStatus.Revert; item.obLmCompleteDate = DateTime.Today; tc = TransactionContext.Begin(true); ObjectiveSetDA.RevertObjectiveByLineManager(tc, item); if (item.Objectives != null) { foreach (Objective objective in item.Objectives) { ObjectiveDA.UpdateObjectiveSettingRemarksLM(tc, objective); } } 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.UpdateObjectiveLmRevertRemarks(tc, item.ID, item.ObjectiveSetRemarks.obLmRevertRemarks); #region Notification var notification = new EmployeeNotification { EmployeeID = item.EmployeeID, Header = "Return for Revision", Description = $"Your KPI objectives have been reverted by your N + 1 Manager. ", Link = "", CreatedDate = DateTime.Now, CreatedBy = userID, ReferenceID = item.ID, IsRead = 0, ReadDate = null, ReadBy = null }; new EmployeeNotificationService().Insert(tc, notification); #endregion 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 RevertObjectiveBySecondLineManager(ObjectiveSet item, int userID) { TransactionContext tc = null; try { item.OBEmpComplete = EnumObjectiveFlowStatus.Not_yet_Agreed; item.obLmComplete = EnumObjectiveFlowStatus.Revert; //item.obLmCompleteDate = DateTime.Today; item.obSecondLmComplete = EnumObjectiveFlowStatus.Revert; item.obSecondLmCompleteDate = DateTime.Today; tc = TransactionContext.Begin(true); ObjectiveSetDA.RevertObjectiveBySecondLineManager(tc, item); if (item.Objectives != null) { foreach (Objective objective in item.Objectives) { ObjectiveDA.UpdateObjectiveSettingRemarksLM2(tc, objective); } } 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.UpdateObjectiveSecondLmRevertRemarks(tc, item.ID, item.ObjectiveSetRemarks.obSecondLmRevertRemarks); #region Notification var notification = new EmployeeNotification { EmployeeID = item.EmployeeID, Header = "Return for Revision", Description = $"Your KPI objectives have been reverted by your N + 2 Manager. ", Link = "", CreatedDate = DateTime.Now, CreatedBy = userID, ReferenceID = item.ID, IsRead = 0, ReadDate = null, ReadBy = null }; new EmployeeNotificationService().Insert(tc, notification); #endregion 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 ApproveObjectiveBySecondLineManager(ObjectiveSet item, int userID) { TransactionContext tc = null; try { item.obSecondLmComplete = EnumObjectiveFlowStatus.Agreed; item.obLmCompleteDate = DateTime.Today; tc = TransactionContext.Begin(true); ObjectiveSetDA.ApproveObjectiveBySecondLineManager(tc, item); if (item.Objectives != null) { foreach (Objective objective in item.Objectives) { ObjectiveDA.UpdateObjectiveSettingRemarksLM2(tc, objective); } } 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.UpdateObjectiveSecondLmRemarks(tc, item.ID, item.ObjectiveSetRemarks.obSecondLmRemarks); #region Notification var notification = new EmployeeNotification { EmployeeID = item.EmployeeID, Header = "Approved by N + 2 Manager", Description = $"Your KPI objectives have been reviewed and approved by your N + 2 Manager.", Link = "", CreatedDate = DateTime.Now, CreatedBy = userID, ReferenceID = item.ID, IsRead = 0, ReadDate = null, ReadBy = null }; new EmployeeNotificationService().Insert(tc, notification); #endregion tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } #endregion Objective Settings Submission/Approval #region Mid Year Submission/Approval public void SubmitMidYearReviewtoLineManager(ObjectiveSet item, int userID) { TransactionContext tc = null; try { //item.MYEmpComplete = EnumObjectiveFlowStatus.Submit; item.MYEmpCompleteDate = DateTime.Today; tc = TransactionContext.Begin(true); ObjectiveSetDA.SubmitMidYearReviewtoLineManager(tc, item); foreach (Objective itemObjective in item.Objectives) { ObjectiveDA.UpdateMyEmp(tc, itemObjective); } 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); if(item.MYEmpComplete == EnumObjectiveFlowStatus.Submit) { #region Notification var notification = new EmployeeNotification { EmployeeID = item.EmployeeID, Header = "Mid-year assessment Submitted", Description = $"Your mid-year assessment have been submitted to your N + 1 Manager and are awaiting review.", Link = "", CreatedDate = DateTime.Now, CreatedBy = userID, ReferenceID = item.ID, IsRead = 0, ReadDate = null, ReadBy = null }; new EmployeeNotificationService().Insert(tc, notification); #endregion } 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 ApproveMidYearReviewByLineManager(ObjectiveSet item, int userID) { TransactionContext tc = null; try { tc = TransactionContext.Begin(true); ObjectiveSetDA.ApproveMidYearReviewByLineManager(tc, item); foreach (Objective itemObjective in item.Objectives) { ObjectiveDA.UpdateMyLM(tc, itemObjective); } 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.UpdateMidYearLMReviewOne(tc, item.ID, item.ObjectiveSetRemarks.MidYearLMReviewOne); if (item.MYLMComplete == EnumObjectiveFlowStatus.Agreed) { #region Notification var notification = new EmployeeNotification { EmployeeID = item.EmployeeID, Header = "Mid-year Approved by N + 1 Manager", Description = $"Your mid-year assessment have been reviewed and approved by your N + 1 Manager.", Link = "", CreatedDate = DateTime.Now, CreatedBy = userID, ReferenceID = item.ID, IsRead = 0, ReadDate = null, ReadBy = null }; new EmployeeNotificationService().Insert(tc, notification); #endregion } 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 RevertMidYearReviewByLineManager(ObjectiveSet item, int userID) { TransactionContext tc = null; try { tc = TransactionContext.Begin(true); ObjectiveSetDA.RevertMidYearReviewByLineManager(tc, item); if (item.Objectives != null) { foreach (Objective itemObjective in item.Objectives) { ObjectiveDA.UpdateMyLM(tc, itemObjective); } } 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.UpdateMidYearLMReviewOne(tc, item.ID, item.ObjectiveSetRemarks.MidYearLMReviewOne); #region Notification var notification = new EmployeeNotification { EmployeeID = item.EmployeeID, Header = "Return for Revision", Description = $"Your Mid-Year assessment has been reverted by your N + 1 Manager.", Link = "", CreatedDate = DateTime.Now, CreatedBy = userID, ReferenceID = item.ID, IsRead = 0, ReadDate = null, ReadBy = null }; new EmployeeNotificationService().Insert(tc, notification); #endregion tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } #endregion Mid Year Submission/Approval #region Year End Submission/Approval public void SubmitYearEndReviewtoLineManager(ObjectiveSet item, int userID) { TransactionContext tc = null; try { tc = TransactionContext.Begin(true); ObjectiveSetDA.SubmitYearEndReviewtoLineManager(tc, item); foreach (Objective itemObjective in item.Objectives) { ObjectiveDA.UpdateYeEmp(tc, itemObjective); } 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.UpdateYearEndEmpReviewOne(tc, item.ID, item.ObjectiveSetRemarks.YearEndEmpReviewOne, item.ObjectiveSetRemarks.UnplannedAchievementEmp); PMPValueBehaviorSettingDA.DeleteByObjectiveSetID(tc, item.ID); foreach (PMPValueBehaviorSetting yearEndValuesRating in item.ValuesRatings) { yearEndValuesRating.ObjectiveSetID = item.ID; int id = tc.GenerateID("PMP_ValueBehaviorSetting", "PMPVALUEBEHAVIORSETTINGID"); base.SetObjectID(yearEndValuesRating, (id)); PMPValueBehaviorSettingDA.Insert(tc, yearEndValuesRating); } if (item.YEEmpComplete == EnumObjectiveFlowStatus.Submit) { #region Notification var notification = new EmployeeNotification { EmployeeID = item.EmployeeID, Header = "Year-end assessment Submitted", Description = $"Your year-end assessment have been submitted to your N + 1 Manager and are awaiting review.", Link = "", CreatedDate = DateTime.Now, CreatedBy = userID, ReferenceID = item.ID, IsRead = 0, ReadDate = null, ReadBy = null }; new EmployeeNotificationService().Insert(tc, notification); #endregion } 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 YearEndReviewByLineManager(ObjectiveSet item, int userID) { TransactionContext tc = null; try { tc = TransactionContext.Begin(true); ObjectiveSetDA.YearEndReviewByLineManager(tc, item); foreach (Objective itemObjective in item.Objectives) { ObjectiveDA.UpdateYeLM(tc, itemObjective); } 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.UpdateYearEndLMReviewOne(tc, item.ID, item.ObjectiveSetRemarks.YearEndLMReviewOne, item.ObjectiveSetRemarks.UnplannedAchievementLM); } PMPValueBehaviorSettingDA.DeleteByObjectiveSetID(tc, item.ID); foreach (PMPValueBehaviorSetting yearEndValuesRating in item.ValuesRatings) { yearEndValuesRating.ObjectiveSetID = item.ID; int id = tc.GenerateID("PMP_ValueBehaviorSetting", "PMPVALUEBEHAVIORSETTINGID"); base.SetObjectID(yearEndValuesRating, (id)); PMPValueBehaviorSettingDA.Insert(tc, yearEndValuesRating); } if (item.YELmComplete == EnumObjectiveFlowStatus.Agreed) { #region Notification var notification = new EmployeeNotification { EmployeeID = item.EmployeeID, Header = "Year-end assessment Approved by N + 1 Manager", Description = $"Your year-end assessment have been reviewed and approved by your N + 1 Manager.", Link = "", CreatedDate = DateTime.Now, CreatedBy = userID, ReferenceID = item.ID, IsRead = 0, ReadDate = null, ReadBy = null }; new EmployeeNotificationService().Insert(tc, notification); #endregion } 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 SubmitSecondLMassessment(ObjectiveSet item, int userID) { TransactionContext tc = null; try { tc = TransactionContext.Begin(true); ObjectiveSetDA.SubmitSecondLMassessment(tc, item); if (item.ObjectiveSetRemarks.IsNew) { int id = tc.GenerateID("ObjectiveSetRemarks", "ObjectiveSetRemarksID"); base.SetObjectID(item.ObjectiveSetRemarks, (id)); ObjectiveSetRemarksDA.Save(tc, item.ObjectiveSetRemarks); } else { ObjectiveSetRemarksDA.Update(tc, item.ObjectiveSetRemarks); ObjectiveSetRemarksDA.UpdateYearEndSecondLMReviewOne(tc, item.ID, item.ObjectiveSetRemarks.YearEndSecondLMReviewOne); } foreach (Objective itemObjective in item.Objectives) { ObjectiveDA.UpdateSecondLM(tc, itemObjective); } if (item.YESecondLMComplete == EnumObjectiveFlowStatus.Agreed) { #region Notification var notification = new EmployeeNotification { EmployeeID = item.EmployeeID, Header = "Year-end assessment Approved by N + 2 Manager", Description = $"Your year-end assessment have been reviewed and approved by your N + 2 Manager.", Link = "", CreatedDate = DateTime.Now, CreatedBy = userID, ReferenceID = item.ID, IsRead = 0, ReadDate = null, ReadBy = null }; new EmployeeNotificationService().Insert(tc, notification); #endregion } tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } #endregion Year End Submission/Approval 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("Objective", "ObjectiveID"); base.SetObjectID(itemObjective, (id)); itemObjective.ObjectiveSetID = item.ID; ObjectiveDA.Insert(tc, itemObjective); } else { ObjectiveDA.Update(tc, itemObjective); } } foreach (PMPValueBehaviorSetting yearEndValuesRating in item.ValuesRatings) { if (yearEndValuesRating.IsNew) { int id = tc.GenerateID("YearEndValuesRating", "YearEndValuesRatingID"); base.SetObjectID(yearEndValuesRating, (id)); PMPValueBehaviorSettingDA.Insert(tc, yearEndValuesRating); } else { PMPValueBehaviorSettingDA.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 int Save(TransactionContext tc, ObjectiveSet item) { try { if (item.IsNew) { int id = tc.GenerateID("ObjectiveSet", "ObjectiveSetID"); base.SetObjectID(item, (id)); ObjectiveSetDA.Save(tc, item); } else { ObjectiveSetDA.Update(tc, item); } 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 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 public DataTable GetByLineManagerID(int pmpYear, bool isFirstLM, int LineManagerID) { TransactionContext tc = null; DataTable dt = new DataTable(); try { tc = TransactionContext.Begin(true); dt = ObjectiveSetDA.GetByLineManagerID(tc,pmpYear,isFirstLM, LineManagerID); tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } return dt; } public DataTable GetByLoggedInEmployee(int pmpYear, bool isEmployee, int employeeid) { TransactionContext tc = null; DataTable dt = new DataTable(); try { tc = TransactionContext.Begin(true); dt = ObjectiveSetDA.GetByLoggedInEmployee(tc, pmpYear, isEmployee, employeeid); tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } return dt; } public DataTable GetObjectivesetByPMPyears(string pmpYearIDs, int payrolltypeID) { TransactionContext tc = null; DataTable objectiveSets = null; try { tc = TransactionContext.Begin(); objectiveSets = ObjectiveSetDA.GetObjectivesetByPMPyears(tc, pmpYearIDs, payrolltypeID); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } return objectiveSets; } public List GetByPMPYearForLeadership(int nPMPYearID, bool? isCompleted) { List oObjectives = null; TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(ObjectiveSetDA.GetByPMPYearForLeadership(tc, nPMPYearID, isCompleted)); oObjectives = this.CreateObjects(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 void UpdateIDPLMIDRemarksAndStatus(TransactionContext tc, ObjectiveSet oObjectiveSet) { try { ObjectiveSetDA.UpdateIDPLMIDRemarksAndStatus(tc, oObjectiveSet); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } public void UpdateEmployeeStatusAndDate(TransactionContext tc, ObjectiveSet oObjectiveSet) { try { ObjectiveSetDA.UpdateEmployeeStatusAndDate(tc, oObjectiveSet); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } internal void UpdateIDPSecondLMIDRemarksAndStatus(TransactionContext tc, object oObjectiveSet) { throw new NotImplementedException(); } public void SubmitDevelopmentPlan(int objectiveSetID, bool isEmployee, enumIDPStatus status, string CareerExpectations) { TransactionContext tc = null; try { tc = TransactionContext.Begin(); ObjectiveSetDA.SubmitDevelopmentPlan(tc, objectiveSetID, isEmployee, status, CareerExpectations); 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 approveDevelopmentPlan(int objectiveSetID, int currentUserID) { TransactionContext tc = null; try { tc = TransactionContext.Begin(); ObjectiveSetDA.approveDevelopmentPlan(tc, objectiveSetID, currentUserID); 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 rejectDevelopmentPlan(int objectiveSetID, int currentUserID) { TransactionContext tc = null; try { tc = TransactionContext.Begin(); ObjectiveSetDA.rejectDevelopmentPlan(tc, objectiveSetID, currentUserID); tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } public DataTable GetSearchIDPDashboard(int? pmpYearID, int? lmid, int? secondLmid, bool? isCompleted, bool? isNotYetCompleted, string type) { DataTable dt = new DataTable(); TransactionContext tc = null; try { tc = TransactionContext.Begin(); dt = ObjectiveSetDA.GetSearchIDPDashboard(tc, pmpYearID, lmid, secondLmid, isCompleted, isNotYetCompleted, type); tc.End(); } catch (Exception e) { if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); } return dt; } public void UpdateLineManagerRemarks(int objectivesetid, string remarks) { TransactionContext tc = null; try { tc = TransactionContext.Begin(); ObjectiveSetDA.UpdateLineManagerRemarks(tc, objectivesetid, remarks); tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } #endregion } }