CEL_Payroll/Payroll.Service/Survey/DA/QuestionCategoryDA.cs

78 lines
2.4 KiB
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
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 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.Integer, item.Code, item.Description, item.CreatedBy.Integer, 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.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 QuestionCategory where Status=%n order by Description", status);
}
else
{
return tc.ExecuteReader("SELECT * FROM QuestionCategory order by Description");
}
}
internal static IDataReader Get(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("SELECT * FROM QuestionCategory WHERE QuestionCategoryID=%n", nID.Integer);
}
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, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM [QuestionCategory] WHERE QuestionCategoryID=%n", nID.Integer);
}
#endregion
}
}