using System; using Payroll.BO; using System.Data; using System.Linq; using Ease.CoreV35.Model; using System.Data.SqlClient; using Ease.CoreV35.DataAccess; using System.Collections.Generic; using Ease.CoreV35.DataAccess.SQL; namespace Payroll.Service { internal class SurveyCategoryDA { #region Constructor private SurveyCategoryDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, SurveyCategory item) { tc.ExecuteNonQuery("INSERT INTO SurveyCategory(CategoryID,Code, Description, CreatedBy, CreationDate, Status)" + " VALUES(%n, %s, %s,%n, %d, %n)", item.ID.Integer, item.Code, item.Description, item.CreatedBy.Integer, item.CreatedDate, item.Status); } #endregion #region Update function internal static void Update(TransactionContext tc, SurveyCategory item) { tc.ExecuteNonQuery("UPDATE SurveyCategory SET Code=%s, Description=%s, ModifiedBy=%n, ModifiedDate=%d, Status=%n" + " WHERE CategoryID=%n", item.Code, item.Description, item.ModifiedBy.Integer, item.ModifiedDate, item.Status, item.ID.Integer); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc, EnumStatus status) { if (EnumStatus.Active == status || EnumStatus.Inactive == status) { return tc.ExecuteReader("SELECT * FROM SurveyCategory where Status=%n order by Description", status); } else { return tc.ExecuteReader("SELECT * FROM SurveyCategory order by Description"); } } internal static IDataReader Get(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM SurveyCategory WHERE CategoryID=%n", nID.Integer); } internal static IDataReader Get(TransactionContext tc, string sCode) { return tc.ExecuteReader("SELECT * FROM SurveyCategory WHERE Code=%s", sCode); } #endregion #region Delete function internal static void Delete(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM [SurveyCategory] WHERE CategoryID=%n", nID.Integer); } #endregion } }