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

76 lines
2.2 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 TaxInvestmentDA
internal class TaxInvestmentDA
{
#region Constructor
private TaxInvestmentDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, TaxInvestment item)
{
tc.ExecuteNonQuery("INSERT INTO INVTYPE(TypeID, typeCode, typeName, CreatedBy, CreationDate, SequenceNo, Status)" +
" VALUES(%n, %s, %s, %n, %d, %n, %n)", item.ID.Integer, item.Code, item.Name, item.CreatedBy.Integer, item.CreatedDate, item.Sequence, item.Status);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, TaxInvestment item)
{
tc.ExecuteNonQuery("UPDATE INVTYPE SET typeCode=%s, typeName=%s, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n" +
" WHERE TypeID=%n", item.Code, item.Name, item.ModifiedBy.Integer, item.ModifiedDate, item.Sequence, item.Status, item.ID.Integer);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc,EnumStatus status)
{
if (EnumStatus.Active == status || EnumStatus.Inactive==status)
{
return tc.ExecuteReader("SELECT * FROM INVTYPE where Status=%n Order By SequenceNo", status);
}
else
{
return tc.ExecuteReader("SELECT * FROM INVTYPE Order By SequenceNo");
}
}
internal static IDataReader Get(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("SELECT * FROM INVTYPE WHERE TypeID=%n", nID);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM [INVTYPE] WHERE TypeID=%n", nID.Integer );
}
#endregion
}
#endregion
}