CEL_Payroll/Payroll.Service/OverTime/DA/TermParameterDA.cs

94 lines
3.3 KiB
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
using System;
using Payroll.BO;
using System.Data;
using System.Linq;
using Ease.CoreV35.Model;
using System.Data.SqlClient;
using Ease.CoreV35.DataAccess;
using System.Collections.Generic;
using Ease.CoreV35.DataAccess.SQL;
namespace Payroll.Service
{
#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)" +
" VALUES(%n, %n, %d, %n, %n, %n, %d,%n)", item.ID.Integer, item.TermID.Integer, item.EffectDate, item.Amount, item.Type, DataReader.GetNullValue(item.CreatedBy.Integer), DataReader.GetNullValue(item.CreatedDate),item.PayrollTypeID);
}
internal static void Insert(TransactionContext tc, TermParameter.TermEntityGrade item)
{
tc.ExecuteNonQuery("INSERT INTO TermEntityGrade(TermentityID, GRADEID)" +
" VALUES(%n, %n)", item.TermEntityID.Integer, item.GradeID.Integer);
}
#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" +
" WHERE TermParameterID=%n", item.TermID.Integer, item.EffectDate, item.Amount, item.Type, item.ModifiedBy.Integer, item.ModifiedDate,item.PayrollTypeID, item.ID.Integer);
}
#endregion
#region Get Function
internal static IDataReader Get2(TransactionContext tc, ID payrollTypeID)
{
return tc.ExecuteReader("SELECT * FROM TERMPARAMETER Where PayrollTypeID=%n", payrollTypeID.Integer);
}
internal static IDataReader Get(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("SELECT * FROM TERMPARAMETER WHERE TermParameterID=%n", nID.Integer);
}
internal static IDataReader GetByGradeID(TransactionContext tc, ID nGradeID)
{
return tc.ExecuteReader("Select TermParameter.* from TermParameter,TermEntityGrade " +
"where TermEntityGrade.TermEntityID=TermParameter.TermParameterID " +
"AND TermEntityGrade.GradeID=%n", nGradeID.Integer);
}
internal static IDataReader GetGrades(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("Select * from TermEntityGrade Where TermEntityID = %n", nID.Integer);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM TermEntityGRADE WHERE TermEntityID=%n", nID.Integer);
tc.ExecuteNonQuery("DELETE FROM [TERMPARAMETER] WHERE TermParameterID=%n", nID.Integer);
}
internal static void DeleteGrade(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM TermEntityGRADE WHERE TermEntityID=%n", nID.Integer);
}
#endregion
}
#endregion
}