169 lines
8.8 KiB
C#
169 lines
8.8 KiB
C#
|
using HRM.BO;
|
|||
|
using Ease.Core.DataAccess;
|
|||
|
using System;
|
|||
|
using System.Data;
|
|||
|
|
|||
|
|
|||
|
namespace HRM.DA
|
|||
|
{
|
|||
|
class DevelopmentPlanDA
|
|||
|
{
|
|||
|
internal static IDataReader Get(TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL("SELECT * FROM DevelopmentPlan");
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
internal static IDataReader Get(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL("SELECT * FROM DevelopmentPlan WHERE DevelopmentPlanID = %n", id);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
internal static IDataReader GetByObjectiveSetId(TransactionContext tc, int objectiveSetId)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL("SELECT * FROM DevelopmentPlan WHERE ObjectiveSetID = %n", objectiveSetId);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
internal static IDataReader GetPreviousYears(TransactionContext tc, int employeeId, int pmpYearId)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL("SELECT * FROM DevelopmentPlan WHERE EmployeeId = %n and PMPYearId <> pmpYearId", employeeId, pmpYearId);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
internal static IDataReader GetPreviousYears(TransactionContext tc, int employeeId, DateTime pmpYear)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL("SELECT * FROM DEVELOPMENTPLAN WHERE EmployeeId = %n and PMPYearId IN (SELECT PMPPROCESSID FROM PMP_PROCESS WHERE YEAR(PMPYEAR) < %n)", employeeId, pmpYear.Year);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static void Insert(TransactionContext tc, DevelopmentPlan item)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL("INSERT INTO dbo.DEVELOPMENTPLAN (DEVELOPMENTPLANID, OBJECTIVESETID, EMPLOYEEID, PMPYEARID, FROMDATE, TODATE, TRAININGID, TRAININGNAME, TARGETRATINGID, EMPREMARKS, LMREMARKS, MEASUREOFSUCCESS) " +
|
|||
|
"VALUES (%n, %n, %n, %n , %d, %d, %n, %s, %n, %s, %s, %s)", item.ID, item.ObjectiveSetID, item.EmployeeID, item.PMPYearID, item.FromDate, item.ToDate, item.TrainingID, item.TrainingName.Trim(), item.TargetRatingID, item.EmpRemarks, item.LMRemarks, item.MeasureOfSuccess);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static void Update(TransactionContext tc, DevelopmentPlan item)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL("UPDATE dbo.DEVELOPMENTPLAN SET DEVELOPMENTPLANID = %n, OBJECTIVESETID = %n, EMPLOYEEID = %n, PMPYEARID = %n, FROMDATE = %d, TODATE = %d, TRAININGID = %n, TRAININGNAME = %s, TARGETRATINGID = %n, EMPREMARKS = %s, LMREMARKS = %s, MEASUREOFSUCCESS = %s" +
|
|||
|
"WHERE DEVELOPMENTPLANID = %n", item.ObjectiveSetID, item.EmployeeID, item.PMPYearID, item.FromDate, item.ToDate, item.TrainingID, item.TrainingName.Trim(), item.TargetRatingID, item.EmpRemarks, item.LMRemarks, item.MeasureOfSuccess, item.ID);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
internal static void Delete(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL("Delete From DevelopmentPlan Where DevelopmentPlanID = %n", id);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
internal static IDataReader GetFunctionalDevelopment(TransactionContext tc, int DevPlanID)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL("SELECT * FROM FuncDevelopment where DevelopmentPlanID=%n", DevPlanID);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetByPmpYearId(TransactionContext tc, int pmpYearId)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"SELECT dp.* FROM DevelopmentPlan dp
|
|||
|
WHERE PMPYearId=%n", pmpYearId);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static void Save(TransactionContext tc, DevelopmentPlan item, EnumObjectiveFlowStatus DevPlanEmpStatus)
|
|||
|
{
|
|||
|
//string sql = SQLParser.MakeSQL(
|
|||
|
// "Insert Into DevelopmentPlan(DevelopmentPlanID, FuncDevNeeds, NxtCarrierSteps, TimeLine, ObjectiveID, TrainingID,TrainingID2,TrainingID3,CanTravel, Remarks, EmployeeID, ObjectiveSetID) Values(%n, %s, %s, %s, %n, %n,%n,%n,%b, %s, %n, %n)",
|
|||
|
// item.ID, item.FuncDevNeeds, item.NxtCarrierSteps, item.TimeLine,
|
|||
|
// DataReader.GetNullValue(item.ObjectiveID), item.TrainingID, item.TrainingID2, item.TrainingID3,
|
|||
|
// item.CanTravel, item.Remarks, DataReader.GetNullValue(item.EmployeeID),
|
|||
|
// DataReader.GetNullValue(item.ObjectiveSetID));
|
|||
|
//tc.ExecuteNonQuery(sql);
|
|||
|
//sql = SQLParser.MakeSQL(
|
|||
|
// "Update ObjectiveSet Set DEVPLANEMPSTATUS=%n,DevPlanLMStatus=%n where OBJECTIVESETID= %n",
|
|||
|
// (int)DevPlanEmpStatus, (int)EnumObjectiveFlowStatus.Not_Yet_Initiated, item.ObjectiveSetID);
|
|||
|
//tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static void Update(TransactionContext tc, DevelopmentPlan item,
|
|||
|
EnumObjectiveFlowStatus DevPlanEmpStatus)
|
|||
|
{
|
|||
|
//string sql = SQLParser.MakeSQL(
|
|||
|
// "Update DevelopmentPlan Set FuncDevNeeds = %s, NxtCarrierSteps = %s, TimeLine = %s, ObjectiveID = %n, TrainingID = %n, TrainingID2 = %n, TrainingID3 = %n,CanTravel=%b, Remarks = %s, EmployeeID = %n, ObjectiveSetID = %n where DevelopmentPlanID= %n",
|
|||
|
// item.FuncDevNeeds, item.NxtCarrierSteps, item.TimeLine, DataReader.GetNullValue(item.ObjectiveID),
|
|||
|
// item.TrainingID, item.TrainingID2, item.TrainingID3, item.CanTravel, item.Remarks,
|
|||
|
// DataReader.GetNullValue(item.EmployeeID), DataReader.GetNullValue(item.ObjectiveSetID), item.ID);
|
|||
|
//tc.ExecuteNonQuery(sql);
|
|||
|
//sql = SQLParser.MakeSQL(
|
|||
|
// "Update ObjectiveSet Set DEVPLANEMPSTATUS=%n,DevPlanLMStatus=%n where OBJECTIVESETID= %n",
|
|||
|
// (int)DevPlanEmpStatus, (int)EnumObjectiveFlowStatus.Not_Yet_Initiated, item.ObjectiveSetID);
|
|||
|
//tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static void LMUpdate(TransactionContext tc, DevelopmentPlan item,
|
|||
|
EnumObjectiveFlowStatus DevPlanLMStatus)
|
|||
|
{
|
|||
|
//string sql = SQLParser.MakeSQL("Update DevelopmentPlan Set Remarks = %s where DevelopmentPlanID= %n",
|
|||
|
// item.Remarks, item.ID);
|
|||
|
//tc.ExecuteNonQuery(sql);
|
|||
|
//sql = SQLParser.MakeSQL("Update ObjectiveSet Set DevPlanLMStatus=%n where OBJECTIVESETID= %n",
|
|||
|
// (int)DevPlanLMStatus, item.ObjectiveSetID);
|
|||
|
//tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static void DeleteFunctionalDevelopments(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL("Delete From FuncDevelopment Where DevelopmentPlanID = %n", id);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static void Insert(TransactionContext tc, FunctionalDevelopment item)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(
|
|||
|
"Insert Into FuncDevelopment(FuncDevelopmentID,DevelopmentPlanID,TrainingID) Values(%n, %n, %n)",
|
|||
|
item.ID, item.DevelopmentPlanID, item.TrainingID);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
internal static IDataReader GetByEmployeeID(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL("SELECT * FROM DevelopmentPlan Where EmployeeID = %n", id);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetByPMPYearID(TransactionContext tc, int id, string InEmpSQL)
|
|||
|
{
|
|||
|
string sql = "";
|
|||
|
if (InEmpSQL == "")
|
|||
|
sql = SQLParser.MakeSQL(
|
|||
|
"select * from DevelopmentPlan where objectivesetid in(select objectivesetid from objectiveset where pmpyearid=%n)",
|
|||
|
id);
|
|||
|
else
|
|||
|
sql = SQLParser.MakeSQL(
|
|||
|
"select * from DevelopmentPlan where objectivesetid in(select objectivesetid from objectiveset where pmpyearid=%n) AND EmployeeID in (%q) ",
|
|||
|
id, InEmpSQL);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetByObjSetID(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL("SELECT * FROM DevelopmentPlan Where ObjectiveSetID = %n", id);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static DataSet GetTrainingNeedAnalysisCount(TransactionContext tc,int pmpYearId)
|
|||
|
{
|
|||
|
DataSet ds = new DataSet();
|
|||
|
try
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(
|
|||
|
"select TRAININGNAME,count(EMPLOYEEID) Total from DEVELOPMENTPLAN where PMPYEARID=%n group by TRAININGNAME", pmpYearId);
|
|||
|
ds = tc.ExecuteDataSet(sql);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new Exception(ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return ds;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|