129 lines
5.7 KiB
C#
129 lines
5.7 KiB
C#
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(SurveyEmployeeID, SURVEYID, surveyType, participantID,participantUserID,ReferenceID,STARTTIME," +
|
|
" LastUpdateTime,SpendTime,CurrentQuestionID,SurveyMark,PassMark,ReceiveMark," +
|
|
" CompleteTime,IsCompleted,IsCancel, CancelReason, CancelDate,CreatedBy,CreatedDate)" +
|
|
" VALUES(%n, %n, %n, %n, %n,%n,%D," +
|
|
"%D,%n,%n,%n,%n, %n, " +
|
|
" %D, %n, %n, %s, %D, %n, %D)",
|
|
item.ID, item.SurveyID, item.surveyType, item.participantID,item.participantUserID, item.ReferenceID, item.StartTime,
|
|
item.lastUpdateTime,item.SpendTime, item.CurrentQuestionID,item.SurveyMark,item.PassMark,item.ReceiveMark,
|
|
item.CompleteTime,item.IsCompleted, item.IsCancel, item.CancelReason, item.CancelDate, item.CreatedBy
|
|
, item.CreatedDate);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update function
|
|
|
|
internal static void Update(TransactionContext tc, SurveyEmployee item)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE SurveyEmployee SET " +
|
|
" LastUpdateTime =%D,SpendTime =%n,CurrentQuestionID =%n,SurveyMark=%n,PassMark=%n,ReceiveMark=%n," +
|
|
" CompleteTime=%D,IsCompleted=%n,ModifiedBy=%n,ModifiedDate=%D" +
|
|
" Where SurveyEmployeeID=%n"
|
|
, item.lastUpdateTime, item.SpendTime, item.CurrentQuestionID, item.SurveyMark, item.PassMark,
|
|
item.ReceiveMark, item.CompleteTime, item.IsCompleted, item.ModifiedBy, item.ModifiedDate,item.ID);
|
|
}
|
|
internal static void UpdateSpendTime(TransactionContext tc, SurveyEmployee item)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE SurveyEmployee SET " +
|
|
" LastUpdateTime =%D,SpendTime =%n" +
|
|
" " +
|
|
" Where SurveyEmployeeID=%n"
|
|
, item.lastUpdateTime, item.SpendTime, item.ID);
|
|
}
|
|
|
|
internal static void Cancel(TransactionContext tc, SurveyEmployee item)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE SurveyEmployee SET " +
|
|
" IsCancel =%n,CancelReason =%D,CancelDate =%D, ModifiedBy=%n,ModifiedDate=%D" +
|
|
" Where SurveyEmployeeID=%n"
|
|
, item.IsCancel, item.CancelReason, item.CancelDate, item.ModifiedBy, item.ModifiedDate, item.ID);
|
|
}
|
|
|
|
#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 GetNotCompletedSurveyByparticipentID(TransactionContext tc, int nSurveyId, int participentID, int referenceID)
|
|
{
|
|
return tc.ExecuteReader("SELECT Top 1 * FROM SurveyEmployee WHERE SurveyId=%n and participantID=%n and ReferenceID=%n ORDER BY STARTTIME DESC", nSurveyId, participentID, referenceID);
|
|
}
|
|
|
|
public static IDataReader GetSurveyEmployeebycandidateId(TransactionContext tc, int nSurveyId, int candidateId)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM SurveyEmployee WHERE SurveyId=%n and participantID=%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
|
|
}
|
|
} |