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 CandidateDA { internal static void Insert(Candidate obCan, TransactionContext tc) { int? cvId = null; if (obCan.CvId != null && !obCan.CvId.IsUnassigned) { cvId = obCan.CvId.Integer; } int? empID = null; if (obCan.EmployeeId != null && !obCan.EmployeeId.IsUnassigned) { empID = obCan.EmployeeId.Integer; } DateTime? strdate = null; if (obCan.StartDate == DateTime.MinValue) strdate = null; else { strdate = obCan.StartDate; } string sql = SQLParser.MakeSQL(@"Insert Into RecruitementCandidate(StartTime,StartDate,CandidateID,ProcessId, IsEmployee,CvId,EmployeeId,IsSelected) Values(%s,%d,%n,%n,%n,%n,%n,%n)",DataReader.GetNullValue(obCan.StartTime), DataReader.GetNullValue(strdate),obCan.ID.Integer, obCan.ProcessId.Integer, Convert.ToInt32(obCan.IsEmployee), DataReader.GetNullValue(cvId), DataReader.GetNullValue(empID),Convert.ToInt32(obCan.IsSelected)); tc.ExecuteNonQuery(sql); } internal static void Update(Candidate obCan, TransactionContext tc) { string sql = SQLParser.MakeSQL(@"Update RecruitementCandidate Set ProcessId = %n,IsEmployee = %n, CvId = %n,EmployeeId = %n ,IsSelected = %n Where CandidateID = %n", obCan.ProcessId.Integer, Convert.ToInt32(obCan.IsEmployee), obCan.CvId.Integer, obCan.EmployeeId.Integer, obCan.ID.Integer, Convert.ToInt32(obCan.IsSelected)); tc.ExecuteNonQuery(sql); } internal static void Delete(ID id, TransactionContext tc) { string sql = SQLParser.MakeSQL(@"Delete From RecruitementCandidate Where CandidateID = %n", id.Integer); tc.ExecuteNonQuery(sql); } internal static void Delete(TransactionContext tc, ID processID) { string sql = SQLParser.MakeSQL(@"Delete From RecruitementCandidate Where ProcessId = %n", processID.Integer); tc.ExecuteNonQuery(sql); } internal static IDataReader GetCanditates(TransactionContext tc, ID processID) { string sql = SQLParser.MakeSQL(@"Select * From RecruitementCandidate Where ProcessId = %n",processID.Integer); return tc.ExecuteReader(sql); } internal static IDataReader GetCanditates(TransactionContext tc, ID processID, int assessmentStatus, int logInID) { string sql = SQLParser.MakeSQL(@"Select * From RecruitementCandidate Where ProcessId = %n", processID.Integer); return tc.ExecuteReader(sql); } } }