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

83 lines
2.4 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 TaxAdjustmentDA
internal class TaxAdjustmentDA
{
#region Constructor
private TaxAdjustmentDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, TaxAdjustment item)
{
tc.ExecuteNonQuery("INSERT INTO TaxAdjustment(TaxAdjustmentID, name,TaxType,CreatedBy, CreationDate, SequenceNo,Status)" +
" VALUES(%n, %s, %n, %n, %d, %n,%n)", item.ID.Integer, item.Name, item.TaxType, item.CreatedBy.Integer ,item.CreatedDate, item.Sequence,item.Status );
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, TaxAdjustment item)
{
tc.ExecuteNonQuery("UPDATE TaxAdjustment SET name=%s, TaxType=%n, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n" +
" WHERE TaxAdjustmentID=%n", item.Name, item.TaxType, item.ModifiedBy.Integer, item.ModifiedDate, item.Sequence, item.Status, item.ID.Integer);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM TaxAdjustment");
}
internal static IDataReader Get(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("SELECT * FROM TaxAdjustment WHERE TaxAdjustmentID=%n", nID);
}
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
{
if (EnumStatus.Active == status || EnumStatus.Inactive==status)
{
return tc.ExecuteReader("SELECT * FROM TaxAdjustment Where Status=%n Order By SequenceNo", status);
}
else
{
return tc.ExecuteReader("SELECT * FROM TaxAdjustment Order By SequenceNo");
}
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM TaxAdjustment WHERE TaxAdjustmentID=%n", nID.Integer);
}
#endregion
}
#endregion
}