CEL_Payroll/Payroll.Service/FinalSettlement/DA/FSTranDetailDA.cs

87 lines
3.1 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 FSTranDetailDA
internal class FSTranDetailDA
{
#region Constructor
private FSTranDetailDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, FSTranDetail item)
{
tc.ExecuteNonQuery("INSERT INTO FSTranDetail(FSTranDetailID, ChangeTaxAmount, AmountType, ChangedValue, Description, FsTranType, ItemCode, ItemID,Remarks,Side,CreatedBy,CreationDate,TranID)" +
" VALUES(%n, %n, %n, %n, %s, %n, %n, %n, %s, %n,%n,%d, %n)", item.ID.Integer, item.Amount, (int)item.AmountType, item.ChangedValue, item.Description, (int)item.FsTranType, (int)item.ItemCode, item.ItemID, item.Remarks, (int)item.Side, item.CreatedBy.Integer, item.CreatedDate, item.TranID.Integer);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, FSTranDetail item)
{
tc.ExecuteNonQuery("UPDATE FSTranDetail SET Amount=%n, AmountType=%b, ChangedValue=%n, Description=%s, FsTranType=%b, ItemCode=%b, ItemID=%n,Remarks=%s,Side=%b,TranID=%n" +
"WHERE FSTranDetailID=%n", item.Amount, item.AmountType, item.ChangedValue, item.Description, item.FsTranType, item.ItemCode, item.ItemID, item.Remarks, item.Side, item.TranID, item.ID.Integer);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM FSTranDetail Order By FSTranDetailID");
}
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
{
if (EnumStatus.Active == status)
{
return tc.ExecuteReader("SELECT * FROM FSTranDetail where Status=%n order by FSTranDetailID", status);
}
else
{
return tc.ExecuteReader("SELECT * FROM FSTranDetail order by FSTranDetailID");
}
}
internal static IDataReader GetDetail(TransactionContext tc, ID nTranID)
{
return tc.ExecuteReader("SELECT * FROM FSTranDetail Where TranID=%n order by ItemCode,ItemID", nTranID.Integer);
}
internal static IDataReader GetDetailByEmp(TransactionContext tc, int nEmpID)
{
return tc.ExecuteReader("SELECT * FROM FSTranDetail Where TranID in(select FSTranID from FSTran where employeeid=%n)", nEmpID);
}
internal static IDataReader Get(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("SELECT * FROM FSTranDetail Where FSTranDetailID=%n", nID.Integer);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM [FSTranDetail] Where TranID=%n", nID.Integer);
}
#endregion
}
#endregion
}