162 lines
6.3 KiB
C#
162 lines
6.3 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Data.SqlClient;
|
|
using Ease.CoreV35.DataAccess;
|
|
using System.Collections.Generic;
|
|
using Ease.Core.DataAccess;
|
|
using HRM.BO;
|
|
|
|
namespace HRM.DA
|
|
{
|
|
#region PeerAppraisalDA
|
|
|
|
internal class PeerAppraisalDA
|
|
{
|
|
#region Constructor
|
|
|
|
private PeerAppraisalDA()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Insert function
|
|
|
|
internal static void Insert(TransactionContext tc, PeerAppraisal item)
|
|
{
|
|
string sql = SQLParser.MakeSQL("INSERT INTO PeerAppraisal(CREATEDBY," +
|
|
"CREATIONDATE," +
|
|
"PeerAppraisalID," +
|
|
"EMPLOYEEID," +
|
|
"PMPYearID," +
|
|
"AppraiserID," +
|
|
"Competency," +
|
|
"Cooparation," +
|
|
"Resourcefulness," +
|
|
"Productivity," +
|
|
"Leadership," +
|
|
"OverallRating," +
|
|
"Remarks," +
|
|
"AppraisalDate," +
|
|
"MODIFIEDBY," +
|
|
"MODIFIEDDATE)" +
|
|
" VALUES(%n,%d, %n, %n, %n, %n, %n, %n, %n, %n,%n, %n, %s,%d, %n, %d)",
|
|
//User.CurrentUser.ID,
|
|
1, // temporarily defult value is given, we will have to change while working
|
|
DateTime.Now, item.ID, item.EmployeeID, item.PMPYearID, item.AppraiserID,
|
|
item.Competency, item.Cooparation, item.Resourcefulness, item.Productivity, item.Leadership,
|
|
item.OverallRating, item.Remarks, DataReader.GetNullValue(DateTime.Now),
|
|
DataReader.GetNullValue(item.ModifiedBy), DataReader.GetNullValue(item.ModifiedDate));
|
|
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update function
|
|
|
|
internal static void Update(TransactionContext tc, PeerAppraisal item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"Update PeerAppraisal SET
|
|
CREATEDBY = %n
|
|
,CREATIONDATE = %d
|
|
,EmployeeID = %n
|
|
,PMPYearID = %n
|
|
,AppraiserID = %n
|
|
,Competency = %n
|
|
,Cooparation = %n
|
|
,Resourcefulness = %n
|
|
,Productivity = %n
|
|
,Leadership = %n
|
|
,OverallRating = %n
|
|
,Remarks = %s
|
|
,AppraisalDate = %d
|
|
,MODIFIEDBY = %n
|
|
,MODIFIEDDATE = %d
|
|
WHERE PeerAppraisalID = %n",
|
|
DataReader.GetNullValue(item.CreatedBy), DataReader.GetNullValue(item.CreatedDate),
|
|
DataReader.GetNullValue(item.EmployeeID), DataReader.GetNullValue(item.PMPYearID),
|
|
DataReader.GetNullValue(item.AppraiserID),
|
|
item.Competency, item.Cooparation, item.Resourcefulness, item.Productivity, item.Leadership,
|
|
item.OverallRating, item.Remarks, DataReader.GetNullValue(DateTime.Now),
|
|
DataReader.GetNullValue(item.ModifiedBy), DataReader.GetNullValue(item.ModifiedDate),
|
|
DataReader.GetNullValue(item.ID));
|
|
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Function
|
|
|
|
internal static IDataReader Get(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM PeerAppraisal");
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int EmployeeID, int AppraisalID, int PMPYearID)
|
|
{
|
|
return tc.ExecuteReader(
|
|
"SELECT * FROM PeerAppraisal WHERE EmployeeID = %n and AppraiserID = %n and PMPYearID = %n", EmployeeID,
|
|
AppraisalID, PMPYearID);
|
|
}
|
|
|
|
internal static IDataReader GetByEmpIdAppraiserId(TransactionContext tc, int EmployeeID, int AppraisalID,
|
|
int PmpYearID)
|
|
{
|
|
return tc.ExecuteReader(
|
|
"SELECT * FROM PeerAppraisal WHERE EmployeeID = %n and AppraiserID = %n and PMPYearID = %n", EmployeeID,
|
|
AppraisalID, PmpYearID);
|
|
}
|
|
|
|
internal static IDataReader GetByAppraiserId(TransactionContext tc, int AppraisalID, int PMPYearID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM PeerAppraisal WHERE AppraiserID = %n and PMPYearID = %n",
|
|
AppraisalID, PMPYearID);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int nID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM PeerAppraisal WHERE PeerAppraisalID=%n", nID);
|
|
}
|
|
|
|
internal static IDataReader GetByPmpYearId(TransactionContext tc, int pmpYearId)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM PeerAppraisal WHERE PMPYearID=%n", pmpYearId);
|
|
}
|
|
|
|
internal static IDataReader GetByEmployeeID(TransactionContext tc, int nID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM PeerAppraisal WHERE EmployeeID=%n", nID);
|
|
}
|
|
|
|
internal static IDataReader GetEmployeeByPeerAppraisalsEmpId(TransactionContext tc, int nID, int pmpYearID)
|
|
{
|
|
string sql =
|
|
SQLParser.MakeSQL(
|
|
"SELECT * FROM EMPLOYEE WHERE EMPLOYEEID IN (SELECT p.AppraiserID FROM PeerAppraisal p WHERE p.EmployeeID = %n and p.PMPYearID = %n)",
|
|
nID, pmpYearID);
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
|
|
#region Delete function
|
|
|
|
internal static void Delete(TransactionContext tc, int nID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM PeerAppraisal WHERE PeerAppraisalID=%n", nID);
|
|
}
|
|
|
|
internal static void Delete(TransactionContext tc, int pmpYearId, int employeeForId)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM PeerAppraisal WHERE EMPLOYEEID=%n AND PMPYearID=%n", employeeForId,
|
|
pmpYearId);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
} |