EchoTex_Payroll/HRM.DA/DA/TrainingS/TrainingScheduleAttnDA.cs
2024-10-14 10:01:49 +06:00

79 lines
2.8 KiB
C#

using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Collections.Generic;
using System.Data;
namespace HRM.DA
{
class TrainingScheduleAttnDA
{
#region Get Function
public static IDataReader Get(TransactionContext tc, int id)
{
return tc.ExecuteReader("SELECT * from TrainingScheduleAttn WHERE TSAttnID=%n", id);
}
public static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * from TrainingScheduleAttn");
}
public static IDataReader GetByTrainingScheduleID(TransactionContext tc, int trainingScheduleID)
{
return tc.ExecuteReader("SELECT * from TrainingScheduleAttn where TrainingScheduleID=%n",
trainingScheduleID);
}
public static IDataReader GetByTrainingScheduleDateID(TransactionContext tc, int trainingScheduleDateID)
{
return tc.ExecuteReader("SELECT * from TrainingScheduleAttn where TSDateID=%n", trainingScheduleDateID);
}
#endregion
#region Insert Function
public static void Insert(TransactionContext tc, TrainingScheduleAttn oItem)
{
tc.ExecuteNonQuery("INSERT INTO TrainingScheduleAttn(TSAttnID, TrainingScheduleID, TSDateID, EmployeeID)" +
" VALUES(%n,%n,%n,%n)", oItem.ID, DataReader.GetNullValue(oItem.TrainingScheduleID, 0),
DataReader.GetNullValue(oItem.TSDateID, 0), DataReader.GetNullValue(oItem.EmployeeID, 0));
}
#endregion
#region Update Function
public static void Update(TransactionContext tc, TrainingScheduleAttn oItem)
{
tc.ExecuteNonQuery("UPDATE TrainingScheduleAttn SET TrainingScheduleID=%n,TSDateID=%n,EmployeeID=%n" +
" WHERE TSAttnID=%n", DataReader.GetNullValue(oItem.TrainingScheduleID, 0),
DataReader.GetNullValue(oItem.TSDateID, 0), DataReader.GetNullValue(oItem.EmployeeID, 0), oItem.ID);
}
#endregion
#region Delete Function
public static void Delete(TransactionContext tc, int id)
{
tc.ExecuteNonQuery("Delete from TrainingScheduleAttn where TSAttnID=%n", id);
}
public static void DeletebyTrainingScheduleID(TransactionContext tc, int trainingScheduleID)
{
tc.ExecuteNonQuery("Delete from TrainingScheduleAttn where TrainingScheduleID=%n", trainingScheduleID);
}
#endregion
public static bool DoesTrainingScheduleAttnExists(TransactionContext tc, int trainingScheduleDateID)
{
object ob = tc.ExecuteScalar("SELECT COUNT(*) FROM TrainingScheduleAttn WHERE TSDateID=%n",
trainingScheduleDateID);
return (Convert.ToInt32(ob) > 0);
}
}
}