1064 lines
36 KiB
C#
1064 lines
36 KiB
C#
|
|
using System;
|
|||
|
|
using Ease.Core.Model;
|
|||
|
|
using Ease.Core.DataAccess;
|
|||
|
|
using Ease.Core.Utility;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using HRM.BO;
|
|||
|
|
using System.Data;
|
|||
|
|
using Ease.Core;
|
|||
|
|
using System.Linq;
|
|||
|
|
|
|||
|
|
namespace HRM.DA
|
|||
|
|
{
|
|||
|
|
#region TrainingNeedAnalysis Service
|
|||
|
|
|
|||
|
|
public class TrainingNeedAnalysisService : ServiceTemplate, ITrainingNeedAnalysisService
|
|||
|
|
{
|
|||
|
|
#region Private functions and declaration
|
|||
|
|
|
|||
|
|
#region TrainingNeedAnalysis Mapping
|
|||
|
|
|
|||
|
|
private void MapObject(TrainingNeedAnalysis oTrainingNeedAnalysis, DataReader oReader)
|
|||
|
|
{
|
|||
|
|
base.SetObjectID(oTrainingNeedAnalysis, oReader.GetInt32("TrainingNeedAnalysisID").Value);
|
|||
|
|
oTrainingNeedAnalysis.TrainingYear = oReader.GetInt32("TrainingYear").Value;
|
|||
|
|
oTrainingNeedAnalysis.Name = oReader.GetString("Name");
|
|||
|
|
oTrainingNeedAnalysis.EmployeeID = oReader.GetInt32("EmployeeID").GetValueOrDefault();
|
|||
|
|
oTrainingNeedAnalysis.DepartmentID = oReader.GetInt32("DepartmentID").GetValueOrDefault();
|
|||
|
|
oTrainingNeedAnalysis.TrainingID = oReader.GetInt32("TrainingID").Value;
|
|||
|
|
oTrainingNeedAnalysis.Description = oReader.GetString("Description");
|
|||
|
|
oTrainingNeedAnalysis.MaxParticipent = oReader.GetInt32("MaxParticipent").GetValueOrDefault();
|
|||
|
|
oTrainingNeedAnalysis.Conduct_Required = oReader.GetInt32("Conduct_Required").Value;
|
|||
|
|
|
|||
|
|
oTrainingNeedAnalysis.CreatedBy =
|
|||
|
|
oReader.GetString("CreatedBy") == null ? 0 : oReader.GetInt32("CreatedBy").Value;
|
|||
|
|
oTrainingNeedAnalysis.CreatedDate = oReader.GetDateTime("CreatedDate").Value;
|
|||
|
|
oTrainingNeedAnalysis.ModifiedBy =
|
|||
|
|
oReader.GetString("ModifiedBy") == null ? 0 : oReader.GetInt32("ModifiedBy").Value;
|
|||
|
|
oTrainingNeedAnalysis.ModifiedDate = oReader.GetDateTime("ModifiedDate");
|
|||
|
|
|
|||
|
|
oTrainingNeedAnalysis.NeedType = oReader.GetInt32("NeedType").HasValue
|
|||
|
|
? (EnumNeedType)oReader.GetInt32("NeedType").Value
|
|||
|
|
: (EnumNeedType?)null;
|
|||
|
|
|
|||
|
|
oTrainingNeedAnalysis.ExpectedDate = oReader.GetString("ExpectedDate");
|
|||
|
|
|
|||
|
|
oTrainingNeedAnalysis.ExpectedResults = oReader.GetString("ExpectedResults");
|
|||
|
|
|
|||
|
|
oTrainingNeedAnalysis.ObjectiveSetID = oReader.GetInt32("ObjectiveSetID").GetValueOrDefault();
|
|||
|
|
|
|||
|
|
this.SetObjectState(oTrainingNeedAnalysis, Ease.Core.ObjectState.Saved);
|
|||
|
|
}
|
|||
|
|
protected override T CreateObject<T>(DataReader oReader)
|
|||
|
|
{
|
|||
|
|
TrainingNeedAnalysis oTrainingNeedAnalysis = new TrainingNeedAnalysis();
|
|||
|
|
MapObject(oTrainingNeedAnalysis, oReader);
|
|||
|
|
return oTrainingNeedAnalysis as T;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Subordinate Mapping
|
|||
|
|
|
|||
|
|
private void MapSubordinateTraineeObject(SubordinateTrainee oSubordinateTrainee, DataReader oReader)
|
|||
|
|
{
|
|||
|
|
base.SetObjectID(oSubordinateTrainee, oReader.GetInt32("SubordinateTraineeID").Value);
|
|||
|
|
oSubordinateTrainee.TrainingNeedAnalysisID = oReader.GetInt32("TrainingNeedAnalysisID").Value;
|
|||
|
|
oSubordinateTrainee.EmployeeID = oReader.GetInt32("EmployeeID").Value;
|
|||
|
|
oSubordinateTrainee.Remarks = oReader.GetString("Remarks");
|
|||
|
|
|
|||
|
|
//oSubordinateTrainee.CreatedBy = oReader.GetString("CreatedBy") == null ? null : oReader.GetInt32("CreatedBy").Value);
|
|||
|
|
//oSubordinateTrainee.CreatedDate = oReader.GetDateTime("CreatedDate").HasValue ? oReader.GetDateTime("CreatedDate").Value : DateTime.Today;
|
|||
|
|
//oSubordinateTrainee.ModifiedBy = oReader.GetString("ModifiedBy") == null ? null : oReader.GetInt32("ModifiedBy").Value);
|
|||
|
|
//oSubordinateTrainee.ModifiedDate = oReader.GetDateTime("ModifiedDate");
|
|||
|
|
this.SetObjectState(oSubordinateTrainee, Ease.Core.ObjectState.Saved);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//protected override T CreateObject<T>(DataReader oReader)
|
|||
|
|
//{
|
|||
|
|
// SubordinateTrainee oSubordinateTrainee = new SubordinateTrainee();
|
|||
|
|
// MapSubordinateTraineeObject(oSubordinateTrainee, oReader);
|
|||
|
|
// return oSubordinateTrainee as T;
|
|||
|
|
//}
|
|||
|
|
private SubordinateTrainee CreateSubordinateTraineeObject(DataReader oReader)
|
|||
|
|
{
|
|||
|
|
SubordinateTrainee oSubordinateTrainee = new SubordinateTrainee();
|
|||
|
|
MapSubordinateTraineeObject(oSubordinateTrainee, oReader);
|
|||
|
|
return oSubordinateTrainee;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected List<SubordinateTrainee> CreateSubordinateTraineeObjects(DataReader oReader)
|
|||
|
|
{
|
|||
|
|
List<SubordinateTrainee> oSubordinateTrainee = new List<SubordinateTrainee>();
|
|||
|
|
while (oReader.Read())
|
|||
|
|
{
|
|||
|
|
SubordinateTrainee item = CreateSubordinateTraineeObject(oReader);
|
|||
|
|
oSubordinateTrainee.Add(item);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return oSubordinateTrainee;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Implementation of ITrainingNeedAnalysisService
|
|||
|
|
|
|||
|
|
#region Get TrainingNeedAnalysis
|
|||
|
|
|
|||
|
|
public TrainingNeedAnalysis Get(int TrainingNeedAnalysisID)
|
|||
|
|
{
|
|||
|
|
TrainingNeedAnalysis oTrainingNeedAnalysis = null;
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Retrieving data
|
|||
|
|
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
|
|||
|
|
DataReader oreader = new DataReader(TrainingNeedAnalysisDA.Get(tc, TrainingNeedAnalysisID));
|
|||
|
|
|
|||
|
|
if (oreader.Read())
|
|||
|
|
{
|
|||
|
|
oTrainingNeedAnalysis = CreateObject<TrainingNeedAnalysis>(oreader);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return oTrainingNeedAnalysis;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region GetByEmployeeID
|
|||
|
|
|
|||
|
|
public TrainingNeedAnalysis GetByEmployeeID(string employeeNo)
|
|||
|
|
{
|
|||
|
|
TrainingNeedAnalysis oTrainingNeedAnalysis = null;
|
|||
|
|
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Retrieving data
|
|||
|
|
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
|
|||
|
|
DataReader oreader = new DataReader(TrainingNeedAnalysisDA.GetByEmployeeID(tc, employeeNo));
|
|||
|
|
|
|||
|
|
if (oreader.Read())
|
|||
|
|
{
|
|||
|
|
oTrainingNeedAnalysis = CreateObject<TrainingNeedAnalysis>(oreader);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return oTrainingNeedAnalysis;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Get TrainingNeedAnalysiss
|
|||
|
|
|
|||
|
|
public List<TrainingNeedAnalysis> Get()
|
|||
|
|
{
|
|||
|
|
List<TrainingNeedAnalysis> oTrainingNeedAnalysiss;
|
|||
|
|
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Retrieving data
|
|||
|
|
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
|
|||
|
|
DataReader oreader = new DataReader(TrainingNeedAnalysisDA.Get(tc));
|
|||
|
|
oTrainingNeedAnalysiss = CreateObjects<TrainingNeedAnalysis>(oreader);
|
|||
|
|
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return oTrainingNeedAnalysiss;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public List<TrainingNeedAnalysis> GetByYear(int year)
|
|||
|
|
{
|
|||
|
|
List<TrainingNeedAnalysis> oTrainingNeedAnalysiss;
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Retrieving data
|
|||
|
|
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
|
|||
|
|
DataReader oreader = new DataReader(TrainingNeedAnalysisDA.GetByYear(tc, year));
|
|||
|
|
oTrainingNeedAnalysiss = CreateObjects<TrainingNeedAnalysis>(oreader);
|
|||
|
|
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return oTrainingNeedAnalysiss;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public List<TrainingNeedAnalysis> GetByParam(int year, string sDeptIDs, string sDeptForIDs)
|
|||
|
|
{
|
|||
|
|
List<TrainingNeedAnalysis> oTrainingNeedAnalysiss;
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Retrieving data
|
|||
|
|
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
|
|||
|
|
DataReader oreader = new DataReader(TrainingNeedAnalysisDA.GetByParam(tc, year, sDeptIDs, sDeptForIDs));
|
|||
|
|
oTrainingNeedAnalysiss = CreateObjects<TrainingNeedAnalysis>(oreader);
|
|||
|
|
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return oTrainingNeedAnalysiss;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public List<TrainingNeedAnalysis> Get(int trainingID, int departmentID, int departmentForID, int trainingType)
|
|||
|
|
{
|
|||
|
|
List<TrainingNeedAnalysis> oTrainingNeedAnalysiss;
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Retrieving data
|
|||
|
|
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
|
|||
|
|
DataReader oreader =
|
|||
|
|
new DataReader(TrainingNeedAnalysisDA.Get(tc, trainingID, departmentID, departmentForID,
|
|||
|
|
trainingType));
|
|||
|
|
oTrainingNeedAnalysiss = CreateObjects<TrainingNeedAnalysis>(oreader);
|
|||
|
|
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return oTrainingNeedAnalysiss;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public List<TrainingNeedAnalysis> Get(string query)
|
|||
|
|
{
|
|||
|
|
List<TrainingNeedAnalysis> oTrainingNeedAnalysiss;
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Retrieving data
|
|||
|
|
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
|
|||
|
|
DataReader oreader = new DataReader(TrainingNeedAnalysisDA.Get(tc, query));
|
|||
|
|
oTrainingNeedAnalysiss = CreateObjects<TrainingNeedAnalysis>(oreader);
|
|||
|
|
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return oTrainingNeedAnalysiss;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region IsExist
|
|||
|
|
|
|||
|
|
public TrainingNeedAnalysis IsExist(int trainingID)
|
|||
|
|
{
|
|||
|
|
TrainingNeedAnalysis oTrainingNeedAnalysis = null;
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Retrieving data
|
|||
|
|
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
|
|||
|
|
DataReader oreader = new DataReader(TrainingNeedAnalysisDA.IsExist(tc, trainingID));
|
|||
|
|
|
|||
|
|
if (oreader.Read())
|
|||
|
|
{
|
|||
|
|
oTrainingNeedAnalysis = CreateObject<TrainingNeedAnalysis>(oreader);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return oTrainingNeedAnalysis;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Insert TrainingNeedAnalysis
|
|||
|
|
|
|||
|
|
//public int Save(TrainingNeedAnalysis oTrainingNeedAnalysis)
|
|||
|
|
//{
|
|||
|
|
// try
|
|||
|
|
// {
|
|||
|
|
// TransactionContext tc = null;
|
|||
|
|
// try
|
|||
|
|
// {
|
|||
|
|
// #region Saving data
|
|||
|
|
|
|||
|
|
// tc = TransactionContext.Begin(true);
|
|||
|
|
|
|||
|
|
// if (oTrainingNeedAnalysis.IsNew)
|
|||
|
|
// {
|
|||
|
|
// int newID = tc.GenerateID("TrainingNeedAnalysis", "TrainingNeedAnalysisID");
|
|||
|
|
// base.SetObjectID(oTrainingNeedAnalysis, newID);
|
|||
|
|
|
|||
|
|
// TrainingNeedAnalysisDA.Insert(tc, oTrainingNeedAnalysis);
|
|||
|
|
|
|||
|
|
// foreach (SubordinateTrainee item in oTrainingNeedAnalysis.TrainingEmployee)
|
|||
|
|
// {
|
|||
|
|
// item.TrainingNeedAnalysisID = newID;
|
|||
|
|
// (new TrainingNeedAnalysisService()).SaveSubordinate(tc, item);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// foreach (TrainingNdAnalysisTimeSch item in oTrainingNeedAnalysis.TrainingNdAnalysisTimeSchs)
|
|||
|
|
// {
|
|||
|
|
// item.TrainingNeedAnalysisID = newID;
|
|||
|
|
// (new TrainingNdAnalysisTimeSchService()).Save(tc, item);
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// List<TrainingNdAnalysisTimeSch> oTempNdAnalysisTSchs =
|
|||
|
|
// oTrainingNeedAnalysis.TrainingNdAnalysisTimeSchs;
|
|||
|
|
// List<TrainingDepartment> oTempTrainingDepts = oTrainingNeedAnalysis.TrainingDepartments;
|
|||
|
|
|
|||
|
|
// TrainingDepartmentDA.DeletebyTrainingNeedAnalysisID(tc, oTrainingNeedAnalysis.ID);
|
|||
|
|
// TrainingNdAnalysisTimeSchDA.DeletebyTrainingNeedAnalysisID(tc, oTrainingNeedAnalysis.ID);
|
|||
|
|
|
|||
|
|
// TrainingNeedAnalysisDA.Update(tc, oTrainingNeedAnalysis);
|
|||
|
|
|
|||
|
|
// foreach (TrainingDepartment item in oTempTrainingDepts)
|
|||
|
|
// {
|
|||
|
|
// item.TrainingNeedAnalysisID = oTrainingNeedAnalysis.ID;
|
|||
|
|
// int newID = tc.GenerateID("TrainingDepartment", "TrainDepartmentID");
|
|||
|
|
// base.SetObjectID(item, newID);
|
|||
|
|
// TrainingDepartmentDA.Insert(tc, item);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// foreach (TrainingNdAnalysisTimeSch item in oTempNdAnalysisTSchs)
|
|||
|
|
// {
|
|||
|
|
// item.TrainingNeedAnalysisID = oTrainingNeedAnalysis.ID;
|
|||
|
|
// int newID = tc.GenerateID("TrainingNdAnalysisTimeSch", "TNATimeSchID");
|
|||
|
|
// base.SetObjectID(item, newID);
|
|||
|
|
// TrainingNdAnalysisTimeSchDA.Insert(tc, item);
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// tc.End();
|
|||
|
|
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// catch (Exception e)
|
|||
|
|
// {
|
|||
|
|
// #region Handle Exception
|
|||
|
|
|
|||
|
|
// if (tc != null)
|
|||
|
|
// tc.HandleError();
|
|||
|
|
// throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// catch (Exception e)
|
|||
|
|
// {
|
|||
|
|
// throw new Exception(e.Message, e);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// return oTrainingNeedAnalysis.ID;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
public int Save(TrainingNeedAnalysis oTrainingNeedAnalysis, CurrentUser oCurrentUser)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Saving data
|
|||
|
|
tc = TransactionContext.Begin(true);
|
|||
|
|
if (oTrainingNeedAnalysis.IsNew)
|
|||
|
|
{
|
|||
|
|
int newID = tc.GenerateID("TrainingNeedAnalysis", "TrainingNeedAnalysisID");
|
|||
|
|
base.SetObjectID(oTrainingNeedAnalysis, newID);
|
|||
|
|
TrainingNeedAnalysisDA.Insert(tc, oTrainingNeedAnalysis);
|
|||
|
|
Employee oemp= new EmployeeService().Get(oTrainingNeedAnalysis.EmployeeID);
|
|||
|
|
Employee LineManagerLM = new EmployeeService().Get(oemp.LineManagerID.Value);
|
|||
|
|
if (LineManagerLM == null)
|
|||
|
|
{
|
|||
|
|
throw new Exception("Your Line Manager Not Found");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ObjectiveSet oObjectiveSet = new ObjectiveSet();
|
|||
|
|
oObjectiveSet.ID = oTrainingNeedAnalysis.ObjectiveSetID;
|
|||
|
|
oObjectiveSet.IDPEmployeeDate = DateTime.Now;
|
|||
|
|
oObjectiveSet.IDPEmployeeStatus = enumIDPStatus.Drafted;
|
|||
|
|
oObjectiveSet.IDPLMID = oemp.LineManagerID;
|
|||
|
|
//if(LineManagerLM.LineManagerID ==0 || LineManagerLM.LineManagerID == null)
|
|||
|
|
//{
|
|||
|
|
// throw new Exception("Your Line Manager has no Line Manager");
|
|||
|
|
//}
|
|||
|
|
//oObjectiveSet.IDPSecondLMID = LineManagerLM.LineManagerID;
|
|||
|
|
new ObjectiveSetService().UpdateEmployeeStatusAndDate(tc, oObjectiveSet);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
TrainingNeedAnalysisDA.Update(tc, oTrainingNeedAnalysis);
|
|||
|
|
}
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
throw new Exception(e.Message, e);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return oTrainingNeedAnalysis.ID;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Delete Trainng
|
|||
|
|
|
|||
|
|
public void Delete(int TrainingNeedAnalysisID)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Deleting data
|
|||
|
|
|
|||
|
|
tc = TransactionContext.Begin(true);
|
|||
|
|
TrainingNeedAnalysisDA.Delete(tc, TrainingNeedAnalysisID);
|
|||
|
|
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Subordinate Implementation
|
|||
|
|
|
|||
|
|
public SubordinateTrainee SubordinateGet(int id)
|
|||
|
|
{
|
|||
|
|
SubordinateTrainee oSubordinateTrainee = null;
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Retrieving data
|
|||
|
|
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
|
|||
|
|
DataReader oreader = new DataReader(TrainingNeedAnalysisDA.SubordinateGet(tc, id));
|
|||
|
|
|
|||
|
|
if (oreader.Read())
|
|||
|
|
{
|
|||
|
|
oSubordinateTrainee = CreateObject<SubordinateTrainee>(oreader);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return oSubordinateTrainee;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public List<SubordinateTrainee> SubordinateGet()
|
|||
|
|
{
|
|||
|
|
List<SubordinateTrainee> oSubordinateTrainee = new List<SubordinateTrainee>();
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
DataReader dr = new DataReader(TrainingNeedAnalysisDA.GetSubordinate(tc));
|
|||
|
|
oSubordinateTrainee = this.CreateSubordinateTraineeObjects(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 oSubordinateTrainee;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public List<SubordinateTrainee> GetByTrainingNeedAnalysisID(int TrainingNeedAnalysisID)
|
|||
|
|
{
|
|||
|
|
List<SubordinateTrainee> SubordinateTrainees = new List<SubordinateTrainee>();
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Retrieving data
|
|||
|
|
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
|
|||
|
|
DataReader oreader =
|
|||
|
|
new DataReader(TrainingNeedAnalysisDA.GetByTrainingNeedAnalysisID(tc, TrainingNeedAnalysisID));
|
|||
|
|
SubordinateTrainees = CreateSubordinateTraineeObjects(oreader);
|
|||
|
|
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return SubordinateTrainees;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
private void SaveSubordinate(TransactionContext tc, SubordinateTrainee oSubordinateTrainee)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Saving data
|
|||
|
|
|
|||
|
|
if (oSubordinateTrainee.IsNew)
|
|||
|
|
{
|
|||
|
|
int newID = tc.GenerateID("SubordinateTrainee", "SubordinateTraineeID");
|
|||
|
|
base.SetObjectID(oSubordinateTrainee, newID);
|
|||
|
|
TrainingNeedAnalysisDA.Insert(tc, oSubordinateTrainee);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
TrainingNeedAnalysisDA.Update(tc, oSubordinateTrainee);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
throw new Exception(e.Message, e);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
internal void SaveCollection(TransactionContext tc, List<TrainingNeedAnalysis> _trainingNeedAnalysises)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Saving data
|
|||
|
|
|
|||
|
|
foreach (var oTrainingNeedAnalysis in _trainingNeedAnalysises)
|
|||
|
|
{
|
|||
|
|
if (oTrainingNeedAnalysis.IsNew)
|
|||
|
|
{
|
|||
|
|
int newID = tc.GenerateID("TrainingNeedAnalysis", "TrainingNeedAnalysisID");
|
|||
|
|
base.SetObjectID(oTrainingNeedAnalysis, newID);
|
|||
|
|
|
|||
|
|
TrainingNeedAnalysisDA.Insert(tc, oTrainingNeedAnalysis);
|
|||
|
|
|
|||
|
|
foreach (SubordinateTrainee item in oTrainingNeedAnalysis.TrainingEmployee)
|
|||
|
|
{
|
|||
|
|
item.TrainingNeedAnalysisID = newID;
|
|||
|
|
(new TrainingNeedAnalysisService()).SaveSubordinate(tc, item);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
foreach (TrainingNdAnalysisTimeSch item in oTrainingNeedAnalysis.TrainingNdAnalysisTimeSchs)
|
|||
|
|
{
|
|||
|
|
item.TrainingNeedAnalysisID = newID;
|
|||
|
|
(new TrainingNdAnalysisTimeSchService()).Save(tc, item);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
List<TrainingNdAnalysisTimeSch> oTempNdAnalysisTSchs =
|
|||
|
|
oTrainingNeedAnalysis.TrainingNdAnalysisTimeSchs;
|
|||
|
|
List<TrainingDepartment> oTempTrainingDepts = oTrainingNeedAnalysis.TrainingDepartments;
|
|||
|
|
|
|||
|
|
TrainingDepartmentDA.DeletebyTrainingNeedAnalysisID(tc, oTrainingNeedAnalysis.ID);
|
|||
|
|
TrainingNdAnalysisTimeSchDA.DeletebyTrainingNeedAnalysisID(tc, oTrainingNeedAnalysis.ID);
|
|||
|
|
|
|||
|
|
TrainingNeedAnalysisDA.Update(tc, oTrainingNeedAnalysis);
|
|||
|
|
|
|||
|
|
foreach (TrainingDepartment item in oTempTrainingDepts)
|
|||
|
|
{
|
|||
|
|
item.TrainingNeedAnalysisID = oTrainingNeedAnalysis.ID;
|
|||
|
|
int newID = tc.GenerateID("TrainingDepartment", "TrainDepartmentID");
|
|||
|
|
base.SetObjectID(item, newID);
|
|||
|
|
TrainingDepartmentDA.Insert(tc, item);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
foreach (TrainingNdAnalysisTimeSch item in oTempNdAnalysisTSchs)
|
|||
|
|
{
|
|||
|
|
item.TrainingNeedAnalysisID = oTrainingNeedAnalysis.ID;
|
|||
|
|
int newID = tc.GenerateID("TrainingNdAnalysisTimeSch", "TNATimeSchID");
|
|||
|
|
base.SetObjectID(item, newID);
|
|||
|
|
TrainingNdAnalysisTimeSchDA.Insert(tc, item);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
throw new Exception(e.Message, e);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public List<TrainingNeedAnalysis> GetTrainingNeedAnalysisByEmployeeObjectiveSet(int employeeID, int objectiveSetID)
|
|||
|
|
{
|
|||
|
|
List<TrainingNeedAnalysis> oTrainingNeedAnalysiss;
|
|||
|
|
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Retrieving data
|
|||
|
|
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
|
|||
|
|
DataReader oreader = new DataReader(TrainingNeedAnalysisDA.GetTrainingNeedAnalysisByEmployeeObjectiveSet(tc, employeeID, objectiveSetID));
|
|||
|
|
oTrainingNeedAnalysiss = CreateObjects<TrainingNeedAnalysis>(oreader);
|
|||
|
|
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return oTrainingNeedAnalysiss;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public List<TrainingNeedAnalysis> GetTrainingNeedAnalysisByEmployee(int employeeID)
|
|||
|
|
{
|
|||
|
|
List<TrainingNeedAnalysis> oTrainingNeedAnalysiss;
|
|||
|
|
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Retrieving data
|
|||
|
|
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
|
|||
|
|
DataReader oreader = new DataReader(TrainingNeedAnalysisDA.GetTrainingNeedAnalysisByEmployee(tc, employeeID));
|
|||
|
|
oTrainingNeedAnalysiss = CreateObjects<TrainingNeedAnalysis>(oreader);
|
|||
|
|
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return oTrainingNeedAnalysiss;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public List<TrainingNeedAnalysis> getTrainingNeedAnalysisHistoryByEmployee(int employeeID, int activepmpYearId)
|
|||
|
|
{
|
|||
|
|
List<TrainingNeedAnalysis> oTrainingNeedAnalysiss;
|
|||
|
|
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Retrieving data
|
|||
|
|
|
|||
|
|
PMPProcess oPmpProcess = new PMPProcessService().GetByPMPProcessID(activepmpYearId);
|
|||
|
|
DateTime dt = oPmpProcess.PmpYear.AddYears(-1);
|
|||
|
|
PMPProcess previousPMPProcess = new PMPProcessService().GetByDateAndYear(dt);
|
|||
|
|
if (previousPMPProcess != null)
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
DataReader oreader = new DataReader(TrainingNeedAnalysisDA.getTrainingNeedAnalysisHistoryByEmployee(tc, employeeID, previousPMPProcess.ID));
|
|||
|
|
oTrainingNeedAnalysiss = CreateObjects<TrainingNeedAnalysis>(oreader);
|
|||
|
|
tc.End();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
oTrainingNeedAnalysiss = new List<TrainingNeedAnalysis>();
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return oTrainingNeedAnalysiss;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#region Training Need Analysis screen (PMS-year wise list, summary and enrollment)
|
|||
|
|
|
|||
|
|
// Separate from MapObject because that one hard-dereferences TrainingID and
|
|||
|
|
// Conduct_Required, which are NULL on IDP rows that are not Formal Learning.
|
|||
|
|
private void MapScreenObject(TrainingNeedAnalysis oItem, DataReader oReader)
|
|||
|
|
{
|
|||
|
|
base.SetObjectID(oItem, oReader.GetInt32("TrainingNeedAnalysisID").Value);
|
|||
|
|
oItem.TrainingYear = oReader.GetInt32("TrainingYear").GetValueOrDefault();
|
|||
|
|
oItem.Name = oReader.GetString("Name");
|
|||
|
|
oItem.EmployeeID = oReader.GetInt32("EmployeeID").GetValueOrDefault();
|
|||
|
|
oItem.DepartmentID = oReader.GetInt32("DepartmentID").GetValueOrDefault();
|
|||
|
|
oItem.TrainingID = oReader.GetInt32("TrainingID");
|
|||
|
|
oItem.Description = oReader.GetString("Description");
|
|||
|
|
oItem.MaxParticipent = oReader.GetInt32("MaxParticipent").GetValueOrDefault();
|
|||
|
|
oItem.Conduct_Required = oReader.GetInt32("Conduct_Required").GetValueOrDefault();
|
|||
|
|
oItem.ObjectiveSetID = oReader.GetInt32("ObjectiveSetID").GetValueOrDefault();
|
|||
|
|
oItem.ExpectedDate = oReader.GetString("ExpectedDate");
|
|||
|
|
oItem.ExpectedResults = oReader.GetString("ExpectedResults");
|
|||
|
|
|
|||
|
|
oItem.NeedType = oReader.GetInt32("NeedType").HasValue
|
|||
|
|
? (EnumNeedType)oReader.GetInt32("NeedType").Value
|
|||
|
|
: (EnumNeedType?)null;
|
|||
|
|
oItem.NeedTypeName = GetNeedTypeName(oItem.NeedType);
|
|||
|
|
|
|||
|
|
// Safe read: the column only exists once TrainingNeedAnalysisEnroll_DB_Changes.sql has run.
|
|||
|
|
oItem.Enrolled = oReader.GetBoolean("Enrolled", true, false);
|
|||
|
|
|
|||
|
|
oItem.CreatedBy = oReader.GetInt32("CreatedBy").GetValueOrDefault();
|
|||
|
|
oItem.CreatedDate = oReader.GetDateTime("CreatedDate").GetValueOrDefault();
|
|||
|
|
oItem.ModifiedBy = oReader.GetInt32("ModifiedBy");
|
|||
|
|
oItem.ModifiedDate = oReader.GetDateTime("ModifiedDate");
|
|||
|
|
|
|||
|
|
oItem.EmployeeName = oReader.GetString("EmployeeName");
|
|||
|
|
oItem.EmployeeNo = oReader.GetString("EmployeeNo");
|
|||
|
|
oItem.DepartmentName = oReader.GetString("DepartmentName");
|
|||
|
|
oItem.DesignationName = oReader.GetString("DesignationName");
|
|||
|
|
oItem.TrainingName = string.IsNullOrEmpty(oReader.GetString("TrainingTypeName"))
|
|||
|
|
? oItem.Name
|
|||
|
|
: oReader.GetString("TrainingTypeName");
|
|||
|
|
|
|||
|
|
this.SetObjectState(oItem, Ease.Core.ObjectState.Saved);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private string GetNeedTypeName(EnumNeedType? needType)
|
|||
|
|
{
|
|||
|
|
switch (needType)
|
|||
|
|
{
|
|||
|
|
case EnumNeedType.OnTheJob:
|
|||
|
|
return "On the Job (70)";
|
|||
|
|
case EnumNeedType.CoachingOrMentoring:
|
|||
|
|
return "Coaching / Mentoring (20)";
|
|||
|
|
case EnumNeedType.FormalLearning:
|
|||
|
|
return "Formal Learning (10)";
|
|||
|
|
default:
|
|||
|
|
return string.Empty;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private List<TrainingNeedAnalysis> CreateScreenObjects(DataReader oReader)
|
|||
|
|
{
|
|||
|
|
List<TrainingNeedAnalysis> items = new List<TrainingNeedAnalysis>();
|
|||
|
|
while (oReader.Read())
|
|||
|
|
{
|
|||
|
|
TrainingNeedAnalysis item = new TrainingNeedAnalysis();
|
|||
|
|
MapScreenObject(item, oReader);
|
|||
|
|
items.Add(item);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return items;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public List<TrainingNeedAnalysis> GetByPmpYear(int pmpYearId)
|
|||
|
|
{
|
|||
|
|
List<TrainingNeedAnalysis> items = new List<TrainingNeedAnalysis>();
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Retrieving data
|
|||
|
|
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
DataReader oreader = new DataReader(TrainingNeedAnalysisDA.GetByPmpYear(tc, pmpYearId));
|
|||
|
|
items = CreateScreenObjects(oreader);
|
|||
|
|
oreader.Close();
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
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 GetCountByPmpYear(int pmpYearId)
|
|||
|
|
{
|
|||
|
|
DataSet ds = new DataSet();
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Retrieving data
|
|||
|
|
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
ds = TrainingNeedAnalysisDA.GetCountByPmpYear(tc, pmpYearId);
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
ExceptionLog.Write(e);
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return ds;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void UpdateEnrolledStatus(int trainingNeedAnalysisID, bool enrolled)
|
|||
|
|
{
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
#region Saving data
|
|||
|
|
|
|||
|
|
tc = TransactionContext.Begin(true);
|
|||
|
|
TrainingNeedAnalysisDA.UpdateEnrolledStatus(tc, trainingNeedAnalysisID, enrolled);
|
|||
|
|
tc.End();
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
ExceptionLog.Write(e);
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|