CEL_Payroll/Payroll.Service/TrainingS/DA/TrainingCostHeadDA.cs
2024-09-17 14:30:13 +06:00

59 lines
1.9 KiB
C#

using System;
using System.Data;
using Ease.CoreV35.DataAccess;
using Ease.CoreV35.Model;
using Payroll.BO;
namespace Payroll.Service
{
class TrainingCostHeadDA
{
#region Get Function
public static IDataReader Get(TransactionContext tc, int id)
{
return tc.ExecuteReader("SELECT * from TrainingCostHead WHERE TrainingCostHeadID=%n", id);
}
public static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * from TrainingCostHead");
}
#endregion
#region Insert Function
public static void Insert(TransactionContext tc, TrainingCostHead oItem)
{
tc.ExecuteNonQuery("INSERT INTO TrainingCostHead(TrainingCostHeadID, CODE, Name,CREATEDBY,CREATEDDATE)" +
" VALUES(%n,%s,%s,%n,%d)", oItem.ID.Integer, oItem.Code, oItem.Name, DataReader.GetNullValue(oItem.CreatedBy.Integer), DataReader.GetNullValue(oItem.CreatedDate));
}
#endregion
#region Update Function
public static void Update(TransactionContext tc, TrainingCostHead oItem)
{
tc.ExecuteNonQuery("UPDATE TrainingCostHead SET CODE=%s,Name=%s,MODIFIEDBY=%n,MODIFIEDDATE=%d" +
" WHERE TrainingCostHeadID=%n", oItem.Code, oItem.Name, DataReader.GetNullValue(oItem.ModifiedBy.Integer), DataReader.GetNullValue(oItem.ModifiedDate), oItem.ID.Integer);
}
#endregion
#region Delete Function
public static void Delete(TransactionContext tc, int id)
{
tc.ExecuteNonQuery("Delete from TrainingCostHead where TrainingCostHeadID=%n", id);
}
#endregion
public static bool IsExists(string TableName, string ColName, string sCode, TransactionContext tc)
{
object ob = tc.ExecuteScalar("SELECT COUNT(*) FROM " + TableName + " WHERE " + ColName + "=%s", sCode);
return (Convert.ToInt32(ob) > 0);
}
}
}