79 lines
2.3 KiB
C#
79 lines
2.3 KiB
C#
using HRM.BO;
|
|
using Ease.Core.DataAccess;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
|
|
|
|
namespace HRM.DA
|
|
{
|
|
internal class QuestionCategoryDA
|
|
{
|
|
#region Constructor
|
|
|
|
private QuestionCategoryDA()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Insert function
|
|
|
|
internal static void Insert(TransactionContext tc, QuestionCategory item)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"INSERT INTO QuestionCategory(QuestionCategoryID,Code, Description, CreatedBy, CreationDate, Status)" +
|
|
" VALUES(%n, %s, %s,%n, %d, %n)", item.ID, item.Code, item.Description, item.CreatedBy,
|
|
item.CreatedDate, item.Status);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update function
|
|
|
|
internal static void Update(TransactionContext tc, QuestionCategory item)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"UPDATE QuestionCategory SET Code=%s, Description=%s, ModifiedBy=%n, ModifiedDate=%d, Status=%n" +
|
|
" WHERE QuestionCategoryID=%n", item.Code, item.Description, item.ModifiedBy, item.ModifiedDate,
|
|
item.Status, item.ID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Function
|
|
|
|
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
|
|
{
|
|
if (EnumStatus.Active == status || EnumStatus.Inactive == status)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM QuestionCategory where Status=%n order by Description", status);
|
|
}
|
|
else
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM QuestionCategory order by Description");
|
|
}
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int nID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM QuestionCategory WHERE QuestionCategoryID=%n", nID);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, string sCode)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM QuestionCategory WHERE Code=%s", sCode);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete function
|
|
|
|
internal static void Delete(TransactionContext tc, int nID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM QuestionCategory WHERE QuestionCategoryID=%n", nID);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |