102 lines
3.7 KiB
C#
102 lines
3.7 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 PayScaleDA
|
|||
|
|
|||
|
internal class PayScaleDA
|
|||
|
{
|
|||
|
#region Constructor
|
|||
|
|
|||
|
private PayScaleDA() { }
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Insert function
|
|||
|
|
|||
|
internal static void Insert(TransactionContext tc, PayScale item)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("INSERT INTO PayScale(PAYSCALEID, GradeID, ALLOWANCEID, InitialAmount, NOOFSLABS, EffectDate,PercentageInc, Type)" +
|
|||
|
" VALUES(%n, %n, %n, %n, %n, %d, %n, %n)", item.ID.Integer, item.GradeID.Integer, item.ItemID, item.InitialAmount, item.NoOfStep, item.EffectDate, item.IncPercentage, item.ItemType);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Update function
|
|||
|
|
|||
|
internal static void Update(TransactionContext tc, PayScale item)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("UPDATE PayScale SET gradeID=%n, ALLOWANCEID=%n, initialAmount=%n, NOOFSLABS=%n, effectDate=%d, PercentageInc=%n, Type=%n" +
|
|||
|
" WHERE PAYSCALEID=%n", item.GradeID.Integer, item.ItemID, item.InitialAmount, item.NoOfStep, item.EffectDate, item.IncPercentage,item.ItemType, item.ID.Integer);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Get Function
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM PayScale");
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, ID nID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM PayScale WHERE PAYSCALEID=%n", nID.Integer);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetByAllowance(TransactionContext tc, ID nAllowID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM PayScale WHERE ALLOWANCEID=%n", nAllowID.Integer);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, ID nGradeID, ID nAllowID, DateTime nextPayProcessDate)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM PayScale WHERE GRADEID=%n AND ALLOWANCEID=%n AND EffectDate=%d", nGradeID.Integer, nAllowID.Integer, nextPayProcessDate);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetMaxEffectDate(TransactionContext tc, ID PayrollTypeID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT Max(EFFECTDATE) FROM PayScale Where GradeID IN(Select GradeID from Grades where PayRollTypeID=%n)", PayrollTypeID.Integer);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetLatest(TransactionContext tc, ID PayrollTypeID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM PayScale WHERE EFFECTDATE =(SELECT MAX(EFFECTDATE) FROM PayScale Where GradeID IN(Select GradeID from Grades where PayRollTypeID=%n))", PayrollTypeID.Integer);
|
|||
|
}
|
|||
|
internal static IDataReader GetByGrade(TransactionContext tc,ID nid)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM PayScale WHERE GRADEID=%n and EffectDate= (SELECT MAX(EFFECTDATE) FROM PayScale)", nid.Integer);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Delete function
|
|||
|
|
|||
|
internal static void Delete(TransactionContext tc, ID nID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("DELETE FROM [PAYSCALEITEM] WHERE PAYSCALEID=%n", nID.Integer);
|
|||
|
tc.ExecuteNonQuery("DELETE FROM [PayScale] WHERE PAYSCALEID=%n", nID.Integer);
|
|||
|
}
|
|||
|
|
|||
|
internal static void DeleteByGrade(TransactionContext tc, ID nGradeID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("DELETE FROM [PAYSCALEITEM] WHERE GRADEID=%n", nGradeID.Integer);
|
|||
|
tc.ExecuteNonQuery("DELETE FROM [PayScale] WHERE GRADEID=%n", nGradeID.Integer);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|