100 lines
3.3 KiB
C#
100 lines
3.3 KiB
C#
|
using HRM.BO;
|
|||
|
using Ease.Core.DataAccess;
|
|||
|
using System;
|
|||
|
using System.Data;
|
|||
|
|
|||
|
|
|||
|
namespace HRM.DA
|
|||
|
{
|
|||
|
public class EmployeeShortLeaveDA
|
|||
|
{
|
|||
|
#region Constructor
|
|||
|
|
|||
|
public EmployeeShortLeaveDA()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Insert function
|
|||
|
|
|||
|
public static void Insert(TransactionContext tc, EmployeeShortLeave oItem)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"INSERT INTO ShortLeave(ShortLeaveID, EmployeeID, DESCRIPTION, FromDate, ToDate, ShortLeaveType, WillReturn)" +
|
|||
|
" VALUES(%n, %n, %s,%D,%D,%n,%n)", oItem.ID, oItem.EmployeeID, oItem.Description, oItem.FromDate,
|
|||
|
oItem.ToDate, oItem.ShortLeaveType, oItem.WillReturn);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Update function
|
|||
|
|
|||
|
public static void Update(TransactionContext tc, EmployeeShortLeave oItem)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"UPDATE ShortLeave SET EmployeeID=%n, Description=%s,FromDate=%D,ToDate=%D,ShortLeaveType=%n,WillReturn=%n" +
|
|||
|
" WHERE ShortLeaveID=%n", oItem.EmployeeID, oItem.Description, oItem.FromDate, oItem.ToDate,
|
|||
|
oItem.ShortLeaveType, oItem.WillReturn, oItem.ID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region Get function
|
|||
|
|
|||
|
public static IDataReader Get(TransactionContext tc)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM ShortLeave ORDER BY ShortLeaveID");
|
|||
|
}
|
|||
|
|
|||
|
public static IDataReader Get(TransactionContext tc, int sLeaveID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM ShortLeave WHERE ShortLeaveID=%n", sLeaveID);
|
|||
|
}
|
|||
|
|
|||
|
public static IDataReader GetByType(TransactionContext tc, int sLType)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM ShortLeave WHERE ShortLeaveType=%n", sLType);
|
|||
|
}
|
|||
|
|
|||
|
public static IDataReader GetByEmpID(TransactionContext tc, int employeeID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM ShortLeave WHERE EmployeeID=%n", employeeID);
|
|||
|
}
|
|||
|
public static IDataReader Get(TransactionContext tc, DateTime startTime, DateTime endTime)
|
|||
|
{
|
|||
|
tc.CommandTimeOut = 6000;
|
|||
|
return tc.ExecuteReader("SELECT * FROM ShortLeave WHERE FromDate between %D and %D", startTime, endTime);
|
|||
|
}
|
|||
|
public static IDataReader GetByEmp(TransactionContext tc, int employeeID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM ShortLeave WHERE EmployeeID=%n", employeeID);
|
|||
|
}
|
|||
|
|
|||
|
public static DataSet GetEmployeeWiseShortLeaveReport(TransactionContext tc, int employeeID)
|
|||
|
{
|
|||
|
string query = string.Empty;
|
|||
|
DataSet dataSet = null;
|
|||
|
|
|||
|
query = "SELECT e.NAME EmployeeName, e.EMPLOYEENO EmployeeNo, d.NAME Designation, sl.* "
|
|||
|
+ "FROM ShortLeave sl INNER JOIN EMPLOYEE e ON e.EMPLOYEEID = sl.EmployeeID INNER JOIN DESIGNATION d ON d.DESIGNATIONID = e.DESIGNATIONID"
|
|||
|
+ "WHERE sl.EmployeeID=%d";
|
|||
|
|
|||
|
dataSet = tc.ExecuteDataSet(query, employeeID);
|
|||
|
|
|||
|
return dataSet;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Delete function
|
|||
|
|
|||
|
public static void Delete(TransactionContext tc, int sLeaveID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("DELETE FROM ShortLeave WHERE ShortLeaveID=%n", sLeaveID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|