CEL_Payroll/Payroll.Service/OPI/DA/OPIPaymentDA.cs

66 lines
2.8 KiB
C#
Raw 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 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.Integer, oItem.EmployeeID.Integer, oItem.OPIItemID.Integer, oItem.Amount, oItem.PaymentDate, DataReader.GetNullValue(oItem.Remarks), oItem.TaxAmount, DataReader.GetNullValue(oItem.CreatedBy.Integer),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.Integer, oItem.OPIItemID.Integer, oItem.Amount, oItem.PaymentDate, DataReader.GetNullValue(oItem.Remarks), oItem.TaxAmount, DataReader.GetNullValue(oItem.ModifiedBy.Integer), DataReader.GetNullValue(oItem.ModifiedDate), oItem.ID.Integer);
}
#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, ID nID)
{
return tc.ExecuteReader("SELECT * FROM OPIPayment WHERE OPIPaymentID=%n", nID.Integer);
}
public static DataSet GetDataSetOfPaymentEmployees(TransactionContext tc, ID 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.Integer, nOpiType);
return tc.ExecuteDataSet(sSQL);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM [OPIPayment] WHERE OPIPaymentID=%n", nID.Integer);
}
#endregion
}
#endregion
}