CEL_Payroll/Payroll.Service/Basic/DA/PayScaleDetailDA.cs

83 lines
2.9 KiB
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
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 PayScaleDetailDA
internal class PayScaleDetailDA
{
#region Constructor
private PayScaleDetailDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, PayScaleDetail item)
{
tc.ExecuteNonQuery("INSERT INTO PAYSCALEITEM(PAYSCALEITEMID, PAYSCALEID, GRADEID, SCALESERIALNO, ALLOWANCEID, AMOUNT, SLABAMOUNT,StepIncrement)" +
" VALUES(%n, %n, %n, %n, %n, %n, %n,%n)", item.ID.Integer, item.PayscaleID.Integer, item.GradeID.Integer, item.StepNo, item.AllowanceID.Integer, item.Amount, item.StepAmount,item.StepIncrement);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM PAYSCALEITEM");
}
internal static IDataReader Get(TransactionContext tc, ID nGradeID, ID nAllowID)
{
return tc.ExecuteReader("SELECT * FROM PAYSCALEITEM WHERE GRADEID=%n AND ALLOWANCEID=%n Order By SCALESERIALNO", nGradeID.Integer, nAllowID.Integer);
}
internal static IDataReader GetByGradeID(TransactionContext tc, ID nGradeID, ID PayrollTypeID)
{
return tc.ExecuteReader(@"select * from PayScaleItem where PayScaleID IN(SELECT PayScaleID FROM PayScale
Where GradeID IN(Select GradeID from Grades where PayRollTypeID=%n and GradeID=%n) and EffectDate=(select max(EffectDate) from PayScale where GradeID=%n))", PayrollTypeID.Integer, nGradeID.Integer,nGradeID.Integer);
//return tc.ExecuteReader("SELECT * FROM PAYSCALEITEM WHERE GRADEID=%n and EffectDate=%d Order By SCALESERIALNO", nGradeID.Integer, Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
}
internal static IDataReader Get(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("SELECT * FROM PAYSCALEITEM WHERE PayScaleItemID=%n", nID.Integer);
}
internal static IDataReader GetByPayScale(TransactionContext tc, ID payscaleID)
{
return tc.ExecuteReader("SELECT * FROM PAYSCALEITEM WHERE PAYSCALEID=%n", payscaleID.Integer);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM [PAYSCALEITEM] WHERE PayScaleDetailID=%n", nID.Integer);
}
internal static void DeleteByPayScaleID(TransactionContext tc, ID nPayScaleID)
{
tc.ExecuteNonQuery("DELETE FROM [PAYSCALEITEM] WHERE PAYSCALEID=%n", nPayScaleID.Integer);
}
#endregion
}
#endregion
}