CEL_Payroll/Payroll.Service/CarFuel/DA/CarFuelPaymentDA.cs
2024-09-17 14:30:13 +06:00

66 lines
2.9 KiB
C#

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 CarFuelPayment
internal class CarFuelPaymentDA
{
#region Constructor
public CarFuelPaymentDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, CarFuelPayment oItem)
{
tc.ExecuteNonQuery("INSERT INTO CarFuelPayment(CarFuelPaymentID, EmployeeID, CarFuelItemID, Amount, PaymentDate, Remarks, TaxAmount, CreatedBy, CreationDate)" +
" VALUES(%n, %n, %n, %n, %d, %s, %n, %n, %d)", oItem.ID.Integer, oItem.EmployeeID.Integer, oItem.CarFuelItemID.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, CarFuelPayment oItem)
{
tc.ExecuteNonQuery("UPDATE CarFuelPayment SET EmployeeID=%n, CarFuelItemID=%n, Amount=%n, PaymentDate=%d, Remarks=%s, TaxAmount=%n, ModifiedBy=%n, ModifiedDate=%d" +
" WHERE CarFuelPaymentID=%n", oItem.EmployeeID.Integer, oItem.CarFuelItemID.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 CarFuelPayment Order By EmployeeID");
}
internal static IDataReader Get(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("SELECT * FROM CarFuelPayment WHERE CarFuelPaymentID=%n", nID.Integer);
}
public static DataSet GetDataSetOfPaymentEmployees(TransactionContext tc, ID nCarFuelItemID, EnumCarFuelType nCarFuelType)
{
string sSQL = SQLParser.MakeSQL("select * from Employee where EmployeeID in ( " +
"select EmployeeID from CarFuelParameterIndividual CarFuel " +
" where CarFuel.CarFuelParameterID in (select CarFuelParameterID from CarFuelParameter " +
" where CarFuelItemID = %n and CarFuelType = %n))", nCarFuelItemID.Integer, nCarFuelType);
return tc.ExecuteDataSet(sSQL);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM [CarFuelPayment] WHERE CarFuelPaymentID=%n", nID.Integer);
}
#endregion
}
#endregion
}