101 lines
3.9 KiB
C#
101 lines
3.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Ease.CoreV35.DataAccess;
|
|
using Payroll.BO;
|
|
using System.Data;
|
|
using Ease.Core.DataAccess;
|
|
using HRM.BO;
|
|
|
|
namespace Payroll.Service
|
|
{
|
|
#region ClaimPaymentDA
|
|
|
|
internal class ClaimPaymentDA
|
|
{
|
|
#region Constructor
|
|
|
|
private ClaimPaymentDA() { }
|
|
|
|
#endregion
|
|
|
|
#region Insert function
|
|
|
|
internal static void Insert(TransactionContext tc, ClaimPayment item)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO ClaimPayment(ClaimPaymentID, IsAnnualDisbursment, IsActualPayment, ClaimType, MaxServiceLength, MonthDifference,NoOfDependent,Status, CreatedBy, CreatedDate, PayrollTypeID, IsNotMaximum)" +
|
|
" VALUES(%n, %n, %n, %n, %n, %n,%n,%n, %n, %d, %n, %n)", item.ID, item.IsAnnualDisbursment, item.IsActualPayment, item.ClaimType, item.MaxServiceLength, item.MonthDifference, item.NoOfDependent, item.Status, item.CreatedBy, item.CreatedDate, item.PayrollTypeID, item.IsNotMaximum);
|
|
}
|
|
|
|
|
|
internal static void InsertChild(TransactionContext tc, ClaimPaymentGrades item)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO ClaimPaymentGrades(ClaimPaymentGradesID, ClaimPaymentID, GradeID, Amount)" +
|
|
" VALUES(%n, %n, %n, %n)", item.ID, item.ClaimPaymentID, item.GradeID, item.Amount);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update function
|
|
|
|
internal static void Update(TransactionContext tc, ClaimPayment item)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE ClaimPayment SET IsAnnualDisbursment=%n, IsActualPayment=%n, ClaimType=%n, MaxServiceLength=%n, MonthDifference=%n,NoOfDependent=%n,Status=%n, PayrollTypeID=%n, ModifiedBy=%n, ModifiedDate=%d, IsNotMaximum=%n" +
|
|
" WHERE ClaimPaymentID=%n", item.IsAnnualDisbursment, item.IsActualPayment, item.ClaimType, item.MaxServiceLength, item.MonthDifference, item.NoOfDependent, item.Status, item.PayrollTypeID, item.ModifiedBy, item.ModifiedDate, item.IsNotMaximum, item.ID);
|
|
}
|
|
#endregion
|
|
|
|
#region Get Function
|
|
|
|
internal static IDataReader Get(TransactionContext tc, EnumStatus status, int payrollTypeID)
|
|
{
|
|
if (EnumStatus.Active == status)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM ClaimPayment where Status=%n and PayRollTypeID = %n ", status, payrollTypeID);
|
|
}
|
|
else
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM ClaimPayment Where PayRollTypeID = %n ", payrollTypeID);
|
|
}
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int nID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM ClaimPayment WHERE ClaimPaymentID=%n and PayRollTypeID = %n", nID);//need to add payrolltypeID
|
|
}
|
|
|
|
internal static IDataReader GetChild(TransactionContext tc, int attnNationalHolidayID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM ClaimPaymentGrades WHERE ClaimPaymentID=%n", attnNationalHolidayID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete function
|
|
|
|
internal static void DeleteByType(TransactionContext tc, EnumClaimType claimType)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM ClaimPayment WHERE ClaimType=%n", (int) claimType);
|
|
}
|
|
|
|
internal static void Delete(TransactionContext tc, int nID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM ClaimPayment WHERE ClaimPaymentID=%n", nID);
|
|
}
|
|
internal static void DeleteChild(TransactionContext tc, int nID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM ClaimPaymentGrades WHERE ClaimPaymentID=%n", nID);
|
|
}
|
|
|
|
internal static void DeleteChildByType(TransactionContext tc, EnumClaimType claimType)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM ClaimPaymentGrades WHERE ClaimPaymentID in (Select ClaimPaymentID FROM ClaimPayment WHERE ClaimType=%n)", (int)claimType);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
}
|