EchoTex_Payroll/HRM.DA/DA/Leave/EmpLeaveStatusDA.cs

122 lines
4.5 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
namespace HRM.DA
{
#region EmpLeaveStatus DA
public class EmpLeaveStatusDA
{
#region Constructor
public EmpLeaveStatusDA()
{
}
#endregion
#region Insert function
public static void Insert(TransactionContext tc, EmpLeaveStatus oItem)
{
//oItem.ForBenifitedYear= LeaveEntry.getJulyJuneLeaveYear(oItem.ForBenifitedYear);
tc.ExecuteNonQuery(
"INSERT INTO EmpLeaveStatus(TranId, ProcessId, EmpId, LEAVEYEARID, LeaveId, CarryFromPrvYear, CFDays, EncashDays, EncashAmount, NormalLeaveDays, YearEndBalance, LEAVEAVAILED,OPENINGBALANCE,FORFITEDDAYS)" +
" VALUES(%n, %n, %n, %n, %n,%n, %n, %n, %n, %n, %n,%n,%n,%n)", oItem.ID, oItem.ProcessId, oItem.EmpId,
oItem.LeaveYearID, oItem.LeaveId, oItem.CarryFromPrvYear, oItem.CFDays, oItem.EncashDays,
oItem.EncashAmount,
oItem.NormalLeaveDays, oItem.YearEndBalance, oItem.LeaveAvailed, oItem.OpeningBalance,
oItem.ForfitedDays);
}
#endregion
#region Update function
public static void Update(TransactionContext tc, EmpLeaveStatus oItem)
{
//oItem.ForBenifitedYear = LeaveEntry.getJulyJuneLeaveYear(oItem.ForBenifitedYear);
tc.ExecuteNonQuery(
"UPDATE EmpLeaveStatus SET ProcessId=%n, EmpId=%n, LEAVEYEARID=%n, LeaveId=%n, CarryFromPrvYear=%n, CFDays=%n, EncashDays=%n, EncashAmount=%n, NormalLeaveDays=%n, YearEndBalance=%n,LEAVEAVAILED=%n,OPENINGBALANCE=%n,FORFITEDDAYS=%n" +
" WHERE TranId=%n", oItem.ProcessId, oItem.EmpId, oItem.LeaveYearID, oItem.LeaveId,
oItem.CarryFromPrvYear, oItem.CFDays, oItem.EncashDays, oItem.EncashAmount, oItem.NormalLeaveDays,
oItem.YearEndBalance, oItem.LeaveAvailed, oItem.OpeningBalance, oItem.ForfitedDays, oItem.ID);
}
#endregion
#region ID Generation function
public static int GetNewID(TransactionContext tc)
{
return tc.GenerateID("EmpLeaveStatus", "TranId");
}
#endregion
#region Get Function
public static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM EmpLeaveStatus");
}
public static IDataReader GetStatus(TransactionContext tc, int empid, int leaveID, int leaveYearID)
{
//if(leaveID==0)
// return tc.ExecuteReader("SELECT * FROM EmpLeaveStatus where EMPID=%n AND LEAVEYEARID=%n",empid,leaveYearID);
return tc.ExecuteReader("SELECT * FROM EmpLeaveStatus where EMPID=%n AND LEAVEID=%n AND LEAVEYEARID=%n",
empid, leaveID, leaveYearID);
}
public static IDataReader Get(TransactionContext tc, int nTranId)
{
return tc.ExecuteReader("SELECT * FROM EmpLeaveStatus WHERE TranId=%n", nTranId);
}
public static IDataReader GetAllStatus(TransactionContext tc, int empId)
{
return tc.ExecuteReader("SELECT * FROM EmpLeaveStatus WHERE EMPID=%n", empId);
}
public static IDataReader GetByYear(TransactionContext tc, int ProcessYear, int LeaveId, int EmpId)
{
//ProcessYear = LeaveEntry.getJulyJuneLeaveYear(ProcessYear);
return tc.ExecuteReader(
"SELECT * FROM EmpLeaveStatus WHERE ProcessId in(select ProcessId from LeaveProcess where LEAVEYEARID=%n) and LeaveId=%n and EmpId=%n",
ProcessYear, LeaveId, EmpId);
}
public static IDataReader GetByYear(TransactionContext tc, int LeaveYearID)
{
return tc.ExecuteReader("SELECT * FROM EmpLeaveStatus WHERE LEAVEYEARID=%n", LeaveYearID);
}
public static IDataReader GetByProcessId(TransactionContext tc, int nProcessId)
{
return tc.ExecuteReader("SELECT * FROM EmpLeaveStatus WHERE ProcessId=%n", nProcessId);
}
#endregion
#region Delete function
public static void Delete(TransactionContext tc, int nTranId)
{
tc.ExecuteNonQuery("DELETE FROM EmpLeaveStatus WHERE TranId=%n", nTranId);
}
public static void DeleteByProcessId(TransactionContext tc, int nProcessId)
{
tc.ExecuteNonQuery("DELETE FROM EmpLeaveStatus WHERE ProcessId=%n", nProcessId);
}
#endregion
}
#endregion
}