EchoTex_Payroll/HRM.DA/DA/Tax/TaxMergeMasterDA.cs

121 lines
4.7 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using System;
using Ease.Core.Model;
using Ease.Core.DataAccess;
using HRM.BO;
using Ease.Core.Utility;
using System.Collections.Generic;
using System.Data;
namespace HRM.DA
{
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, PAYROLLTYPEID)" +
" VALUES(%n, %n, %n, %n, %n, %s, %n,%n,%d, %n)", item.ID, item.TaxParameterID, item.ItemID,
item.ItemGroup, item.Type, item.Description, item.Position, item.CreatedBy, item.CreatedDate,
item.PayrollTypeID);
}
internal static void Insert(TransactionContext tc, TaxMergeMaster.TaxMergeDetail item)
{
tc.ExecuteNonQuery(
"INSERT INTO TaxMergeDetail(DetailId,TaxParameterID, ItemID,ItemGroup,TaxMergeID,Type, Description, PAYROLLTYPEID)" +
" VALUES(%n, %n,%n,%n,%n,%n,%s, %n)", item.ID, item.TaxParameterID, item.ItemID, item.ItemGroup,
item.TaxMergeID, item.Type, item.Description, item.PayrollTypeID);
}
#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, PAYROLLTYPEID=%n" +
" WHERE TaxMergeID=%n", item.TaxParameterID, item.ItemID, item.Description, item.Position,
item.ItemGroup, item.Type, item.ModifiedBy, item.ModifiedDate, item.PayrollTypeID, item.ID);
}
#endregion
#region Get Function
internal static IDataReader GetbyTaxParameter(TransactionContext tc, int TaxParameterID, int payrollTypeID)
{
return tc.ExecuteReader(
"SELECT * FROM TaxMergeMaster where TAXPARAMID=%n AND PAYROLLTYPEID=%n ORDER BY Position",
TaxParameterID, payrollTypeID);
}
internal static IDataReader Get(TransactionContext tc, int payrolltypeid, int taxParamID, EnumTaxMergeType type, int Itemid )
{
return tc.ExecuteReader(@"select Distinct *from TAXMERGEMASTER where taxmergeid in (
select Taxmergeid from TAXMERGEDETAIL where TYPE = %n and ItemID = %n
and TAXPARAMETERID = %n and PAYROLLTYPEID = %n)",type, Itemid, taxParamID, payrolltypeid);
}
internal static IDataReader Get(TransactionContext tc, int nID, int payrollTypeID)
{
return tc.ExecuteReader("SELECT * FROM TaxMergeMaster WHERE TaxMergeID=%n AND PAYROLLTYPEID=%n", nID,
payrollTypeID);
}
//Not Used in any BO From Service
internal static IDataReader GetbyPayrollType(TransactionContext tc, int payrollTypeID)
{
return tc.ExecuteReader("SELECT * FROM TaxMergeMaster WHERE PAYROLLTYPEID=%n Order by Position",
payrollTypeID);
}
internal static IDataReader GetDetail(TransactionContext tc, int nID, int payrollTypeID)
{
return tc.ExecuteReader("SELECT * FROM TaxMergeDetail WHERE TaxMergeID=%n AND PAYROLLTYPEID=%n", nID,
payrollTypeID);
}
internal static IDataReader GetDetailbyTaxParamID(TransactionContext tc, int nID, int payrollTypeID)
{
return tc.ExecuteReader(@"SELECT distinct td.* FROM TaxMergeDetail td, TaxMergeMaster t
WHERE t.TAXPARAMID =td.TaxParameterID and t.TAXPARAMID=%n AND t.PAYROLLTYPEID=%n", nID,
payrollTypeID);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM TaxMergeDetail WHERE TaxMergeID=%n", nID);
tc.ExecuteNonQuery("DELETE FROM TaxMergeMaster WHERE TaxMergeID=%n", nID);
}
internal static void DeleteMDetailByMergeID(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM TaxMergeDetail WHERE TaxMergeID=%n", nID);
}
#endregion
internal static IDataReader GetByTaxParamID(TransactionContext tc, int id, int payrollTypeID)
{
return tc.ExecuteReader(
"SELECT * FROM TaxMergeMaster where TAXPARAMID=%n AND PAYROLLTYPEID=%n Order by Position", id,
payrollTypeID);
}
}
}