CEL_Payroll/Payroll.Service/TrainingS/DA/TrainingNdAnalysisTimeSchDA.cs

74 lines
2.6 KiB
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Ease.CoreV35.DataAccess;
using Ease.CoreV35.Model;
using Payroll.BO;
namespace Payroll.Service
{
class TrainingNdAnalysisTimeSchDA
{
#region Get Function
public static IDataReader Get(TransactionContext tc, int id)
{
return tc.ExecuteReader("SELECT * from TrainingNdAnalysisTimeSch WHERE TNATimeSchID=%n", id);
}
public static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * from TrainingNdAnalysisTimeSch");
}
public static IDataReader GetByTrainingNeedAnalysisID(TransactionContext tc, ID TrainingNeedAnalysisID)
{
return tc.ExecuteReader("SELECT * from TrainingNdAnalysisTimeSch where TrainingNeedAnalysisID=%n", TrainingNeedAnalysisID.Integer);
}
#endregion
#region Insert Function
public static void Insert(TransactionContext tc, TrainingNdAnalysisTimeSch oItem)
{
tc.ExecuteNonQuery("INSERT INTO TrainingNdAnalysisTimeSch(TNATimeSchID, TrainingNeedAnalysisID, Month,Participent, Remarks)" +
" VALUES(%n,%n,%n,%n,%s)", oItem.ID.Integer, DataReader.GetNullValue(oItem.TrainingNeedAnalysisID, IDType.Integer), oItem.Month,oItem.Participent, oItem.Remarks);
}
#endregion
#region Update Function
public static void Update(TransactionContext tc, TrainingNdAnalysisTimeSch oItem)
{
tc.ExecuteNonQuery("UPDATE TrainingNdAnalysisTimeSch SET TrainingNeedAnalysisID=%n,Month=%n,Participent=%n,Remarks=%s" +
" WHERE TNATimeSchID=%n", DataReader.GetNullValue(oItem.TrainingNeedAnalysisID, IDType.Integer), oItem.Month, oItem.Participent, oItem.Remarks, oItem.ID.Integer);
}
#endregion
#region Delete Function
public static void Delete(TransactionContext tc, int id)
{
tc.ExecuteNonQuery("Delete from TrainingNdAnalysisTimeSch where TNATimeSchID=%n", id);
}
public static void DeletebyTrainingNeedAnalysisID(TransactionContext tc, int TrainingNeedAnalysisID)
{
tc.ExecuteNonQuery("Delete from TrainingNdAnalysisTimeSch where TrainingNeedAnalysisID=%n", TrainingNeedAnalysisID);
}
#endregion
public static bool DoesTrainingNdAnalysisTimeSchExists(TransactionContext tc, ID TNATimeSchID)
{
object ob = tc.ExecuteScalar("SELECT COUNT(*) FROM TrainingNdAnalysisTimeSch WHERE TNATimeSchID=%n", TNATimeSchID.Integer);
return (Convert.ToInt32(ob) > 0);
}
}
}