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

76 lines
2.1 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 ProcessItemDA
internal class ProcessItemDA
{
#region Constructor
private ProcessItemDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, ProcessItem item)
{
tc.ExecuteNonQuery("INSERT INTO ProcessItem(ProcessItemID, itemCode, defaultDescription, userDescription, position, itemGroup)" +
" VALUES(%n, %n, %s, %s, %n, %n)", item.ID.Integer, item.ItemCode, item.DefaultDescription, item.UserDescription, item.Position, item.ItemGroup);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, ProcessItem item)
{
tc.ExecuteNonQuery("UPDATE ProcessItem SET itemCode=%n, defaultDescription=%s, userDescription=%s, position=%n, itemGroup=%n" +
" WHERE ProcessItemID=%n", item.ItemCode, item.DefaultDescription, item.UserDescription, item.Position, item.ItemGroup, item.ID.Integer);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM ProcessItem");
}
internal static IDataReader GetForTHeadGroup(TransactionContext tc)
{
return tc.ExecuteReader("Select * from ProcessItem where ItemGroup >=6 order by ItemGroup");
}
internal static IDataReader Get(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("SELECT * FROM ProcessItem WHERE ProcessItemID=%n", nID.Integer);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM [ProcessItem] WHERE ProcessItemID=%n", nID.Integer);
}
#endregion
}
#endregion
}