95 lines
4.4 KiB
C#
95 lines
4.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 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.Integer, 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.Integer);
|
|
}
|
|
#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
|
|
}
|