EchoTex_Payroll/HRM.DA/DA/Tax/MinTaxExceptionDA.cs

82 lines
2.3 KiB
C#
Raw Permalink 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
{
public class MinTaxExceptionDA
{
#region Constructor
public MinTaxExceptionDA()
{
}
#endregion
#region Insert function
public static void Insert(TransactionContext tc, MinTaxException oItem)
{
tc.ExecuteNonQuery(
"INSERT INTO MinTaxException(MinTaxExceptionID, TaxParamID, EmployeeID, ExceptionType, Amount)" +
" VALUES(%n, %n, %n,%n, %n)", oItem.ID, oItem.TaxParamID, oItem.EmployeeID, oItem.TaxExceptionType,
oItem.Amount);
}
#endregion
#region Update function
public static void Update(TransactionContext tc, MinTaxException oItem)
{
tc.ExecuteNonQuery("UPDATE MinTaxException SET TaxParamID=%n, EmployeeID=%n, ExceptionType=%n, Amount=%n" +
" WHERE MinTaxExceptionID=%n", oItem.TaxParamID, oItem.EmployeeID,
oItem.TaxExceptionType, oItem.Amount, oItem.ID);
}
#endregion
#region Get function
public static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM MinTaxException ORDER BY EmployeeID");
}
public static IDataReader Get(TransactionContext tc, int empId)
{
return tc.ExecuteReader("SELECT * FROM MinTaxException where EmployeeID = %n", empId);
}
#endregion
#region Get function
public static IDataReader Delete(TransactionContext tc, int id)
{
return tc.ExecuteReader("Delete FROM MinTaxException WHERE EmployeeID=%n", id);
}
#endregion
#region Other function
public static bool IsExist(TransactionContext tc, int empId, int taxParamId, EnumMinimumTaxType taxType)
{
bool Exist = false;
Object obj =
tc.ExecuteScalar(
"Select CONUT (*) FROM MinTaxException WHERE EmployeeID=%n AND TaxParamID=%n AND ExceptionType=%n",
empId, taxParamId, taxType);
Exist = Convert.ToInt32(obj) > 0 ? true : false;
return Exist;
}
#endregion
}
}