94 lines
2.8 KiB
C#
94 lines
2.8 KiB
C#
using HRM.BO;
|
|
using Ease.Core.DataAccess;
|
|
using System;
|
|
using System.Data;
|
|
|
|
namespace HRM.DA
|
|
{
|
|
#region SuccessionRoleDA
|
|
|
|
internal class SuccessionRoleDA
|
|
{
|
|
#region Constructor
|
|
|
|
private SuccessionRoleDA()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Insert function
|
|
|
|
internal static void Insert(TransactionContext tc, SuccessionRole item)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"INSERT INTO SuccessionRole (SuccessionRoleID, code, name, CreatedBy, CreatedDate, PayrollTypeID, Status)" +
|
|
" VALUES(%n, %s, %s, %n, %d, %n, %n)", item.ID, item.Code, item.Name, item.CreatedBy, item.CreatedDate,
|
|
item.PayrollTypeID, item.Status);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update Function
|
|
|
|
internal static void Update(TransactionContext tc, SuccessionRole item)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"UPDATE SuccessionRole SET code=%s, name=%s, ModifiedBy=%n, ModifiedDate=%d, PayrollTypeID=%n, Status=%n" +
|
|
" WHERE SuccessionRoleID=%n", item.Code, item.Name, item.ModifiedBy, item.ModifiedDate, item.PayrollTypeID,
|
|
item.Status, item.ID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Function
|
|
|
|
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
|
|
{
|
|
if (EnumStatus.Active == status || EnumStatus.Inactive == status)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM SuccessionRole where Status=%n", status);
|
|
}
|
|
else
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM SuccessionRole");
|
|
}
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, EnumStatus status,int payrollTypeID)
|
|
{
|
|
if (EnumStatus.Active == status || EnumStatus.Inactive == status)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM SuccessionRole where Status=%n and payrollTypeId=%n", status, payrollTypeID);
|
|
}
|
|
else
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM SuccessionRole where payrollTypeId=%n", payrollTypeID);
|
|
}
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int id)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM SuccessionRole WHERE SuccessionRoleID=%n", id);
|
|
}
|
|
|
|
internal static IDataReader GetAll(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM SuccessionRole");
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region Delete Function
|
|
|
|
internal static void Delete(TransactionContext tc, int id)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM SuccessionRole WHERE SuccessionRoleID=%n", id);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
} |