EchoTex_Payroll/HRM.DA/DA/Recruitement/RecruitementStepDA.cs

178 lines
7.7 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
namespace HRM.DA
{
public class RecruitementStepDA
{
internal static void Insert(RecruitementStep obRecrStep, TransactionContext tc)
{
DateTime? endTime;
if (obRecrStep.EndDate == DateTime.MinValue)
{
endTime = null;
}
else
{
endTime = obRecrStep.EndDate;
}
string sql = SQLParser.MakeSQL(
@"Insert Into RECRUITEMENTSTEP(RECRUITEMENTSTEPID, RequisitionID, ProcessId,StartDate,EndDate,FullMark,
PassMark,StepStatus,stepSerial,TopSelect,AssesmentStatus)
Values(%n, %n, %n,%d,%d,%n,%n,%n,%n,%n,%n)",
obRecrStep.ID, obRecrStep.requisitionID, obRecrStep.ProcessId,
obRecrStep.StartDate, DataReader.GetNullValue(endTime), obRecrStep.FullMark,
obRecrStep.PassMark, obRecrStep.stepType,
obRecrStep.StepSerial, obRecrStep.TopSelect, obRecrStep.AssesmentStatus);
tc.ExecuteNonQuery(sql);
}
internal static void Update(RecruitementStep obRecrStep, TransactionContext tc)
{
DateTime? endTime;
if (obRecrStep.EndDate == DateTime.MinValue)
{
endTime = null;
}
else
{
endTime = obRecrStep.EndDate;
}
string sql = SQLParser.MakeSQL(@"Update RECRUITEMENTSTEP Set ProcessId = %n,
StartDate = %d,EndDate = %d,FullMark = %n,
PassMark = %n,StepStatus = %n,stepSerial = %n,TopSelect=%n,AssesmentStatus=%n Where RECRUITEMENTSTEPID = %n",
obRecrStep.ProcessId, obRecrStep.StartDate, DataReader.GetNullValue(endTime),
obRecrStep.FullMark, obRecrStep.PassMark, obRecrStep.stepType,
obRecrStep.StepSerial, obRecrStep.TopSelect,
obRecrStep.AssesmentStatus, obRecrStep.ID);
tc.ExecuteNonQuery(sql);
}
internal static void Delete(int stepid, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Delete From RECRUITEMENTSTEP Where RECRUITEMENTSTEPID = %n", stepid);
tc.ExecuteNonQuery(sql);
}
internal static void Delete(int processID, int stepid, TransactionContext tc)
{
string sql =
SQLParser.MakeSQL(@"Delete From RECRUITEMENTSTEP Where RECRUITEMENTSTEPID = %n And ProcessId = %n",
stepid, processID);
tc.ExecuteNonQuery(sql);
}
internal static void Delete(TransactionContext tc, int oID)
{
string sql = SQLParser.MakeSQL(@"Delete From RECRUITEMENTSTEP Where ProcessId = %n", oID);
tc.ExecuteNonQuery(sql);
}
internal static IDataReader Get(TransactionContext tc, int processID)
{
string sql =
SQLParser.MakeSQL(@"Select * From RECRUITEMENTSTEP Where ProcessId = %n order by RECRUITEMENTSTEPID",
processID);
return tc.ExecuteReader(sql);
}
internal static IDataReader GetRecruitmentStep(TransactionContext tc, int processID)
{
string sql =
SQLParser.MakeSQL(@"Select * From RECRUITEMENTSTEP Where RECRUITEMENTSTEPID = %n order by RECRUITEMENTSTEPID",
processID);
return tc.ExecuteReader(sql);
}
internal static IDataReader GetByAssesmentStatus(TransactionContext tc, int nAssesmentStatus, int nEmpID)
{
string sql = SQLParser.MakeSQL(@"Select * From RECRUITEMENTSTEP Where AssesmentStatus=%n and
ProcessId IN(select ProcessId from RecruitementBoardMember where EmployeeId=%n) order by RECRUITEMENTSTEPID",
nAssesmentStatus, nEmpID);
return tc.ExecuteReader(sql);
}
internal static IDataReader Get(int processID, int serial, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Select * From RECRUITEMENTSTEP Where ProcessId = %n And stepSerial = %n",
processID, serial);
return tc.ExecuteReader(sql);
}
internal static IDataReader GetWithProcessID(int processID, int stepID, TransactionContext tc)
{
string sql =
SQLParser.MakeSQL(@"Select * From RECRUITEMENTSTEP Where ProcessId = %n And RECRUITEMENTSTEPID = %n",
processID, stepID);
return tc.ExecuteReader(sql);
}
internal static IDataReader GetRecruitementSteps(int recruitementID, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Select * From RECRUITEMENTSTEP Where RequisitionID = %n order by stepSerial", recruitementID);
return tc.ExecuteReader(sql);
}
internal static void DeleteStep(TransactionContext tc, int stepID)
{
string sql = SQLParser.MakeSQL(@"Delete From RECRUITEMENTSTEP Where RECRUITEMENTSTEPID = %n", stepID);
tc.ExecuteNonQuery(sql);
}
internal static IDataReader Get(int processID, int StepStatus, int assessmentStatus, TransactionContext tc)
{
string sql =
SQLParser.MakeSQL(
@"Select * From RECRUITEMENTSTEP Where ProcessId = %n And StepStatus= %n AND AssesmentStatus=%n ",
processID, StepStatus, assessmentStatus);
return tc.ExecuteReader(sql);
}
internal static void CompleteRecruitementStep(int StepiD, TransactionContext tc)
{
string sql =
SQLParser.MakeSQL(@"Update RECRUITEMENTSTEP set AssesmentStatus=%n Where RECRUITEMENTSTEPID = %n ",
EnumAssesmentStatus.Complete, StepiD);
tc.ExecuteNonQuery(sql);
}
internal static IDataReader GetRStep(TransactionContext tc, int stepID)
{
string sql = SQLParser.MakeSQL(@"Select * From RECRUITEMENTSTEP Where RECRUITEMENTSTEPID = %n ", stepID);
return tc.ExecuteReader(sql);
}
internal static IDataReader GetRStep(TransactionContext tc, int recruitementid, int stepSerial)
{
string sql = SQLParser.MakeSQL(@"Select * From RECRUITEMENTSTEP Where RequisitionID = %n and "
+ " stepSerial =%n ", recruitementid, stepSerial);
return tc.ExecuteReader(sql);
}
internal static DataSet GetCandidateAverageMarks(TransactionContext tc, string candidateIDs)
{
string sql = SQLParser.MakeSQL(
@"Select CandidateID,stepstatus,AVG(rm.Marks) AverageMarks From RECRUITEMENTSTEP rs" +
" Inner Join RECRUITEMENTMEMBERWISEMARK rm on rs.RECRUITEMENTSTEPID=rm.stepid" +
" Where ASSESMENTSTATUS =%n and candidateID in (%q) Group By candidateID,stepstatus"
, (int)EnumAssesmentStatus.Complete, candidateIDs);
return tc.ExecuteDataSet(sql);
}
internal static DataSet GetCandidateMarksDetails(TransactionContext tc, int candidateID)
{
string sql = SQLParser.MakeSQL(
@"Select em.Name,rs.stepstatus,rm.* From RECRUITEMENTSTEP rs" +
" Inner join RECRUITEMENTMEMBERWISEMARK rm on rs.RECRUITEMENTSTEPID=rm.stepid" +
" Inner join Employee em on rm.EmployeeID=em.employeeID" +
" Where ASSESMENTSTATUS =%n and candidateID=%n Order by stepstatus,stepserial"
, (int)EnumAssesmentStatus.Complete, candidateID);
return tc.ExecuteDataSet(sql);
}
}
}