381 lines
20 KiB
C#
381 lines
20 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Data;
|
|
using Ease.CoreV35.DataAccess;
|
|
using Payroll.BO;
|
|
using Ease.CoreV35.Model;
|
|
|
|
namespace Payroll.Service
|
|
{
|
|
public class PMPProcessDA
|
|
{
|
|
internal static IDataReader Get(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("Select * from PMP_Process");
|
|
}
|
|
|
|
internal static void Insert(TransactionContext tc, PMPProcess item)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
internal static void Update(TransactionContext tc,PMPProcess item)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
internal static void Delete(TransactionContext tc, ID id)
|
|
{
|
|
tc.ExecuteNonQuery("Delete From PMP_Process Where PMPProcessID = %n", id.Integer);
|
|
}
|
|
|
|
internal static IDataReader GetAllPMPTargetSettings(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("Select * From PMP_TargetSetting");
|
|
}
|
|
|
|
internal static void Insert(TransactionContext tc, PMPTargetSetting item)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
internal static void Update(TransactionContext tc,PMPTargetSetting item)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
internal static IDataReader GetEmployeeRatingById(TransactionContext tc, ID id)
|
|
{
|
|
return tc.ExecuteReader("Select * From PMP_EmployeeRating Where PMPEmployeeRatingId = %n", id.Integer);
|
|
}
|
|
|
|
internal static IDataReader GetPmpTargetSettingByPmpTargetSettingId(TransactionContext tc, ID Id)
|
|
{
|
|
return tc.ExecuteReader("Select * From PMP_TargetSetting Where PMPTargetSettingId = %n", Id.Integer);
|
|
}
|
|
|
|
internal static IDataReader GetPmpValueBehaviorRatingById(TransactionContext tc, ID Id)
|
|
{
|
|
return tc.ExecuteReader("Select * From PMP_ValueBehaviorRating Where PMPValueBehaviorRatingId = %n", Id.Integer);
|
|
}
|
|
|
|
internal static void InsertPMPProcessItem(TransactionContext tc, PMPProcess item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"Insert Into PMP_Process
|
|
(PmpStatus,PMPProcessID,PmpYear,Description,TargetSettingFrom,TargetSettingTo,MedianAppraisalFrom,MedianAppraisalTo,
|
|
FinalApprovalFrom,FinalApprovalTo,IsFinalize,CreadtedBy,CreationDate,Status,Sequence)
|
|
Values(%n,%n,%d,%s,%d,%d,%d,%d,%d,%d,%n,%n,%d,%n,%n)",
|
|
item.PmpStatus,item.ID.Integer, item.PmpYear, item.Description, item.TargetSettingFrom,
|
|
item.TargetSettingTo, item.MedianAppraisalFrom, item.MedianAppraisalTo,
|
|
item.FinalApprovalFrom, item.FinalApprovalTo,
|
|
Convert.ToInt32(item.IsFinalize), item.CreatedBy.Integer, item.CreatedDate, item.Status, item.Sequence);
|
|
tc.ExecuteNonQuery(sql);
|
|
|
|
}
|
|
|
|
internal static void UpdatePMPProcessItem(TransactionContext tc, PMPProcess item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"Update PMP_Process Set PmpStatus = %n,PmpYear = %d, Description =%s,
|
|
TargetSettingFrom = %d,TargetSettingTo = %d,MedianAppraisalFrom = %d,MedianAppraisalTo = %d,
|
|
FinalApprovalFrom =%d,FinalApprovalTo = %d,IsFinalize = %n,Status = %n,Sequence = %n,ModifiedBy = %n,ModifiedDate =%d
|
|
Where PMPProcessID = %n"
|
|
, item.PmpStatus,item.PmpYear, item.Description, item.TargetSettingFrom, item.TargetSettingTo, item.MedianAppraisalFrom, item.MedianAppraisalTo,
|
|
item.FinalApprovalFrom,item.FinalApprovalTo,Convert.ToInt32(item.IsFinalize),item.Status,item.Sequence,item.ModifiedBy.Integer,item.ModifiedDate,item.ID.Integer);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
internal static void UpdatePMPStatus(TransactionContext tc, PMPProcess item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"Update PMP_EmployeeRating Set PmpStatus = %n, PmpWFStatus = %n"
|
|
+ " Where PMPProcessID = %n And PmpWFStatus=%n", item.PmpStatus, null, item.ID.Integer, PMPWFStatus.Complete);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
internal static void InsertPMPEmployeeRatingItem(TransactionContext tc, PMPEmployeeRating item)
|
|
{
|
|
double? incrementedPercentByHR = null;
|
|
if (item.IncrementedPercentByHR == Double.MinValue) incrementedPercentByHR = null;
|
|
else incrementedPercentByHR = item.IncrementedPercentByHR;
|
|
|
|
|
|
|
|
|
|
tc.ExecuteNonQuery(@"Insert Into PMP_EmployeeRating
|
|
(IsFinalized,RemarksByHR,IncrementedPercentByHR,HrValueBehaValueBehaviorRatingID,HrTargetSettingRatingID,SelfValueBehaviorRatingID,SelfObjectRatingID,PmpStatus,PmpWFStatus,PMPEmployeeRatingId,PmpProcessID,EmployeeID,ApprovarID,ApprovarObjectRatingID,AppValueBehaviorRatingID,IsTargetSettingDone,IsMedianDone,IsValueBehaviorDone)
|
|
Values(%n,%s,%n,%n,%n,%n,%n,%n,%n,%n,%n,%n,%n,%n,%n,%n,%n,%n)",
|
|
Convert.ToInt32(item.IsFinalized),item.RemarksByHR, DataReader.GetNullValue(incrementedPercentByHR),DataReader.GetNullValue(item.HrValueBehaValueBehaviorRatingID, IDType.Integer), DataReader.GetNullValue(item.HrTargetSettingRatingID, IDType.Integer),
|
|
DataReader.GetNullValue(item.SelfValueBehaviorRatingID,IDType.Integer),DataReader.GetNullValue(item.SelfObjectRatingID,IDType.Integer),
|
|
item.PmpStatus,item.PmpWFStatus,item.ID.Integer, item.PmpProcessID.Integer, item.EmployeeID.Integer,
|
|
DataReader.GetNullValue(item.ApprovarID,IDType.Integer), DataReader.GetNullValue(item.ApprovarObjectRatingID, IDType.Integer), DataReader.GetNullValue(item.AppValueBehaviorRatingID,IDType.Integer),
|
|
item.IsTargetSettingDone,item.IsMedianDone, item.IsValueBehaviorDone);
|
|
|
|
}
|
|
|
|
internal static void UpdatePMPEmployeeRatingItem(TransactionContext tc, PMPEmployeeRating item)
|
|
{
|
|
int? appValueBehaviorId = null;
|
|
if ( item.AppValueBehaviorRatingID == null)
|
|
appValueBehaviorId = null;
|
|
else if (!item.AppValueBehaviorRatingID.IsUnassigned )
|
|
appValueBehaviorId = item.AppValueBehaviorRatingID.Integer;
|
|
int? appRatingid = null;
|
|
if (item.ApprovarObjectRatingID == null)
|
|
appRatingid = null;
|
|
else if(!item.ApprovarObjectRatingID.IsUnassigned)
|
|
appRatingid = item.ApprovarObjectRatingID.Integer;
|
|
int? appId = null;
|
|
if (item.ApprovarID == null)
|
|
appId = null;
|
|
else if (!item.ApprovarID.IsUnassigned )
|
|
appId = item.ApprovarID.Integer;
|
|
|
|
|
|
int? selfValueBehaviorId = null;
|
|
if (item.SelfValueBehaviorRatingID == null)
|
|
selfValueBehaviorId = null;
|
|
else if (!item.SelfValueBehaviorRatingID.IsUnassigned)
|
|
selfValueBehaviorId = item.SelfValueBehaviorRatingID.Integer;
|
|
|
|
|
|
int? SelfObjectRatingID = null;
|
|
if (item.SelfObjectRatingID == null)
|
|
SelfObjectRatingID = null;
|
|
else if (!item.SelfObjectRatingID.IsUnassigned)
|
|
SelfObjectRatingID = item.SelfObjectRatingID.Integer;
|
|
|
|
|
|
|
|
double? incrementedPercentByHR = null;
|
|
if (item.IncrementedPercentByHR == Double.MinValue) incrementedPercentByHR = null;
|
|
else incrementedPercentByHR = item.IncrementedPercentByHR;
|
|
|
|
|
|
tc.ExecuteNonQuery(@"Update PMP_EmployeeRating Set IsFinalized = %n,RemarksByHR = %s, IncrementedPercentByHR = %n,HrValueBehaValueBehaviorRatingID = %n,
|
|
HrTargetSettingRatingID = %n,SelfValueBehaviorRatingID = %n,SelfObjectRatingID = %n,PmpStatus = %n,PmpWFStatus = %n,PmpProcessID = %n,EmployeeID = %n,ApprovarID = %n,
|
|
ApprovarObjectRatingID = %n,AppValueBehaviorRatingID = %n,
|
|
IsTargetSettingDone = %n,IsMedianDone = %n,IsValueBehaviorDone = %n Where PMPEmployeeRatingId = %n",
|
|
Convert.ToInt32(item.IsFinalized),item.RemarksByHR,DataReader.GetNullValue(incrementedPercentByHR),
|
|
DataReader.GetNullValue(item.HrValueBehaValueBehaviorRatingID,IDType.Integer),
|
|
DataReader.GetNullValue(item.HrTargetSettingRatingID, IDType.Integer),
|
|
DataReader.GetNullValue(selfValueBehaviorId), DataReader.GetNullValue(SelfObjectRatingID),
|
|
item.PmpStatus,item.PmpWFStatus,item.PmpProcessID.Integer,item.EmployeeID.Integer,DataReader.GetNullValue(appId),DataReader.GetNullValue(appRatingid),
|
|
DataReader.GetNullValue(appValueBehaviorId),item.IsTargetSettingDone,item.IsMedianDone,item.IsValueBehaviorDone,item.ID.Integer
|
|
);
|
|
|
|
}
|
|
|
|
internal static void InsertPMPTargetSettingItem(TransactionContext tc, PMPTargetSetting item)
|
|
{
|
|
|
|
DateTime? targetDate = null;
|
|
if (item.TargetDate == DateTime.MinValue)
|
|
targetDate = null;
|
|
else
|
|
targetDate = item.TargetDate;
|
|
tc.ExecuteNonQuery(@"Insert PMP_TargetSetting
|
|
(EmployeeID,ApprovarID,PMPTargetSettingId,PmpProcessId,Objective,ObjectivePercent,TargetDate,EvaluationCriteria,PmpEmployeeRatingID)
|
|
Values(%n,%n,%n,%n,%s,%n,%d,%s,%n)", item.EmployeeID.Integer, DataReader.GetNullValue(item.ApprovarID, IDType.Integer),
|
|
item.ID.Integer, item.PmpProcessId.Integer,
|
|
item.Objective, item.ObjectivePercent, DataReader.GetNullValue(targetDate),
|
|
item.EvaluationCriteria,item.PmpEmployeeRatingID.Integer);
|
|
|
|
UpdatePMPTargetSettingItem(tc, item);
|
|
}
|
|
|
|
internal static void UpdatePMPTargetSettingItem(TransactionContext tc, PMPTargetSetting item)
|
|
{
|
|
int? selfRatingid = null;
|
|
if (item.SelfRatingID == null)
|
|
selfRatingid = null;
|
|
else if (item.SelfRatingID.IsUnassigned) selfRatingid = null;
|
|
else
|
|
selfRatingid = item.SelfRatingID.Integer;
|
|
|
|
|
|
int? appRatingid = null;
|
|
if (item.ApprovarRatingID == null)
|
|
appRatingid = null;
|
|
else if (item.ApprovarRatingID.IsUnassigned) appRatingid = null;
|
|
else
|
|
appRatingid = item.ApprovarRatingID.Integer;
|
|
|
|
|
|
int? appId = null;
|
|
if (item.ApprovarID == null)
|
|
appId = null;
|
|
else if (item.ApprovarID.IsUnassigned) appId = null;
|
|
else
|
|
appId = item.ApprovarID.Integer;
|
|
|
|
DateTime? tarDate = null;
|
|
if (item.TargetDate == DateTime.MinValue) tarDate = null;
|
|
else tarDate = item.TargetDate;
|
|
|
|
tc.ExecuteNonQuery(@"Update PMP_TargetSetting Set PmpEmployeeRatingID = %n,EmployeeID = %n,PmpProcessId = %n,Objective = %s,ObjectivePercent = %n,TargetDate = %d,EvaluationCriteria = %s,SelfRatingID = %n,SelfComments = %s,ApprovarRatingID = %n,ApprovarComments = %s,ApprovarID = %n
|
|
Where PMPTargetSettingId = %n", item.PmpEmployeeRatingID.Integer,item.EmployeeID.Integer, item.PmpProcessId.Integer, item.Objective, item.ObjectivePercent, DataReader.GetNullValue(tarDate), item.EvaluationCriteria, DataReader.GetNullValue(selfRatingid), DataReader.GetNullValue(item.SelfComments), DataReader.GetNullValue(appRatingid), DataReader.GetNullValue(item.ApprovarComments), DataReader.GetNullValue(appId), item.ID.Integer);
|
|
}
|
|
|
|
internal static void InsertPMPValueBehaviorRatingItem(TransactionContext tc, PMPValueBehaviorRating item)
|
|
{
|
|
int? selfRatingid = null;
|
|
if (item.SelfRatingID == null)
|
|
selfRatingid = null;
|
|
else if (item.SelfRatingID.IsUnassigned) selfRatingid = null;
|
|
else
|
|
selfRatingid = item.SelfRatingID.Integer;
|
|
|
|
|
|
int? appRatingid = null;
|
|
if (item.ApprovarRatingID == null)
|
|
appRatingid = null;
|
|
else if (item.ApprovarRatingID.IsUnassigned) appRatingid = null;
|
|
else
|
|
appRatingid = item.ApprovarRatingID.Integer;
|
|
|
|
tc.ExecuteNonQuery(@"Insert Into PMP_ValueBehaviorRating
|
|
(PMPValueBehaviorRatingId,PMPValueBehaviorID,EmployeeID,SelfComments,
|
|
SelfRatingID,ApprovarComments,ApprovarRatingID,PmpProcessID,PmpEmployeeRatingID)
|
|
Values(%n,%n,%n,%s,%n,%s,%n,%n,%n)", item.ID.Integer,
|
|
item.PMPValueBehaviorID.Integer,
|
|
item.EmployeeID.Integer, DataReader.GetNullValue(item.SelfComments), DataReader.GetNullValue(selfRatingid),
|
|
DataReader.GetNullValue(item.ApprovarComments), DataReader.GetNullValue(appRatingid),item.PmpProcessId.Integer,item.PmpEmployeeRatingID.Integer);
|
|
|
|
UpdatePMPValueBehaviorRatingItem(tc, item);
|
|
}
|
|
|
|
internal static void UpdatePMPValueBehaviorRatingItem(TransactionContext tc, PMPValueBehaviorRating item)
|
|
{
|
|
int? selfRatingid = null;
|
|
if (item.SelfRatingID == null)
|
|
selfRatingid = null;
|
|
else if (item.SelfRatingID.IsUnassigned) selfRatingid = null;
|
|
else selfRatingid = item.SelfRatingID.Integer;
|
|
|
|
|
|
int? appRatingid = null;
|
|
if (item.ApprovarRatingID == null)
|
|
appRatingid = null;
|
|
else if (item.ApprovarRatingID.IsUnassigned) appRatingid = null;
|
|
else
|
|
appRatingid = item.ApprovarRatingID.Integer;
|
|
tc.ExecuteNonQuery(@"Update PMP_ValueBehaviorRating Set PmpEmployeeRatingID = %n,SelfComments = %s, SelfRatingID = %n ,ApprovarComments = %s,ApprovarRatingID = %n Where PMPValueBehaviorRatingId = %n",
|
|
item.PmpEmployeeRatingID.Integer, DataReader.GetNullValue(item.SelfComments), DataReader.GetNullValue(item.SelfRatingID,IDType.Integer), DataReader.GetNullValue(item.ApprovarComments), DataReader.GetNullValue(appRatingid), item.ID.Integer);
|
|
|
|
}
|
|
|
|
|
|
internal static IDataReader GetByPMPProcessID(TransactionContext tc, ID id)
|
|
{
|
|
return tc.ExecuteReader("Select * From PMP_Process Where PMPProcessID = %n", id.Integer);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, DateTime pmpYear)
|
|
{
|
|
return tc.ExecuteReader("Select * From PMP_Process Where PMPYear = %d", Ease.CoreV35.Utility.Global.DateFunctions.LastDateOfYear(pmpYear));
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
|
|
{
|
|
if (status == EnumStatus.Regardless)
|
|
{
|
|
return tc.ExecuteReader("Select * from PMP_Process");
|
|
}
|
|
else return tc.ExecuteReader("Select * from PMP_Process Where status = %n",status);
|
|
}
|
|
|
|
internal static IDataReader GetByPMPProcessId(TransactionContext tc, ID id)
|
|
{
|
|
return tc.ExecuteReader("Select * From PMP_Process Where PmpProcessID = %n", id.Integer);
|
|
}
|
|
|
|
internal static void DeletePMPTargetSettingById(TransactionContext tc, ID id)
|
|
{
|
|
tc.ExecuteNonQuery("Delete From PMP_TargetSetting Where PMPTargetSettingId = %n", id.Integer);
|
|
}
|
|
|
|
internal static IDataReader GetPMPTargetSettingsByEmployeeId(TransactionContext tc, ID id)
|
|
{
|
|
return tc.ExecuteReader("Select * From PMP_TargetSetting Where EmployeeID = %n", id.Integer);
|
|
}
|
|
|
|
internal static IDataReader GetPMPTargetSettingsByEmployeeIdAndPMPProcessID(TransactionContext tc, ID id, ID pmpProcessID)
|
|
{
|
|
return tc.ExecuteReader("Select * From PMP_TargetSetting Where EmployeeID = %n And PmpProcessID = %n", id.Integer,pmpProcessID.Integer);
|
|
}
|
|
|
|
internal static IDataReader GetValueBehaviorRatingsByEmployeeIdAndPmpProcessId(TransactionContext tc, ID empId, ID pmpProcessId)
|
|
{
|
|
return tc.ExecuteReader("Select * From PMP_ValueBehaviorRating Where EmployeeID = %n And PmpProcessID = %n", empId.Integer, pmpProcessId.Integer);
|
|
}
|
|
|
|
internal static IDataReader GetPmpEmployeeRatingByEmployeeIdAndPmpProcessId(TransactionContext tc, ID empId, ID pmpProcessId)
|
|
{
|
|
return tc.ExecuteReader("Select * From PMP_EmployeeRating Where PmpProcessID = %n And EmployeeID = %n", pmpProcessId.Integer, empId.Integer);
|
|
}
|
|
|
|
internal static IDataReader GetPmpEmployeeRatingByRatingId(TransactionContext tc, ID ratingId)
|
|
{
|
|
return tc.ExecuteReader("Select * From PMP_EmployeeRating Where PMPEmployeeRatingId = %n", ratingId.Integer);
|
|
}
|
|
|
|
internal static IDataReader GetEmployeeRating(TransactionContext tc, ID processID)
|
|
{
|
|
return tc.ExecuteReader("Select * From PMP_EmployeeRating Where PmpProcessID = %n", processID.Integer);
|
|
}
|
|
|
|
|
|
|
|
internal static void DeleteValueBehaviorRating(TransactionContext tc, ID EmployeeId, ID PmpProcessId)
|
|
{
|
|
tc.ExecuteNonQuery("Delete From PMP_ValueBehaviorRating Where EmployeeID = %n And PmpProcessID = %n", EmployeeId.Integer, PmpProcessId.Integer);
|
|
}
|
|
|
|
internal static void DeleteAllPmpTargetSetting(TransactionContext tc,ID EmployeeId, ID PmpProcessId)
|
|
{
|
|
tc.ExecuteNonQuery("Delete From PMP_TargetSetting Where EmployeeID = %n And PmpProcessID = %n", EmployeeId.Integer, PmpProcessId.Integer);
|
|
}
|
|
|
|
internal static IDataReader GetEmployeeRating(TransactionContext tc, ID pmpProcessId, PMPStatus pmpStatus, PMPWFStatus status)
|
|
{
|
|
return tc.ExecuteReader("Select * From PMP_EmployeeRating Where PmpProcessID = %n And PmpStatus=%n And PmpWFStatus = %n", pmpProcessId.Integer, pmpStatus, status);
|
|
}
|
|
|
|
internal static IDataReader GetEmployeeRatingForDraft(TransactionContext tc, ID pmpProcessId)
|
|
{
|
|
return tc.ExecuteReader("Select * From PMP_EmployeeRating Where pmpProcessId = %n And PmpWFStatus Not In (1,2)", pmpProcessId.Integer);
|
|
}
|
|
internal static DataSet GetEmployeeRatingForNotInitiate(TransactionContext tc, ID pmpProcessId, PMPStatus status)
|
|
{
|
|
return tc.ExecuteDataSet("select EmployeeID,EmployeeNo,Name From Employee Where EMPLOYEEID not in (Select EMPLOYEEID From PMP_EmployeeRating Where PmpProcessID = %n And PmpStatus=%n)", pmpProcessId.Integer, status);
|
|
}
|
|
|
|
|
|
internal static void DeletePmpTargetSettingsByPMPId(ID id)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
internal static void DeletePmpTargetSettingsByPMPId(ID id, TransactionContext tc)
|
|
{
|
|
tc.ExecuteNonQuery("delete from PMP_TargetSetting Where pmpProcessId = %n", id.Integer);
|
|
}
|
|
|
|
internal static void DeletePmpValueBehaviorRatingByPMPI(ID id, TransactionContext tc)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
internal static void DeletePmpValueBehaviorRatingByPMPId(ID id, TransactionContext tc)
|
|
{
|
|
tc.ExecuteNonQuery("delete from PMP_ValueBehaviorRating where PmpProcessId = %n", id.Integer);
|
|
}
|
|
|
|
internal static void DeletePmpEmployeeRatingByPMPIDd(ID id, TransactionContext tc)
|
|
{
|
|
tc.ExecuteNonQuery("delete from PMP_EmployeeRating Where PMPProcessId = %n", id.Integer);
|
|
}
|
|
}
|
|
}
|