EchoTex_Payroll/HRM.DA/DA/PMP/ObjectiveCategoryDA.cs

60 lines
2.3 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
namespace HRM.DA
{
class ObjectiveCategoryDA
{
internal static IDataReader Get(TransactionContext tc)
{
string sql = SQLParser.MakeSQL("SELECT * FROM ObjectiveCategory");
return tc.ExecuteReader(sql);
}
internal static IDataReader Get(TransactionContext tc, int id)
{
string sql = SQLParser.MakeSQL("SELECT * FROM ObjectiveCategory WHERE ObjectiveCategoryID = %n", id);
return tc.ExecuteReader(sql);
}
internal static IDataReader GetByPMPyear(TransactionContext tc, int id)
{
string sql = SQLParser.MakeSQL("SELECT * FROM ObjectiveCategory WHERE PMPYearID = %n", id);
return tc.ExecuteReader(sql);
}
internal static void Save(TransactionContext tc, ObjectiveCategory item)
{
string sql = SQLParser.MakeSQL(
"Insert Into ObjectiveCategory(ObjectiveCategoryID,Description,Category,PMPYearID,CreatedBy,CreationDate,Status, ObjectiveTypeID) Values(%n,%s,%n,%s,%n,%d,%n, %n)",
item.ID, item.Description, (int)item.Category, item.PMPYearID, item.CreatedBy, item.CreatedDate,
item.Status, item.ObjectiveTypeID);
tc.ExecuteNonQuery(sql);
}
internal static void Update(TransactionContext tc, ObjectiveCategory item)
{
string sql = SQLParser.MakeSQL(
"Update ObjectiveCategory Set Description = %s ,Category=%n,PMPYearID=%n, ModifiedBy = %n, ModifiedDate = %d, ObjectiveTypeID=%n, Status = %n Where ObjectiveCategoryID = %n",
item.Description, (int)item.Category, item.PMPYearID, item.ModifiedBy, item.ModifiedDate, item.ObjectiveTypeID,
(int)item.Status, item.ID);
tc.ExecuteNonQuery(sql);
}
internal static void Delete(TransactionContext tc, int id)
{
string sql = SQLParser.MakeSQL("Delete From ObjectiveCategory Where ObjectiveCategoryID = %n", id);
tc.ExecuteNonQuery(sql);
}
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
{
string sql = SQLParser.MakeSQL("SELECT * FROM ObjectiveCategory where status = %n", status);
return tc.ExecuteReader(sql);
}
}
}