95 lines
4.4 KiB
C#
95 lines
4.4 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 OpiParameterIndividualDA
|
|
public class OpiParameterIndividualDA
|
|
{
|
|
#region Constructor
|
|
public OpiParameterIndividualDA() { }
|
|
#endregion
|
|
|
|
#region Insert function
|
|
internal static void Insert(TransactionContext tc, OpiParameterIndividual oItem, ID payrollTypeID)
|
|
{
|
|
string strSQL = SQLParser.MakeSQL(@"INSERT INTO OpiParameterIndividual
|
|
(OpiParameterIndividualID, ArrearType, EmployeeId,
|
|
FromDate, ToDate, IndividualType,
|
|
OpiItemId, OpiParameterId, OpiPeriodicity,
|
|
Value, ValueType, CreatedBy, CreationDate,PayrollTypeID)
|
|
VALUES(%n, %n, %n, %d, %d, %n, %n, %n, %n, %n, %n, %n, %d,%n)",
|
|
oItem.ID.Integer, oItem.ArrearType, oItem.EmployeeId.Integer,
|
|
oItem.FromDate, DataReader.GetNullValue(oItem.ToDate), oItem.IndividualType,
|
|
oItem.OpiItemId.Integer, oItem.OpiParameterID.Integer, oItem.OpiPeriodicity,
|
|
oItem.Value, oItem.ValueType, DataReader.GetNullValue(oItem.CreatedBy.Integer),
|
|
DataReader.GetNullValue(oItem.CreatedDate), payrollTypeID.Integer);
|
|
tc.ExecuteNonQuery(strSQL);
|
|
}
|
|
#endregion
|
|
|
|
#region Update function
|
|
internal static void Update(TransactionContext tc, OpiParameterIndividual oItem, ID payrollTypeID)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
@"UPDATE OpiParameterIndividual SET
|
|
ArrearType=%n, EmployeeId=%n, FromDate=%d,
|
|
ToDate=%d, IndividualType=%n, OpiItemId=%n,
|
|
OpiParameterId=%n, OpiPeriodicity=%n, Value=%n,
|
|
ValueType=%n, ModifiedBy=%n, ModifiedDate=%d,PayrollTypeID = %n
|
|
WHERE OpiParameterIndividualID=%n",
|
|
oItem.ArrearType, oItem.EmployeeId.Integer, oItem.FromDate,
|
|
DataReader.GetNullValue(oItem.ToDate), oItem.IndividualType, oItem.OpiItemId.Integer,
|
|
oItem.OpiParameterID.Integer, oItem.OpiPeriodicity, oItem.Value, oItem.ValueType,
|
|
DataReader.GetNullValue(oItem.ModifiedBy.Integer), DataReader.GetNullValue(oItem.ModifiedDate),
|
|
payrollTypeID.Integer,oItem.ID.Integer);
|
|
}
|
|
#endregion
|
|
|
|
#region Get Function
|
|
internal static IDataReader Get(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM OpiParameterIndividual");
|
|
}
|
|
internal static IDataReader Get(TransactionContext tc, ID nID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM OpiParameterIndividual WHERE OpiParameterIndividualID =%n", nID.Integer);
|
|
}
|
|
internal static IDataReader GetByParameterID(TransactionContext tc, ID nParameterID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM OpiParameterIndividual WHERE OpiParameterID =%n", nParameterID.Integer);
|
|
}
|
|
internal static IDataReader GetIndividuals(TransactionContext tc, ID nOpiPAramID, EnumOPIIndivdualType type)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM OpiParameterIndividual WHERE OpiParameterID=%n AND IndividualType=%n", nOpiPAramID.Integer, type);
|
|
}
|
|
internal static IDataReader Get(TransactionContext tc, DateTime fromDate, DateTime toDate)
|
|
{
|
|
return tc.ExecuteReader("SELECT OPI.* FROM OpiParameter OP, OpiParameterIndividual OPI "
|
|
+ " WHERE OP.OpiParameterID=OPI.OpiParameterID AND OPI.IndividualType=%n AND OP.IsActive <> 0 "
|
|
+ " AND ( (OPI.ToDate >= %d OR OPI.ToDate IS Null) AND "
|
|
+ " (OPI.FromDate <= %d))", EnumOPIIndivdualType.AppliedToIndividual, fromDate, toDate);
|
|
}
|
|
#endregion
|
|
|
|
#region Delete function
|
|
internal static void DeletebyOpiParamId(TransactionContext tc, ID nOpiParamID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM OpiParameterIndividual WHERE OpiParameterID=%n", nOpiParamID.Integer);
|
|
}
|
|
internal static void Delete(TransactionContext tc, ID nID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM [OpiParameterIndividual] WHERE OpiParameterIndividualID=%n", nID.Integer);
|
|
}
|
|
#endregion
|
|
}
|
|
#endregion
|
|
}
|