95 lines
3.4 KiB
C#
95 lines
3.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 OrganogramDelegation DA
|
|
|
|
internal class OrganogramEmployeeDA
|
|
{
|
|
#region Constructor
|
|
|
|
private OrganogramEmployeeDA() { }
|
|
|
|
#endregion
|
|
|
|
#region Insert function
|
|
|
|
internal static void Insert(TransactionContext tc, OrganogramEmployee item)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO OrganEmployee(OrganEmpID,NodeID,EmployeeID,AssignDate,CreatedBy,CreationDate)" +
|
|
" VALUES(%n,%n,%n,%d,%n,%d)",
|
|
item.ID.Integer,item.NodeID.Integer, item.EmployeeID.Integer,item.AssignDate,item.CreatedBy.Integer,item.CreatedDate);
|
|
}
|
|
internal static void InsertForLifeCycle(TransactionContext tc, OrganogramEmployee item,int nID)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO OrganEmployee(OrganEmpID,NodeID,EmployeeID,AssignDate,CreatedBy,CreationDate)" +
|
|
" VALUES(%n,%n,%n,%d,%n,%d)",
|
|
nID, item.NodeID.Integer, item.EmployeeID.Integer, item.AssignDate, item.CreatedBy.Integer, item.CreatedDate);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update function
|
|
|
|
internal static void Update(TransactionContext tc, OrganogramEmployee item)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE OrganEmployee SET NodeID=%n, EmployeeID=%n,AssignDate=%d,ModifiedBy=%n,ModifiedDate=%d" +
|
|
"WHERE OrganEmpID=%n", item.NodeID.Integer, item.EmployeeID.Integer, item.AssignDate,item.ModifiedBy.Integer,item.ModifiedDate,item.ID.Integer);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete function
|
|
|
|
internal static void Delete(TransactionContext tc, ID nID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM OrganEmployee Where OrganEmpID=%n", nID.Integer);
|
|
}
|
|
internal static void DeleteByEmp(TransactionContext tc, ID employeeid)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM OrganEmployee Where EmployeeID=%n", employeeid.Integer);
|
|
}
|
|
#endregion
|
|
|
|
#region Get Function
|
|
internal static IDataReader Get(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM OrganEmployee Order By OrganEmpID");
|
|
}
|
|
internal static IDataReader Get(TransactionContext tc, ID nodeID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM OrganEmployee Where NodeID=%n", nodeID.Integer);
|
|
}
|
|
internal static IDataReader GetByEmp(TransactionContext tc, ID empID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM OrganEmployee Where EmployeeID=%n", empID.Integer);
|
|
}
|
|
|
|
internal static IDataReader GetByPositionType(TransactionContext tc, EnumOGPositionType enPositionType)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"SELECT * FROM OrganEmployee WHERE NodeID in
|
|
(SELECT NodeID
|
|
FROM OrganPosition
|
|
WHERE PositionTypeID In (SELECT OGPositionTypeID
|
|
FROM OGPositionType
|
|
WHERE OGPositionType = %n))",(int)enPositionType);
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
}
|
|
#endregion
|
|
|
|
}
|