81 lines
2.8 KiB
C#
81 lines
2.8 KiB
C#
using Ease.Core.DataAccess;
|
|
using HRM.BO;
|
|
using System;
|
|
using System.Data;
|
|
|
|
namespace HRM.DA
|
|
{
|
|
#region EmpHistoricalDataDA
|
|
|
|
internal class EmpHistoricalDataDA
|
|
{
|
|
#region Constructor
|
|
|
|
private EmpHistoricalDataDA()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Insert function
|
|
|
|
internal static void Insert(TransactionContext tc, EmpHistoricalData item)
|
|
{
|
|
string sSql = SQLParser.MakeSQL(
|
|
"INSERT INTO EmpHistoricalData(EmpHistoricalDataID, EmployeeID, EmployeeNo, Name, EffectDate," +
|
|
" EventType, Designation, EmployeeType, Division, Department, Section, SubSection, Grade," +
|
|
" CostCenter, Location, SubLocation, PFMember, BasicSalary, GrossSalary, PayrollTypeID," +
|
|
" CreatedBy, CreatedDate)" +
|
|
" VALUES(%n, %n, %s, %s, %d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %n, %n, %n, %n, %D)",
|
|
item.ID, item.EmployeeID, item.EmployeeNo, item.Name, item.EffectDate,
|
|
item.EventType, item.Designation, item.EmployeeType, item.Division, item.Department,
|
|
item.Section, item.SubSection, item.Grade, item.CostCenter, item.Location,
|
|
item.SubLocation, item.PFMember, item.BasicSalary, item.GrossSalary, item.PayrollTypeID,
|
|
item.CreatedBy, item.CreatedDate);
|
|
tc.ExecuteNonQuery(sSql);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Function
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int payrollTypeID)
|
|
{
|
|
return tc.ExecuteReader(
|
|
"SELECT * FROM EmpHistoricalData WHERE PayrollTypeID=%n ORDER BY EmployeeNo, EffectDate, EmpHistoricalDataID",
|
|
payrollTypeID);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int id, int payrollTypeID)
|
|
{
|
|
return tc.ExecuteReader(
|
|
"SELECT * FROM EmpHistoricalData WHERE EmpHistoricalDataID=%n AND PayrollTypeID=%n", id,
|
|
payrollTypeID);
|
|
}
|
|
|
|
/// <summary>
|
|
/// EmployeeNo -> EmployeeID for one payroll type, read in a single query so that
|
|
/// a large upload does not do one lookup per row.
|
|
/// </summary>
|
|
internal static IDataReader GetEmployeeNos(TransactionContext tc, int payrollTypeID)
|
|
{
|
|
return tc.ExecuteReader("SELECT EmployeeID, EmployeeNo FROM Employee WHERE PayrollTypeID=%n",
|
|
payrollTypeID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete Function
|
|
|
|
internal static void Delete(TransactionContext tc, int id, int payrollTypeID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM EmpHistoricalData WHERE EmpHistoricalDataID=%n AND PayrollTypeID=%n", id,
|
|
payrollTypeID);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
}
|