using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { public class RecruitementSelectedCandidateDA { internal static IDataReader GetAllSelectedCandidates(int processID, int stepID, TransactionContext tc) { string sql = SQLParser.MakeSQL(@"Select * From RECRUITEMENTSELECTEDCANDIDATE Where processID = %n And stepID = %n", processID, stepID); return tc.ExecuteReader(sql); } internal static IDataReader GetSelectedCandidates(int stepID, TransactionContext tc) { string sql = SQLParser.MakeSQL(@"Select r.*,c.cvid From RECRUITEMENTSELECTEDCANDIDATE r, RECRUITEMENTCANDIDATE c Where c.candidateid = r.candidateid and r.stepID = %n", stepID); return tc.ExecuteReader(sql); } internal static void Delete(int stepID, int processID, TransactionContext tc) { string sql = SQLParser.MakeSQL(@"Delete From RECRUITEMENTSELECTEDCANDIDATE Where processID = %n And stepID = %n", processID, stepID); tc.ExecuteNonQuery(sql); } internal static void Insert(SelectedCandidate item, TransactionContext tc) { string sql = SQLParser.MakeSQL( @"Insert Into RECRUITEMENTSELECTEDCANDIDATE(PKID,processID,stepID,candidateID,isEmployee,isSelected) Values(%n,%n,%n,%n,%n,%n)", item.ID, item.ProcessId, item.StepId, item.CandidateId, Convert.ToInt32(item.IsEmployee), Convert.ToInt32(item.IsSelected)); tc.ExecuteNonQuery(sql); } internal static IDataReader GetAllSelectedCandidates(int processID, int stepID, bool flag, TransactionContext tc) { string sql; if (flag) sql = SQLParser.MakeSQL( @"Select * From RECRUITEMENTSELECTEDCANDIDATE Where processID = %n And stepID = %n And isSelected = 1", processID, stepID); else sql = SQLParser.MakeSQL( @"Select * From RECRUITEMENTSELECTEDCANDIDATE Where processID = %n And stepID = %n", processID, stepID); return tc.ExecuteReader(sql); } internal static void Delete(int processID, int canID, bool p, TransactionContext tc) { string sql = SQLParser.MakeSQL( @"Delete From RECRUITEMENTSELECTEDCANDIDATE Where processID = %n And candidateID = %n And isEmployee = %n", processID, canID, Convert.ToInt32(p)); tc.ExecuteNonQuery(sql); } } }