EchoTex_Payroll/HRM.DA/DA/JV/JVSetupDetailDA.cs
2024-10-14 10:01:49 +06:00

90 lines
3.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.Core.Model;
using System.Data.SqlClient;
using Ease.Core.DataAccess;
using Ease.Core.DataAccess.SQL;
using System.Data;
using HRM.BO;
namespace HRM.DA
{
#region JVSetupDetailDA
public class JVSetupDetailDA
{
#region Constructor
public JVSetupDetailDA()
{
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, JVSetupDetail oItem)
{
tc.ExecuteNonQuery(
"INSERT INTO JVSetupDetail(JVSetupDetailID, ItemID, JVItemType, JVSetupID, Name, CreatedBy, CreationDate)" +
" VALUES(%n, %n, %n, %n, %s, %n, %d)", oItem.ID, oItem.ItemID, oItem.JVItemType, oItem.JVSetupID,
oItem.Name, DataReader.GetNullValue(oItem.CreatedBy), DataReader.GetNullValue(oItem.CreatedDate));
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, JVSetupDetail oItem)
{
tc.ExecuteNonQuery(
"UPDATE JVSetupDetail SET ItemID=%n, JVItemType=%n, JVSetupID=%n, Name=%s, ModifiedBy=%n, ModifiedDate=%d" +
" WHERE JVSetupDetailID=%n", oItem.ItemID, oItem.JVItemType, oItem.JVSetupID, oItem.Name,
DataReader.GetNullValue(oItem.ModifiedBy), DataReader.GetNullValue(oItem.ModifiedDate), oItem.ID);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM JVSetupDetail");
}
internal static IDataReader Get(TransactionContext tc, int nID)
{
return tc.ExecuteReader("SELECT * FROM JVSetupDetail WHERE JVSetupDetailID =%n", nID);
}
internal static IDataReader GetByJVSetup(TransactionContext tc, int jvSetupID)
{
return tc.ExecuteReader("SELECT * FROM JVSetupDetail Where JVSetupID=%n", jvSetupID);
}
internal static IDataReader GetLatestSetupByJVType(TransactionContext tc, int payrolltypeid, int jvSetupID)
{
return tc.ExecuteReader(@"SELECT * FROM JVSetupDetail Where JVSetupID IN ( SELECT JVSetupID FROM JVSetup Where JVTypeID=%n and PayrollTypeID=%n and MonthDate = (" +
" select max(MonthDate) from JVSetup where JVTypeID=%n and PayrollTypeID=%n))", jvSetupID, payrolltypeid,
jvSetupID, payrolltypeid);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM JVSetupDetail WHERE JVSetupDetailID=%n", nID);
}
internal static void DeleteByJVSetup(TransactionContext tc, int nJVSetupID)
{
tc.ExecuteNonQuery("DELETE FROM JVSetupDetail WHERE JVSetupID=%n", nJVSetupID);
}
#endregion
}
#endregion
}