EchoTex_Payroll/HRM.DA/DA/Gratuity/ESBDefinitionDA.cs

253 lines
7.4 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using System;
using System.Data;
using System.Linq;
using System.Data.SqlClient;
using System.Collections.Generic;
using Ease.Core.DataAccess;
using HRM.BO;
namespace HRM.DA
{
#region ESBDefinitionDA
internal class ESBDefinitionDA
{
#region ESBDefinition
#region Constructor
private ESBDefinitionDA()
{
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, ESBDefinition item)
{
tc.ExecuteNonQuery(
"INSERT INTO ESBDefinition(ESBID, Description, ServiceLength,PayrollTypeID,Trading,UserID, CreatedBy, CreatedDate, SequenceNo, Status)" +
" VALUES(%n, %s, %n,%n,%n,%n, %n, %d, %n, %n)", item.ID, item.Description, item.MaxServiceLength,
item.PayrollTypeID, item.Trading, item.UserID, item.CreatedBy, item.CreatedDate, item.Sequence,
item.Status);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, ESBDefinition item)
{
tc.ExecuteNonQuery(
"UPDATE ESBDefinition SET code=%s, MaxServiceLength=%n,PayrollTypeID=%n,Trading=%n,UserID=%n, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n" +
" WHERE ESBID=%n", item.Description, item.MaxServiceLength, item.PayrollTypeID, item.Trading,
item.UserID, item.ModifiedBy, item.ModifiedDate, item.Sequence, item.Status, item.ID);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM ESBDefinition");
}
internal static IDataReader Get(TransactionContext tc, int nID)
{
return tc.ExecuteReader("SELECT * FROM ESBDefinition WHERE ESBID=%n", nID);
}
internal static IDataReader GetByPayrollType(TransactionContext tc, int nID)
{
return tc.ExecuteReader("SELECT * FROM ESBDefinition WHERE payrolltypeid=%n", nID);
}
internal static IDataReader GetByPayrollID(TransactionContext tc, int nID)
{
return tc.ExecuteReader("SELECT * FROM ESBDefinition WHERE PayrollTypeID=%n", nID);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM ESBDefinition WHERE ESBID=%n", nID);
}
#endregion
#endregion
#region ESBElement
#region Insert function
internal static void InsertESBElement(TransactionContext tc, ESBElement item)
{
tc.ExecuteNonQuery("INSERT INTO ESBElement(ESBID,ElementID, ElmentType)" +
" VALUES(%n, %n, %n)", item.ESBID, item.ElementID, (int)item.ElementType);
}
#endregion
#region Update function
internal static void UpdateESBElement(TransactionContext tc, ESBElement item)
{
tc.ExecuteNonQuery("UPDATE ESBElement SET ESBID=%n,ElementID=%n, ElmentType=%n" +
" WHERE ESBID=%n", item.ESBID, item.ElementID, item.ElementType, item.ID);
}
#endregion
#region Get Function
internal static IDataReader GetESBElement(TransactionContext tc, int nESBID)
{
return tc.ExecuteReader("SELECT * FROM ESBElement where esbID=%n ", nESBID);
}
//internal static IDataReader GetESBElement(TransactionContext tc, int nID)
//{
// return tc.ExecuteReader("SELECT * FROM ESBElement WHERE ESBID=%n", nID);
//}
#endregion
#region Delete function
internal static void DeleteESBElement(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM ESBElement WHERE ESBID=%n", nID);
}
#endregion
#endregion
#region ESBGrade
#region Insert function
internal static void InsertESBGrade(TransactionContext tc, ESBGrade item)
{
tc.ExecuteNonQuery("INSERT INTO ESBGrade(ESBID, GradeID)" +
" VALUES(%n, %n)", item.ESBID, item.GradeID);
}
#endregion
#region Update function
internal static void UpdateESBGrade(TransactionContext tc, ESBGrade item)
{
tc.ExecuteNonQuery("UPDATE ESBGrade SET GradeID=%n" +
" WHERE ESBID=%n", item.GradeID, item.ESBID);
}
#endregion
#region Get Function
internal static IDataReader GetESBGrade(TransactionContext tc, EnumStatus status)
{
if (EnumStatus.Active == status || EnumStatus.Inactive == status)
{
return tc.ExecuteReader("SELECT * FROM ESBGrade");
}
else
{
return tc.ExecuteReader("SELECT * FROM ESBGrade");
}
}
internal static IDataReader GetESBGradeByEsbid(TransactionContext tc, int nESBID)
{
return tc.ExecuteReader("SELECT * FROM ESBGrade where esbID=%n ", nESBID);
}
internal static IDataReader GetESBGrade(TransactionContext tc, int nID)
{
return tc.ExecuteReader("SELECT * FROM ESBGrade WHERE ESBGradeID=%n", nID);
}
#endregion
#region Delete function
internal static void DeleteESBGrade(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM ESBGrade WHERE ESBID=%n", nID);
}
#endregion
#endregion
#region ESBSlab
#region Insert function
internal static void InsertESBSlab(TransactionContext tc, ESBSlab item)
{
tc.ExecuteNonQuery("INSERT INTO ESBSlab(ESBID, CalculNo,DaysToConsider,ServiceYear)" +
" VALUES(%n, %n,%n, %n)", item.ESBID, item.CalculateNo, item.DaysToConsider,
item.ServiceYear);
}
#endregion
#region Update function
internal static void UpdateESBSlab(TransactionContext tc, ESBSlab item)
{
tc.ExecuteNonQuery("UPDATE ESBSlab SET ESBID=%n, CalculateNo=%n,DaysToConsider=%n,ServiceYear=%n" +
" WHERE ESBID=%n", item.ESBID, item.CalculateNo, item.DaysToConsider, item.ServiceYear,
item.ESBID);
}
#endregion
#region Get Function
internal static IDataReader GetESBSlab(TransactionContext tc, EnumStatus status)
{
if (EnumStatus.Active == status)
{
return tc.ExecuteReader("SELECT * FROM ESBSlab where Status=%n", status);
}
else
{
return tc.ExecuteReader("SELECT * FROM ESBSlab");
}
}
internal static IDataReader GetSlabs(TransactionContext tc, int nESBID)
{
return tc.ExecuteReader("SELECT * FROM ESBSlab where esbID=%n", nESBID);
}
internal static IDataReader GetESBSlab(TransactionContext tc, int nID)
{
return tc.ExecuteReader("SELECT * FROM ESBSlab WHERE ESBID=%n", nID);
}
#endregion
#region Delete function
internal static void DeleteESBSlab(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM ESBSlab WHERE ESBID=%n", nID);
}
#endregion
#endregion
}
#endregion
}