EchoTex_Payroll/HRM.DA/DA/OPI/OPIPaymentDA.cs

81 lines
2.7 KiB
C#
Raw Permalink 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 OPIPayment
internal class OPIPaymentDA
{
#region Constructor
public OPIPaymentDA()
{
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, OPIPayment oItem)
{
tc.ExecuteNonQuery(
"INSERT INTO OPIPayment(OPIPaymentID, EmployeeID, OPIItemID, Amount, PaymentDate, Remarks, TaxAmount, CreatedBy, CreationDate)" +
" VALUES(%n, %n, %n, %n, %d, %s, %n, %n, %d)", oItem.ID, oItem.EmployeeID, oItem.OPIItemID,
oItem.Amount, oItem.PaymentDate, DataReader.GetNullValue(oItem.Remarks), oItem.TaxAmount,
DataReader.GetNullValue(oItem.CreatedBy), oItem.CreatedDate);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, OPIPayment oItem)
{
tc.ExecuteNonQuery(
"UPDATE OPIPayment SET EmployeeID=%n, OPIItemID=%n, Amount=%n, PaymentDate=%d, Remarks=%s, TaxAmount=%n, ModifiedBy=%n, ModifiedDate=%d" +
" WHERE OPIPaymentID=%n", oItem.EmployeeID, oItem.OPIItemID, oItem.Amount, oItem.PaymentDate,
DataReader.GetNullValue(oItem.Remarks), oItem.TaxAmount, DataReader.GetNullValue(oItem.ModifiedBy),
DataReader.GetNullValue(oItem.ModifiedDate), oItem.ID);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM OPIPayment Order By EmployeeID");
}
internal static IDataReader Get(TransactionContext tc, int nID)
{
return tc.ExecuteReader("SELECT * FROM OPIPayment WHERE OPIPaymentID=%n", nID);
}
public static DataSet GetDataSetOfPaymentEmployees(TransactionContext tc, int nOpiItemID, EnumOpiType nOpiType)
{
string sSQL = SQLParser.MakeSQL("select * from Employee where EmployeeID in ( " +
"select EmployeeID from opiParameterIndividual opi " +
" where opi.opiParameterID in (select opiParameterID from opiParameter " +
" where opiItemID = %n and opiType = %n))", nOpiItemID, nOpiType);
return tc.ExecuteDataSet(sSQL);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM OPIPayment WHERE OPIPaymentID=%n", nID);
}
#endregion
}
#endregion
}