62 lines
2.0 KiB
C#
62 lines
2.0 KiB
C#
|
using HRM.BO;
|
|||
|
using Ease.Core.DataAccess;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data;
|
|||
|
|
|||
|
namespace HRM.DA
|
|||
|
{
|
|||
|
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, oItem.Code, oItem.Name,
|
|||
|
DataReader.GetNullValue(oItem.CreatedBy), 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), DataReader.GetNullValue(oItem.ModifiedDate), oItem.ID);
|
|||
|
}
|
|||
|
|
|||
|
#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);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|