230 lines
8.0 KiB
C#
230 lines
8.0 KiB
C#
|
using Ease.Core.DataAccess;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using HRM.BO;
|
|||
|
using System.Data;
|
|||
|
|
|||
|
namespace HRM.DA
|
|||
|
{
|
|||
|
#region SettlementClearance
|
|||
|
|
|||
|
public class SettlementClearanceDA
|
|||
|
{
|
|||
|
#region Constructor
|
|||
|
|
|||
|
public SettlementClearanceDA()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Insert function
|
|||
|
|
|||
|
public static void Insert(TransactionContext tc, SettlementClearance item)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"
|
|||
|
INSERT INTO SettlementClearance(SettlementClearanceID, UserID, EmployeeID, SettlementClearanceStatus,SentDate, ClearanceDate, CreatedBy, CreatedDate,EmpCleranceID,ResignationRequestID)
|
|||
|
VALUES(%n, %n, %n, %n, %d, %d, %n, %d,%n,%n)",
|
|||
|
item.ID, item.UserID, item.EmployeeID, (int)item.SettlementClearanceStatus, DataReader.GetNullValue(item.SentDate),
|
|||
|
DataReader.GetNullValue(item.ClearanceDate), item.CreatedBy, item.CreatedDate,item.EmpClearanceID,item.ResignationRequestID);
|
|||
|
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Update function
|
|||
|
|
|||
|
public static void Update(TransactionContext tc, SettlementClearance item)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"
|
|||
|
UPDATE SettlementClearance
|
|||
|
SET UserID=%n, EmployeeID=%n, SettlementClearanceStatus=%n,SentDate=%d, ClearanceDate=%d, ModifiedBy=%n, ModifiedDate=%d,EmpCleranceID=%n,ResignationRequestID=%n
|
|||
|
WHERE SettlementClearanceID=%n",
|
|||
|
item.UserID, item.EmployeeID, (int)item.SettlementClearanceStatus, item.SentDate, item.ClearanceDate, item.ModifiedBy,
|
|||
|
item.ModifiedDate,item.EmpClearanceID,item.ResignationRequestID, item.ID);
|
|||
|
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM SettlementClearance");
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"
|
|||
|
SELECT * FROM SettlementClearance
|
|||
|
WHERE SettlementClearanceID = %n",
|
|||
|
id);
|
|||
|
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static void UpdateResignationStatus(TransactionContext tc, int pkid, EnumResignStatus status)
|
|||
|
{
|
|||
|
string ssql = "";
|
|||
|
|
|||
|
ssql = SQLParser.MakeSQL(
|
|||
|
"UPDATE EmpResignationRequest SET WFStatus=%n WHERE ResignationRequestId=%n",
|
|||
|
(int)status,
|
|||
|
pkid);
|
|||
|
|
|||
|
tc.ExecuteNonQuery(ssql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, int notifiedEmpID, int empResignationID)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"
|
|||
|
SELECT * FROM SettlementClearance
|
|||
|
WHERE EmployeeID = %n and EmpCleranceID =%n",
|
|||
|
notifiedEmpID, empResignationID);
|
|||
|
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
internal static void Delete(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"
|
|||
|
DELETE SettlementClearance
|
|||
|
WHERE SettlementClearanceID = %n",
|
|||
|
id);
|
|||
|
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetByEmpID(TransactionContext tc, int empID)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"
|
|||
|
SELECT * FROM SettlementClearance
|
|||
|
WHERE EmployeeID = %n",
|
|||
|
empID);
|
|||
|
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetByResignationRequestId(TransactionContext tc, int ResignationRequestID)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"
|
|||
|
SELECT * FROM SettlementClearance
|
|||
|
WHERE ResignationRequestId = %n",
|
|||
|
ResignationRequestID);
|
|||
|
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetByRegEmpID(TransactionContext tc, int resEmpid, int empID)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"
|
|||
|
SELECT * FROM SettlementClearance
|
|||
|
WHERE empCleranceID = %n and EmployeeID=%n",
|
|||
|
resEmpid, empID);
|
|||
|
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetByUserID(TransactionContext tc, int userID)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"
|
|||
|
SELECT * FROM SettlementClearance
|
|||
|
WHERE UserID = %n",
|
|||
|
userID);
|
|||
|
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetByStatus(TransactionContext tc, EnumSettlementClearanceStatus scStatus)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"
|
|||
|
SELECT * FROM SettlementClearance
|
|||
|
WHERE SettlementClearanceStatus = %n",
|
|||
|
scStatus);
|
|||
|
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetBySentDate(TransactionContext tc, DateTime sentDate)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"
|
|||
|
SELECT * FROM SettlementClearance
|
|||
|
WHERE SentDate = %d",
|
|||
|
sentDate);
|
|||
|
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetBySentDateRange(TransactionContext tc, DateTime fromSentDate, DateTime toSentDate)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"
|
|||
|
SELECT * FROM SettlementClearance
|
|||
|
WHERE SentDate BETWEEN %d AND %d",
|
|||
|
fromSentDate, toSentDate);
|
|||
|
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetByClearanceDate(TransactionContext tc, DateTime clearanceDate)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"
|
|||
|
SELECT * FROM SettlementClearance
|
|||
|
WHERE ClearanceDate = %d",
|
|||
|
clearanceDate);
|
|||
|
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetByClearanceDateRange(TransactionContext tc, DateTime fromClearanceDate, DateTime toClearanceDate)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"
|
|||
|
SELECT * FROM SettlementClearance
|
|||
|
WHERE ClearanceDate BETWEEN %d AND %d",
|
|||
|
fromClearanceDate, toClearanceDate);
|
|||
|
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static DataTable GetClearanceEmployee(TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"
|
|||
|
select distinct e.EMPLOYEEID, e.EMPLOYEENO, e.NAME, c.SentDate RequestDate, c.ClearanceDate
|
|||
|
from SettlementClearance c, employee e where
|
|||
|
c.EmpCleranceid= e.employeeid and c.SettlementClearanceStatus =%n", EnumSettlementClearanceStatus.Pending);
|
|||
|
|
|||
|
return tc.ExecuteDataTable(sql);
|
|||
|
}
|
|||
|
internal static bool IsClearanceEmp(TransactionContext tc, int employeeid)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"
|
|||
|
select c.EmpCleranceid
|
|||
|
from SettlementClearance c where
|
|||
|
c.EmpCleranceid = %n and c.SettlementClearanceStatus =%n", employeeid, EnumSettlementClearanceStatus.Pending);
|
|||
|
object rvalue ;
|
|||
|
rvalue = tc.ExecuteScalar(sql);
|
|||
|
if (rvalue == DBNull.Value) return false;
|
|||
|
else return true;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
internal static void UpdateSettlementClearance(TransactionContext tc, int employeeid, int regEmpId)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("UPDATE SettlementClearance SET SettlementClearanceStatus=%n,ClearanceDate=%D " +
|
|||
|
" WHERE EmployeeId=%n AND ResignationRequestId=%n", (int)EnumSettlementClearanceStatus.Completed,DateTime.Now,
|
|||
|
employeeid, regEmpId);
|
|||
|
}
|
|||
|
|
|||
|
//internal static void isFsCompleted(TransactionContext tc, int employeeid, int regEmpId)
|
|||
|
//{
|
|||
|
// tc.ExecuteNonQuery("UPDATE SettlementClearance SET SettlementClearanceStatus=%n,ClearanceDate=%D " +
|
|||
|
// " WHERE EmployeeId=%n AND EmpCleranceID=%n", (int)EnumSettlementClearanceStatus.Completed, DateTime.Now,
|
|||
|
// employeeid, regEmpId);
|
|||
|
//}
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|