CEL_Payroll/Payroll.Service/Tax/DA/TaxMergeMasterDA.cs

110 lines
4.2 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 TaxMergeMasterDA
internal class TaxMergeMasterDA
{
#region Constructor
private TaxMergeMasterDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, TaxMergeMaster item)
{
tc.ExecuteNonQuery("INSERT INTO TaxMergeMaster(TAXMERGEID, TAXPARAMID, ItemID, ItemGroup, Type, DESCRIPTION,POSITION ,CreatedBy, CreationDate)" +
" VALUES(%n, %n, %n, %n, %n, %s, %n,%n,%d)", item.ID.Integer, item.TaxParameterID.Integer, item.ItemID, item.ItemGroup, item.Type, item.Description,item.Position,item.CreatedBy.Integer, item.CreatedDate);
}
internal static void Insert(TransactionContext tc, TaxMergeMaster.TaxMergeDetail item)
{
tc.ExecuteNonQuery("INSERT INTO TaxMergeDetail(DetailId,TaxParameterID, ItemID,ItemGroup,TaxMergeID,Type, Description)" +
" VALUES(%n, %n,%n,%n,%n,%n,%s)", item.ID.Integer, item.TaxParameterID.Integer, item.ItemID, item.ItemGroup,item.TaxMergeID.Integer,item.Type, item.Description);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, TaxMergeMaster item)
{
tc.ExecuteNonQuery("UPDATE TaxMergeMaster SET TAXPARAMID=%n, ItemID=%n, DESCRIPTION=%s, position=%n,ItemGroup=%n,Type=%n, ModifiedBy=%n, ModifiedDate=%d" +
" WHERE TaxMergeID=%n", item.TaxParameterID.Integer, item.ItemID , item.Description, item.Position, item.ItemGroup,item.Type, item.ModifiedBy.Integer, item.ModifiedDate, item.ID.Integer);
}
#endregion
#region Get Function
internal static IDataReader GetbyTaxParameter(TransactionContext tc, int TaxParameterID)
{
return tc.ExecuteReader("SELECT * FROM TaxMergeMaster where TAXPARAMID=%n ORDER BY Position", TaxParameterID);
}
internal static IDataReader Get(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("SELECT * FROM TaxMergeMaster WHERE TaxMergeID=%n", nID.Integer);
}
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM TaxMergeMaster Order by Position");
}
internal static IDataReader GetDetail(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("SELECT * FROM TaxMergeDetail WHERE TaxMergeID=%n", nID.Integer);
}
#endregion
internal static IDataReader GetDetail(TransactionContext tc, ID nID, int payrollTypeID)
{
return tc.ExecuteReader("SELECT * FROM TaxMergeDetail WHERE TaxMergeID=%n", nID.Integer);
}
internal static IDataReader GetPrevByTaxParamID(TransactionContext tc, int payrollTypeID)
{
return tc.ExecuteReader("SELECT * FROM TaxMergeMaster where TAXPARAMID=(SELECT max(TAXPARAMID) FROM TaxMergeMaster)");
}
#region Delete function
internal static void Delete(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM TaxMergeDetail WHERE TaxMergeID=%n", nID.Integer);
tc.ExecuteNonQuery("DELETE FROM TaxMergeMaster WHERE TaxMergeID=%n", nID.Integer);
}
internal static void DeleteMDetailByMergeID(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM TaxMergeDetail WHERE TaxMergeID=%n", nID.Integer);
}
internal static void DeleteByTaxParamID(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM TaxMergeDetail WHERE TaxParameterID=%n", nID.Integer);
tc.ExecuteNonQuery("DELETE FROM TaxMergeMaster WHERE TaxParamID=%n", nID.Integer);
}
#endregion
internal static IDataReader GetByTaxParamID(TransactionContext tc, int id)
{
return tc.ExecuteReader("SELECT * FROM TaxMergeMaster where TAXPARAMID=%n Order by Position",id);
}
}
#endregion
}