CEL_Payroll/Payroll.Service/Recruitement/DA/RecruitementStepDA.cs

120 lines
5.5 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Ease.CoreV35.DataAccess;
using Ease.CoreV35.Model;
using Payroll.BO;
namespace Payroll.Service
{
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,ProcessId,StartDate,EndDate,MeetingTime,FullMark,
PassMark,StepStatus,TypeID,stepSerial,TopSelect,AssesmentStatus) Values(%n,%n,%d,%d,%s,%n,%n,%n,%n,%n,%n,%n)", obRecrStep.ID.Integer, obRecrStep.ProcessId.Integer,
obRecrStep.StartDate, DataReader.GetNullValue(endTime), obRecrStep.MeetingTime, obRecrStep.FullMark, obRecrStep.PassMark, obRecrStep.StepStatus, DataReader.GetNullValue(obRecrStep.Type, IDType.Integer), 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,MeetingTime=%s,FullMark = %n,
PassMark = %n,StepStatus = %n,TypeID = %n,stepSerial = %n,TopSelect=%n,AssesmentStatus=%n Where RecruitementStepID = %n",
obRecrStep.ProcessId.Integer, obRecrStep.StartDate, DataReader.GetNullValue(endTime), obRecrStep.MeetingTime,
obRecrStep.FullMark, obRecrStep.PassMark, obRecrStep.StepStatus, DataReader.GetNullValue(obRecrStep.Type, IDType.Integer), obRecrStep.StepSerial, obRecrStep.TopSelect, obRecrStep.AssesmentStatus, obRecrStep.ID.Integer);
tc.ExecuteNonQuery(sql);
}
internal static void Delete(ID stepid, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Delete From RecruitementStep Where RecruitementStepID = %n", stepid.Integer);
tc.ExecuteNonQuery(sql);
}
internal static void Delete(ID processID, ID stepid, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Delete From RecruitementStep Where RecruitementStepID = %n And ProcessId = %n", stepid.Integer, processID.Integer);
tc.ExecuteNonQuery(sql);
}
internal static void Delete(TransactionContext tc, ID oID)
{
string sql = SQLParser.MakeSQL(@"Delete From RecruitementStep Where ProcessId = %n", oID.Integer);
tc.ExecuteNonQuery(sql);
}
internal static IDataReader Get(TransactionContext tc, ID processID)
{
string sql = SQLParser.MakeSQL(@"Select * From RecruitementStep Where ProcessId = %n order by RecruitementStepID", processID.Integer);
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(ID processID, int serial, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Select * From RecruitementStep Where ProcessId = %n And stepSerial = %n", processID.Integer, serial);
return tc.ExecuteReader(sql);
}
internal static IDataReader Get(ID processID, ID stepID, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Select * From RecruitementStep Where ProcessId = %n And RecruitementStepID = %n", processID.Integer, stepID.Integer);
return tc.ExecuteReader(sql);
}
internal static IDataReader GetAllSteps(ID processID, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Select * From RecruitementStep Where ProcessId = %n", processID.Integer);
return tc.ExecuteReader(sql);
}
internal static void DeleteStep(TransactionContext tc, ID stepID)
{
string sql = SQLParser.MakeSQL(@"Delete From RecruitementStep Where RecruitementStepID = %n", stepID.Integer);
tc.ExecuteNonQuery(sql);
}
internal static IDataReader Get(ID processID, int StepStatus, int assessmentStatus, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Select * From RecruitementStep Where ProcessId = %n And StepStatus= %n AND AssesmentStatus=%n ", processID.Integer, StepStatus, assessmentStatus);
return tc.ExecuteReader(sql);
}
internal static IDataReader GetRStep(TransactionContext tc, ID stepID)
{
string sql = SQLParser.MakeSQL(@"Select * From RecruitementStep Where RecruitementStepID = %n ", stepID.Integer);
return tc.ExecuteReader(sql);
}
}
}