EchoTex_Payroll/HRM.DA/DA/OverTime/TermParameterDA.cs

105 lines
3.6 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
namespace HRM.DA
{
#region TermParameterDA
internal class TermParameterDA
{
#region Constructor
private TermParameterDA()
{
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, TermParameter item)
{
tc.ExecuteNonQuery(
"INSERT INTO TERMPARAMETER(TermParameterID, termID, effectDate, amount, type, CreatedBy, CreationDate,PayrollTypeID, housInMonth)" +
" VALUES(%n, %n, %d, %n, %n, %n, %d,%n, %n)", item.ID, item.TermID, item.EffectDate, item.Amount, item.Type,
DataReader.GetNullValue(item.CreatedBy), DataReader.GetNullValue(item.CreatedDate), item.PayrollTypeID, item.housInMonth);
}
internal static void Insert(TransactionContext tc, TermParameter.TermEntityGrade item)
{
tc.ExecuteNonQuery("INSERT INTO TermEntityGrade(TermentityID, GRADEID)" +
" VALUES(%n, %n)", item.TermEntityID, item.GradeID);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, TermParameter item)
{
tc.ExecuteNonQuery(
"UPDATE TERMPARAMETER SET termID=%n, effectDate=%d, amount=%n, type=%n, ModifiedBy=%n, ModifiedDate=%d,PayrollTypeID=%n, housInMonth=%n" +
" WHERE TermParameterID=%n", item.TermID, item.EffectDate, item.Amount, item.Type, item.ModifiedBy,
item.ModifiedDate, item.PayrollTypeID, item.housInMonth, item.ID);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc, int id)
{
return tc.ExecuteReader("SELECT * FROM TERMPARAMETER Where TermParameterID=%n", id);
}
internal static IDataReader GetByPayrollTypeID(TransactionContext tc, int PayrollTypeID)
{
return tc.ExecuteReader("SELECT * FROM TERMPARAMETER WHERE PayrollTypeID=%n", PayrollTypeID);
}
internal static IDataReader GetByGradeID(TransactionContext tc, int nGradeID)
{
return tc.ExecuteReader("Select TermParameter.* from TermParameter,TermEntityGrade " +
"where TermEntityGrade.TermEntityID=TermParameter.TermParameterID " +
"AND TermEntityGrade.GradeID=%n", nGradeID);
}
internal static IDataReader GetUsedGrades(TransactionContext tc, int termid)
{
return tc.ExecuteReader(@"select *from TermEntityGrade where TermEntityID in (
select TermParameterID from TermParameter where termID = %n)", termid);
}
internal static IDataReader GetGrades(TransactionContext tc, int nID)
{
return tc.ExecuteReader("Select * from TermEntityGrade Where TermEntityID = %n", nID);
}
internal static IDataReader GetGrades(TransactionContext tc)
{
return tc.ExecuteReader("Select * from TermEntityGrade ");
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM TermEntityGRADE WHERE TermEntityID=%n", nID);
tc.ExecuteNonQuery("DELETE FROM TERMPARAMETER WHERE TermParameterID=%n", nID);
}
internal static void DeleteGrade(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM TermEntityGRADE WHERE TermEntityID=%n", nID);
}
#endregion
}
#endregion
}