74 lines
2.6 KiB
C#
74 lines
2.6 KiB
C#
|
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 TrainingDepartmentDA
|
|||
|
{
|
|||
|
|
|||
|
#region Get Function
|
|||
|
|
|||
|
public static IDataReader Get(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * from TrainingDepartment WHERE TrainDepartmentID=%n", id);
|
|||
|
}
|
|||
|
|
|||
|
public static IDataReader Get(TransactionContext tc)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * from TrainingDepartment");
|
|||
|
}
|
|||
|
|
|||
|
public static IDataReader GetByTrainingNeedAnalysisID(TransactionContext tc, ID TrainingNeedAnalysisID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * from TrainingDepartment where TrainingNeedAnalysisID=%n", TrainingNeedAnalysisID.Integer);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Insert Function
|
|||
|
public static void Insert(TransactionContext tc, TrainingDepartment oItem)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("INSERT INTO TrainingDepartment(TrainDepartmentID, TrainingNeedAnalysisID, DepartmentID, Remarks)" +
|
|||
|
" VALUES(%n,%n,%n,%s)", oItem.ID.Integer, DataReader.GetNullValue(oItem.TrainingNeedAnalysisID, IDType.Integer), DataReader.GetNullValue(oItem.DepartmentID, IDType.Integer), oItem.Remarks);
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Update Function
|
|||
|
|
|||
|
public static void Update(TransactionContext tc, TrainingDepartment oItem)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("UPDATE TrainingDepartment SET TrainingNeedAnalysisID=%n,DepartmentID=%n,Remarks=%s" +
|
|||
|
" WHERE TrainDepartmentID=%n", DataReader.GetNullValue(oItem.TrainingNeedAnalysisID, IDType.Integer), DataReader.GetNullValue(oItem.DepartmentID, IDType.Integer), oItem.Remarks, oItem.ID.Integer);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Delete Function
|
|||
|
public static void Delete(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("Delete from TrainingDepartment where TrainDepartmentID=%n", id);
|
|||
|
}
|
|||
|
|
|||
|
public static void DeletebyTrainingNeedAnalysisID(TransactionContext tc, int TrainingNeedAnalysisID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("Delete from TrainingDepartment where TrainingNeedAnalysisID=%n", TrainingNeedAnalysisID);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
public static bool DoesTrainingDepartmentExists(TransactionContext tc, ID TrainDepartmentID)
|
|||
|
{
|
|||
|
object ob = tc.ExecuteScalar("SELECT COUNT(*) FROM TrainingDepartment WHERE TrainDepartmentID=%n", TrainDepartmentID.Integer);
|
|||
|
return (Convert.ToInt32(ob) > 0);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|