105 lines
4.8 KiB
C#
105 lines
4.8 KiB
C#
|
using HRM.BO;
|
|||
|
using Ease.Core.DataAccess;
|
|||
|
using System;
|
|||
|
using System.Data;
|
|||
|
|
|||
|
|
|||
|
namespace HRM.DA
|
|||
|
{
|
|||
|
class ObjectiveCategoryGradesDA
|
|||
|
{
|
|||
|
internal static IDataReader Get(TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL("SELECT * FROM ObjectiveCategoryGrades");
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, int nPmpyearID, int nCategory)
|
|||
|
{
|
|||
|
string sql =
|
|||
|
SQLParser.MakeSQL(
|
|||
|
"Select * from objectivecategorygrades where objectivecategoryid in(select objectivecategoryid from objectivecategory where pmpyearid=%n and category=%n)",
|
|||
|
nPmpyearID, nCategory);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetByPMPYear(TransactionContext tc, int nPmpyearID)
|
|||
|
{
|
|||
|
string sql =
|
|||
|
SQLParser.MakeSQL(
|
|||
|
"select * from objectivecategorygrades where objectivecategoryid in(select objectivecategoryid from objectivecategory where pmpyearid=%n)",
|
|||
|
nPmpyearID);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetByGradeId(TransactionContext tc, int gradeId, int pmpYearId)
|
|||
|
{
|
|||
|
string sql =
|
|||
|
SQLParser.MakeSQL(
|
|||
|
@"SELECT * FROM OBJECTIVECATEGORYGRADES WHERE OBJECTIVECATEGORYID IN (SELECT OBJECTIVECATEGORYID FROM OBJECTIVECATEGORY
|
|||
|
WHERE PMPYEARID= %n) and GRADEID = %n", pmpYearId, gradeId);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetByEmpTier(TransactionContext tc, int empID, int nPmpyearID)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(
|
|||
|
@"SELECT OCG.* FROM ORGANEMPLOYEE OE,ORGANOGRAM O, OBJECTIVECATEGORYGRADES OCG, OBJECTIVECATEGORY OC
|
|||
|
WHERE OE.NODEID=O.ORGANOGRAMID AND O.TIER=OCG.TIER AND OCG.OBJECTIVECATEGORYID=OC.OBJECTIVECATEGORYID
|
|||
|
AND OC.PMPYEARID=%n AND OE.EmployeeID=%n AND OCG.Percent>0", nPmpyearID, empID);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL("SELECT * FROM ObjectiveCategoryGrades WHERE ObjectiveCategoryGradesID = %n",
|
|||
|
id);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static void Save(TransactionContext tc, ObjectiveCategoryGrades item)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(
|
|||
|
"Insert Into ObjectiveCategoryGrades(ObjectiveCategoryGradesID, ObjectiveType, ObjectiveCategoryID, GradeID,Tier, [Percent] ,OBMOSRequired,DPMOSRequired) Values(%n, %n, %n, %n,%n, %n,%b,%b)",
|
|||
|
item.ID, (int) item.ObjectiveType, item.ObjectiveCategoryID, DataReader.GetNullValue(item.GradeID),
|
|||
|
item.Tier, (double) item.Percent, item.OBMOSRequired, item.DPMOSRequired);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static void Update(TransactionContext tc, ObjectiveCategoryGrades item)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(
|
|||
|
"Update ObjectiveCategoryGrades Set ObjectiveType = %n, ObjectiveCategoryID = %n, GradeID = %n,Tier = %n, Percent = %n OBMOSRequired=%b,DPMOSRequired=%b Where ObjectiveCategoryGradesID = %n",
|
|||
|
(int) item.ObjectiveType, item.ObjectiveCategoryID, item.GradeID, item.Tier, item.Percent,
|
|||
|
item.OBMOSRequired, item.DPMOSRequired, item.ID);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static void Delete(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL("Delete From ObjectiveCategoryGrades Where ObjectiveCategoryGradesID = %n",
|
|||
|
id);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static void DeleteByPMPYearID(TransactionContext tc, int id, EnumObjectiveCategory oCategory,
|
|||
|
int ObjTypeID)
|
|||
|
{
|
|||
|
string sql =
|
|||
|
SQLParser.MakeSQL(
|
|||
|
"delete from objectivecategorygrades where objectivecategoryid in(select objectivecategoryid from objectivecategory where pmpyearid=%n and Category=%n) AND ObjectiveType=%n",
|
|||
|
id, (int) oCategory, ObjTypeID);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
sql = SQLParser.MakeSQL(
|
|||
|
"delete from objectivecategory where pmpyearid=%n and Category=%n AND objectivecategoryID in(Select objectivecategoryID from objectivecategorygrades where ObjectiveType=%n) ",
|
|||
|
id, (int) oCategory, ObjTypeID);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetObjectiveCategoryGrades(TransactionContext tc, int iD)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL("SELECT * FROM ObjectiveCategoryGrades WHERE ObjectiveCategoryID = %n", iD);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|