EchoTex_Payroll/HRM.DA/DA/Recruitement/InterveiwSessionDA.cs
2024-10-14 10:01:49 +06:00

182 lines
9.8 KiB
C#

using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
namespace HRM.DA
{
public class InterviewSessionDA
{
internal static void Insert(InterviewSession item, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Insert Into InterViewSession(InterviewSessionID,requitementStepID, interviewDate,StartTime,
EndTime, Remarks,boardMemberSelfAssessment, CreatedDate,CreatedByID)
Values(%n, %n, %d, %D ,%D, %s, %b, %D, %n)", item.ID, item.requitementStepID, item.interviewDate,
item.StartTime, item.EndTime, item.Remarks, item.boardMemberSelfAssessment, item.CreatedDate, item.CreatedBy);
tc.ExecuteNonQuery(sql);
}
internal static void Update(InterviewSession item, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Update InterViewSession set interviewDate =%d ,StartTime =%D,
EndDate =%D, Remarks=%s, boardMemberSelfAssessment=%b, ModifiedDate = %D,ModifiedBy=%n, SessionStatus=%n where InterviewSessionID =%n
", item.interviewDate,
item.StartTime, item.EndTime, item.Remarks, item.boardMemberSelfAssessment, item.CreatedDate, item.CreatedBy, item.SessionStatus, item.ID);
tc.ExecuteNonQuery(sql);
}
internal static void InsertInterViewSessionCandidate(InterviewSessionCandidate item, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Insert Into InterViewSessionCandidate(PKID, requitementStepID,InterviewSessionID, CandidateID,participate,
InterviewDateTime, Remarks, CreatedDate,CreatedByID)
Values(%n, %n, %n ,%n, %b, %D,%s,%D,%n)", item.ID, item.requitementStepID,
item.InterViewSessionID, item.CandidateID, item.participate, item.InterviewDateTime, item.remarks, item.CreatedDate, item.CreatedBy);
tc.ExecuteNonQuery(sql);
}
internal static void UpdateInterViewSessionCandidate(InterviewSessionCandidate item, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Update InterViewSessionCandidate set participate =%b ,InterviewDateTime =%D,
Remarks=%s, ModifiedDate = %D,ModifiedBy=%n where PKID =%n
", item.participate,
item.InterviewDateTime, item.remarks, item.ModifiedDate, item.ModifiedBy, item.ID);
tc.ExecuteNonQuery(sql);
}
internal static void UpdateRescheduleDate(InterviewSession item, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Update InterViewSession set interviewDate =%D,
StartTime = %D where InterviewSessionID =%n
", item.interviewDate, item.StartTime, item.ID);
tc.ExecuteNonQuery(sql);
}
internal static void CancelInterviewSession(InterviewSession item, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Update InterViewSession set SessionStatus =%n where InterviewSessionID =%n
", EnumInterViewSesstionStatus.Cancelled, item.ID);
tc.ExecuteNonQuery(sql);
}
internal static void UpdateInterViewSessionCandidateSelection(InterviewSessionCandidate item, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Update InterViewSessionCandidate set isSelected =%b where PKID =%n
", item.isSelected,
item.ID);
tc.ExecuteNonQuery(sql);
}
internal static void DeleteInterviewSessionCandidate(InterviewSessionCandidate item, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Delete From InterViewSessionCandidate where PKID =%n
", item.ID);
tc.ExecuteNonQuery(sql);
}
internal static IDataReader getInterviewSessionCandidates(TransactionContext tc, int interviewSessionID)
{
string sql = SQLParser.MakeSQL(@"select I.*, c.cvid From InterViewSessionCandidate i, RECRUITEMENTCANDIDATE c where i.interviewSessionID =%n
and c.candidateid= i.candidateid ", interviewSessionID);
return tc.ExecuteReader(sql);
}
internal static IDataReader getInterviewSessionCandidatesReport(TransactionContext tc, int interviewSessionID)
{
string sql = SQLParser.MakeSQL(@"select I.*, c.cvid,ir.positionName From InterViewSessionCandidate i
Inner join RECRUITEMENTCANDIDATE c On c.candidateid= i.candidateid
Inner join RECRUITEMENTSTEP rs on rs.RECRUITEMENTSTEPID=i.requitementStepID
Inner join INTERNALREQRUITMENT ir on ir.positionID=rs.processId
where i.interviewSessionID =%n", interviewSessionID);
return tc.ExecuteReader(sql);
}
internal static IDataReader getSessionActiveCandidatesByStepID(TransactionContext tc, int interviewSessionID)
{
string sql = SQLParser.MakeSQL(@"select I.*, c.cvid From InterviewSession s, InterViewSessionCandidate i,
RECRUITEMENTCANDIDATE c where i.requitementStepID =%n
and c.candidateid= i.candidateid and s.requitementStepID = i.requitementStepID
and s.SessionStatus !=%n ", interviewSessionID, EnumInterViewSesstionStatus.Cancelled);
return tc.ExecuteReader(sql);
}
internal static IDataReader getSessionByStepID(TransactionContext tc, int stepid)
{
string sql = SQLParser.MakeSQL(@"select s.* From InterviewSession s where s.requitementStepID =%n
", stepid);
return tc.ExecuteReader(sql);
}
internal static IDataReader getselectedSessionsCandidates(TransactionContext tc, int StepID)
{
string sql = SQLParser.MakeSQL(@"select i.*, c.cvid From InterViewSessionCandidate i, RECRUITEMENTCANDIDATE c where i.requitementStepID =%n
and i.isSelected =%b and c.candidateid= i.candidateid ", StepID, true);
return tc.ExecuteReader(sql);
}
internal static IDataReader GetinterviewSessions(int requisitionID, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Select I.* From InterviewSession I, RECRUITEMENTSTEP R
Where R.RequisitionID = %n and I.requitementStepID = R.RECRUITEMENTSTEPID order by R.stepSerial", requisitionID);
return tc.ExecuteReader(sql);
}
internal static DataTable GetInterveiwSessionsByBoardMember(int memberorEmpID, EnumBaordMemberMarkEntryStatus markEntrystatus, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Select I.*, R.POSITIONNAME PositionName, StepStatus stepType, StartDate,EndDate,FullMark,
PassMark , b.employeeID, MarkEntryStatus From InterviewSession I, RECRUITEMENTBOARDMEMBER B,
InternalReqruitment R, RECRUITEMENTSTEP st
Where B.EmployeeId = %n and MarkEntryStatus=%n and R.PositionID = st.RequisitionID
and st.RECRUITEMENTSTEPID = I.requitementStepID AND
I.InterviewSessionID = B.InerviewSessionID ", memberorEmpID, markEntrystatus);
return tc.ExecuteDataTable(sql);
}
internal static IDataReader GetinterviewSession(int interviewSessionID, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Select I.* From InterviewSession I
Where I.InterviewSessionID = %n ", interviewSessionID);
return tc.ExecuteReader(sql);
}
internal static IDataReader GetinterviewSessionByRequisitionID(int requisitionid, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Select I.* From InterviewSession I, RECRUITEMENTSTEP s
Where i.requitementStepID = s.RECRUITEMENTSTEPID and s.RequisitionID = %n ", requisitionid);
return tc.ExecuteReader(sql);
}
internal static void CompleteInterviewSession(int interveiwSessionID, TransactionContext tc)
{
string sql =
SQLParser.MakeSQL(@"Update InterviewSession set SessionStatus=%n Where InterviewSessionID = %n ",
EnumInterViewSesstionStatus.Completed, interveiwSessionID);
tc.ExecuteNonQuery(sql);
}
internal static void Delete(int itemid, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Delete From InterViewSession Where InterviewSessionID = %n ",
itemid);
tc.ExecuteNonQuery(sql);
sql = SQLParser.MakeSQL(@"Delete From InterViewSessionCandidate Where InterviewSessionID = %n ",
itemid);
tc.ExecuteNonQuery(sql);
}
internal static DataTable GetInterViewInforBycandidateId(int candidateId, int jobId, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"select recstep.STEPSTATUS,insc.* from InterViewSessionCandidate insc
Inner Join InterViewSession ins on ins.InterviewSessionID=insc.InterviewSessionID
Inner join RECRUITEMENTSTEP recstep on insc.requitementStepID=recstep.RECRUITEMENTSTEPID
Inner join RECRUITEMENTCANDIDATE reccan on reccan.CANDIDATEID=insc.CandidateID
Inner join cv cv on cv.CVID=reccan.CVID
Inner join ErCV ercv on ercv.CVID=cv.ErCvID
Inner join ErAppliedApplicant era on era.UserID=ercv.UserID
Inner join ER_Circular er on era.jobId=er.ERCircularID and er.RecruitementID=reccan.PROCESSID
Where era.JobID=%n and ercv.UserID=%n", jobId, candidateId);
return tc.ExecuteDataTable(sql);
}
}
}