using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using HRM.BO; using Ease.Core.DataAccess; using System.Data; namespace HRM.DA { internal class QuestionnaireDA { #region Insert function internal static void Insert(TransactionContext tc, Questionnaire item) { tc.ExecuteNonQuery( "INSERT INTO Questionnaire(QuestionnaireID, DESCRIPTION, COMPETENCYID, POINT, GRADEIDS, CREATEDBY, CREATIONDATE)" + " VALUES(%n, %s, %n, %n, %s, %n, %d)", item.ID, item.Description, item.CompetencyID, item.Point, item.GradeIDsInString, item.CreatedBy, item.CreatedDate); } #endregion #region Update function internal static void Update(TransactionContext tc, Questionnaire item) { string sql = string.Empty; sql = SQLParser.MakeSQL( @"UPDATE Questionnaire SET QuestionnaireID=%n, description=%s, COMPETENCYID=%n, POINT=%n, GRADEIDS=%s, ModifiedBy=%n, ModifiedDate=%d WHERE QuestionnaireID=%n", item.ID, item.Description, item.CompetencyID, item.Point, item.GradeIDsInString, item.ModifiedBy, item.ModifiedDate, item.ID); tc.ExecuteNonQuery(sql); } #endregion #region Delete function internal static void Delete(TransactionContext tc, int ID) { tc.ExecuteNonQuery("DELETE FROM Questionnaire WHERE QuestionnaireID=%n", ID); } #endregion #region Get function internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM Questionnaire order by CompetencyID,description"); } internal static IDataReader Get(TransactionContext tc, int ID) { return tc.ExecuteReader( @"SELECT * FROM Questionnaire WHERE QuestionnaireID=%n", ID); } //internal static IDataReader GetCompetencyID(TransactionContext tc, int qID) //{ // return tc.ExecuteReader( // @"SELECT * FROM Questionnaire WHERE CompetencyID=%n", qID); //} //internal static IDataReader Get(TransactionContext tc, EnumStatus status, int payrollTypeID) //{ // if (EnumStatus.Active == status || EnumStatus.Inactive == status) // { // return tc.ExecuteReader( // @"SELECT c.* FROM Competency c where c.status=%n and c.PayrollTypeID=%n order by c.Description", // status, payrollTypeID); // } // else // { // return tc.ExecuteReader( // @"SELECT c.* FROM Competency c Where c.PayrollTypeID=%n order by c.Description", payrollTypeID); // } //} #endregion Get function } }