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

81 lines
2.7 KiB
C#

using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
namespace HRM.DA
{
class RoleDesignationDA
{
#region Constructor
private RoleDesignationDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, Role.RoleDesignation item)
{
//item.Status = EnumStatus.Inactive;
item.CreatedDate = DateTime.Now;
tc.ExecuteNonQuery("INSERT INTO PR_RoleDesignation( RoleDesignationID ,RoleID, CreatedBy, CreatedDate, DesignationID, AuthStatus)" +
" VALUES(%n,%n, %n, %n, %D, %n, %D, %s,%s,%n,%D,%n)", item.ID, item.RoleID, item.CreatedBy, item.CreatedDate, item.DesignationID, item.AuthStatus);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, Role.RoleDesignation item)
{
string sSql = SQLParser.MakeSQL("UPDATE PR_RoleDesignation SET RoleID = %n,ModifiedBy=%n,ModifiedDate = %D, DesignationID = %n, AuthStatus = %n" +
" WHERE RoleDesignationID = %n", item.RoleID, item.ModifiedBy, item.ModifiedDate, item.DesignationID, item.AuthStatus, item.ID);
tc.ExecuteNonQuery("UPDATE PR_RoleDesignation SET RoleID = %n,ModifiedBy=%n,ModifiedDate = %D, DesignationID = %n, AuthStatus = %n" +
" WHERE RoleDesignationID = %n", item.RoleID, item.ModifiedBy, item.ModifiedDate, item.DesignationID, item.AuthStatus, item.ID);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc, EnumAuthStatus status)
{
return tc.ExecuteReader("SELECT * FROM PR_RoleDesignation where AuthStatus = %n", status);
}
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM PR_RoleDesignation");
}
internal static IDataReader Get(TransactionContext tc, int id)
{
return tc.ExecuteReader("SELECT * FROM PR_RoleDesignation WHERE RoleDesignationID=%n", id);
}
internal static IDataReader Get(TransactionContext tc, int id, EnumAuthStatus status)
{
return tc.ExecuteReader("SELECT * FROM PR_RoleDesignation WHERE RoleDesignationID=%n AND AuthStatus = %n", id, status);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int id)
{
//tc.ExecuteNonQuery("UPDATE Role SET CreatedBy=%n WHERE RoleID = %n", User.CurrentUser.ID, id);
tc.ExecuteNonQuery("DELETE FROM PR_RoleDesignation WHERE RoleDesignationID = %n", id);
}
#endregion
}
}