67 lines
2.3 KiB
C#
67 lines
2.3 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 LeaveException
|
|
public class LeaveExceptionDA
|
|
{
|
|
#region Constructor
|
|
public LeaveExceptionDA() { }
|
|
#endregion
|
|
|
|
#region Insert function
|
|
public static void Insert(TransactionContext tc, LeaveException oItem)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO LeaveException(EmployeeID, StartDate, EndDate, LeaveID, OpeningBalance, MaxDays, CFDays)" +
|
|
" VALUES(%n, %d, %d,%n,%n,%n,%n)", oItem.EmployeeID, oItem.StartDate, oItem.EndDate, oItem.LeaveID, oItem.OpeningBalance, oItem.MaxDays, oItem.CFDays);
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Get Function
|
|
internal static IDataReader Get2(TransactionContext tc, DateTime dFrom, DateTime dTo)
|
|
{
|
|
|
|
return tc.ExecuteReader(@"SELECT * FROM LeaveException le,employee emp
|
|
WHERE emp.EMPLOYEEID=le.EmployeeID AND startdate between %d AND %d
|
|
Order By emp.EMPLOYEENO,le.StartDate", dFrom,dTo);
|
|
}
|
|
internal static IDataReader GetByEmpID(TransactionContext tc, int nLeaveID,int nEmpID)
|
|
{
|
|
return tc.ExecuteReader(@"SELECT * FROM LeaveException
|
|
where LeaveExceptionid IN(
|
|
SELECT MAX(LeaveExceptionid) FROM LeaveException where employeeid=%n
|
|
AND leaveid=%n
|
|
GROUP BY employeeid)
|
|
AND employeeid=%n
|
|
AND leaveid=%n", nEmpID, nLeaveID, nEmpID, nLeaveID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete function
|
|
public static void DeleteItem(TransactionContext tc, int nID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM LeaveException WHERE LeaveExceptionID=%n", nID);
|
|
}
|
|
public static void Delete(TransactionContext tc, int nEmployeeID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM LeaveException WHERE EmployeeID=%n ", nEmployeeID);
|
|
}
|
|
#endregion
|
|
}
|
|
#endregion
|
|
|
|
}
|