EchoTex_Payroll/HRM.DA/DA/Arrears/LTASetupDA.cs

113 lines
4.3 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using System;
using System.Data;
using Ease.Core.DataAccess;
using HRM.BO;
namespace HRM.DA
{
public class LTASetupDA
{
#region Constructor
private LTASetupDA()
{
}
#endregion
#region Insert
internal static void Insert(TransactionContext tc, LTASetup item)
{
tc.ExecuteNonQuery(
"INSERT INTO LTASetup(LTASetupID, FromMonth, ToMonth, Description, CreatedBy, CreatedDate, PayrolltypeID)" +
" VALUES(%n, %d, %d, %s, %n, %d, %n)", item.ID, item.FromMonth, item.ToMonth, item.Description,
item.CreatedBy, item.CreatedDate, item.PayrollTypeID);
}
internal static void InsertLTABasic(TransactionContext tc, LTABasic item)
{
tc.ExecuteNonQuery("INSERT INTO LTABasic(LTABasicID, FromBasic, ToBasic, Incrment, Percent, LTASetupID)" +
" VALUES(%n, %n, %n, %n, %n, %n)", item.ID, item.FromBasic, item.ToBasic, item.Increment,
item.Percent, item.LTASetupID);
}
internal static void InsertLTABenefit(TransactionContext tc, LTABenefit item)
{
tc.ExecuteNonQuery(
"INSERT INTO LTABenefit(LTABenefitID, FlatIncrement, FlatIncrementGF, ItemType, ItemID, PreBasicPercent , PreBasicIncrementPercent , GFPreBasicPercent , GFPreBasicIncrementPercent , IsDependOnAttendance, LTASetupID)" +
" VALUES(%n, %n, %n, %n, %n, %n, %n, %n, %n, %n, %n)", item.ID, item.FlatIncrement,
item.FlatIncrementGF, (int)item.ItemType, item.ItemID, item.PreviousBasicPercent,
item.PreviousBasicIncrementPercent, item.GFPreviousBasicPercent, item.GFPreviousBasicIncrementPercent,
item.IsDependOnAttendance, item.LTASetupID);
}
#endregion
#region Update
internal static void Update(TransactionContext tc, LTASetup item)
{
tc.ExecuteNonQuery(
"UPDATE LTASetup SET FromMonth=%d, ToMonth=%d, Description=%s, ModifiedBy=%n, ModifiedDate=%d,PayrolltypeID=%n" +
" WHERE LTASetupID=%n", item.FromMonth, item.ToMonth, item.Description, item.ModifiedBy,
item.ModifiedDate, item.PayrollTypeID, item.ID);
}
#endregion
#region Get
internal static IDataReader Get(TransactionContext tc, int id)
{
return tc.ExecuteReader("SELECT * FROM LTASetup WHERE LTASetupID=%n", id);
}
internal static IDataReader GetWithPayrollType(TransactionContext tc, int payrollTypeID)
{
return tc.ExecuteReader("SELECT * FROM LTASetup where payrolltypeid=%n", payrollTypeID);
}
internal static IDataReader Get(TransactionContext tc, DateTime fromMonth, DateTime toMonth, int payrollTypeID)
{
return tc.ExecuteReader("SELECT * FROM LTASetup where payrolltypeid=%n and FromMonth=%d and ToMonth=%d",
payrollTypeID, fromMonth, toMonth);
}
internal static IDataReader GetLTAbasic(TransactionContext tc, int lTAbasicID)
{
return tc.ExecuteReader("SELECT * FROM LTABasic where LTASetupID=%n", lTAbasicID);
}
internal static IDataReader GetLTAbenefit(TransactionContext tc, int lTAbasicID)
{
return tc.ExecuteReader("SELECT * FROM LTABenefit where LTASetupID=%n", lTAbasicID);
}
internal static IDataReader GetDistinctBenefit(TransactionContext tc)
{
return tc.ExecuteReader(
"SELECT distinct* FROM LTABENEFIT WHERE ITEMID IN (SELECT DISTINCT itemid FROM LTABENEFIT)");
}
#endregion
#region Delete
internal static void DeleteChilds(TransactionContext tc, int ltaSetupId)
{
tc.ExecuteNonQuery("DELETE FROM LTABasic WHERE LTASetupID =%n", ltaSetupId);
tc.ExecuteNonQuery("DELETE FROM LTABenefit WHERE LTASetupID =%n", ltaSetupId);
}
internal static void Delete(TransactionContext tc, int ltaSetupId)
{
tc.ExecuteNonQuery("DELETE FROM LTABasic WHERE LTASetupID =%n", ltaSetupId);
tc.ExecuteNonQuery("DELETE FROM LTABenefit WHERE LTASetupID =%n", ltaSetupId);
tc.ExecuteNonQuery("DELETE FROM LTASetup WHERE LTASetupID =%n", ltaSetupId);
}
#endregion
}
}