using HRM.BO; using Ease.Core.DataAccess; using System; using System.Collections.Generic; using System.Data; namespace HRM.DA { internal class SurveyEmployeeDA { #region Constructor private SurveyEmployeeDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, SurveyEmployee item) { tc.ExecuteNonQuery("INSERT INTO SurveyEmployee(SurveyID, EmployeeID,STARTTIME,CURRENTQUESTIONID,CANDIDATEID,ErCircularID,CURRENTTIME,SurveyParticipantDate,SurveyMark,SurveyTime,CompleteTime,IsCompleted)" + " VALUES(%n, %n,%D,%n,%n,%n,%n,%D,%n,%n,%D,%b)", item.SurveyID, item.EmployeeID,item.StartTime,item.CurrentQuestionID,item.CandidateID,item.ErCircularID, item.CurrentTime,item.SurveyParticipantDate,item.SurveyMark,item.SurveyTime,item.CompleteTime,item.IsCompleted); } #endregion #region Update function internal static void Update(TransactionContext tc, SurveyEmployee item) { tc.ExecuteNonQuery("UPDATE SurveyEmployee SET EmployeeID=%n," + " WHERE SurveyID=%n", item.EmployeeID, item.SurveyID); } #endregion #region Get Function public static IDataReader GetSurveyEmployee(TransactionContext tc, int nSurveyId) { return tc.ExecuteReader("SELECT * FROM SurveyEmployee WHERE SurveyId=%n", nSurveyId); } public static IDataReader GetSurveyEmployee(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM SurveyEmployee"); } public static IDataReader GetSurveyEmployeebycandidateId(TransactionContext tc, int nSurveyId,int candidateId,int erCircularId) { return tc.ExecuteReader("SELECT * FROM SurveyEmployee WHERE SurveyId=%n and candidateID=%n and erCircularId=%n ORDER BY CURRENTTIME desc", nSurveyId,candidateId, erCircularId); } public static IDataReader GetSurveyEmployeebycandidateId(TransactionContext tc, int nSurveyId, int candidateId) { return tc.ExecuteReader("SELECT * FROM SurveyEmployee WHERE SurveyId=%n and candidateID=%n ORDER BY CURRENTTIME desc", nSurveyId, candidateId); } public static IDataReader GetSurveyEmployeebyJobId(TransactionContext tc, int candidateId, int erCircularId) { return tc.ExecuteReader("SELECT * FROM SurveyEmployee WHERE candidateID=%n and erCircularId=%n ORDER BY CURRENTTIME desc",candidateId, erCircularId); } public static IDataReader GetCompleteExamByCandidate(TransactionContext tc, int candidateId, int erCircularId) { return tc.ExecuteReader("SELECT * FROM SurveyEmployee WHERE candidateID=%n and erCircularId=%n and IsCompleted=1 ORDER BY CURRENTTIME desc", candidateId, erCircularId); } #endregion public static void UpdateSurveyEmployee(TransactionContext tc, SurveyEmployee oItem) { //tc.ExecuteNonQuery("UPDATE SurveyEmployee SET AssessmentDate=%d WHERE SurveyId=%n" + //" and EmployeeId=%n", DataReader.GetNullValue(oItem.AssessmentDate), oItem.SurveyId, oItem.EmployeeId); } #region Delete function internal static void Delete(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM SurveyEmployee WHERE SurveyID=%n", nID); } public static void DeleteSurveyEmployee(TransactionContext tc, int nSurveyId) { tc.ExecuteNonQuery("DELETE FROM SurveyEmployee WHERE SurveyId=%n", nSurveyId); } public static void DeleteSurveyEmployeeByCandidateID(TransactionContext tc, int surveyId, int candidateid, int erCircularId) { tc.ExecuteNonQuery( "DELETE from SurveyEmployee where SurveyId=%n and candidateid=%n and erCircularId=%n", surveyId, candidateid, erCircularId); } #endregion } }