717 lines
23 KiB
C#
717 lines
23 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using Ease.CoreV35;
|
|
using Ease.CoreV35.Model;
|
|
using Ease.CoreV35.DataAccess;
|
|
using System.Collections.Generic;
|
|
using Payroll.BO;
|
|
using Ease.CoreV35.Caching;
|
|
|
|
namespace Payroll.Service
|
|
{
|
|
#region EmployeeUnAuthorizeLeave Service
|
|
[Serializable]
|
|
public class EmployeeUnAuthorizeLeaveService : ServiceTemplate, IEmployeeUnAuthorizeLeaveService
|
|
{
|
|
#region Private functions and declaration
|
|
Cache _cache = new Cache(typeof(EmployeeUnAuthorizeLeave));
|
|
|
|
#endregion
|
|
public EmployeeUnAuthorizeLeaveService() { }
|
|
|
|
private void MapObject(EmployeeUnAuthorizeLeave oEmployeeUnAuthorizeLeave, DataReader oReader)
|
|
{
|
|
base.SetObjectID(oEmployeeUnAuthorizeLeave, oReader.GetID("EmpLeaveID"));
|
|
oEmployeeUnAuthorizeLeave.EmployeeID = oReader.GetID("EmployeeID");
|
|
oEmployeeUnAuthorizeLeave.UnAuthorizeleaveID = oReader.GetID("LeaveID");
|
|
oEmployeeUnAuthorizeLeave.MonthDate = oReader.GetDateTime("MonthDate").Value;
|
|
oEmployeeUnAuthorizeLeave.LeaveDays = oReader.GetInt32("LEAVEDAY").Value;
|
|
oEmployeeUnAuthorizeLeave.LeaveMonth = oReader.GetDateTime("LEAVEMONTH").Value;
|
|
oEmployeeUnAuthorizeLeave.FromDate = oReader.GetDateTime("FROMDATE").Value;
|
|
oEmployeeUnAuthorizeLeave.ToDate = oReader.GetDateTime("TODATE").Value;
|
|
oEmployeeUnAuthorizeLeave.CreatedBy = oReader.GetID("CreatedBy");
|
|
oEmployeeUnAuthorizeLeave.CreatedDate = oReader.GetDateTime("CreationDate").Value;
|
|
oEmployeeUnAuthorizeLeave.ModifiedBy = oReader.GetID("ModifiedBy");
|
|
oEmployeeUnAuthorizeLeave.ModifiedDate = oReader.GetDateTime("ModifiedDate").HasValue ? oReader.GetDateTime("ModifiedDate") : (DateTime?)null;
|
|
oEmployeeUnAuthorizeLeave.Type = (EnumLeaveEntryType)oReader.GetInt32("Type").Value;
|
|
oEmployeeUnAuthorizeLeave.ReferenceID = oReader.GetID("ReferenceID");
|
|
oEmployeeUnAuthorizeLeave.ParamID = oReader.GetID("ParamID");
|
|
oEmployeeUnAuthorizeLeave.RemainingDays = oReader.GetInt32("RemainingDays").Value;
|
|
this.SetObjectState(oEmployeeUnAuthorizeLeave, Ease.CoreV35.ObjectState.Saved);
|
|
}
|
|
protected override T CreateObject<T>(DataReader oReader)
|
|
{
|
|
EmployeeUnAuthorizeLeave oEmployeeUnAuthorizeLeave = new EmployeeUnAuthorizeLeave();
|
|
MapObject(oEmployeeUnAuthorizeLeave, oReader);
|
|
return oEmployeeUnAuthorizeLeave as T;
|
|
}
|
|
protected EmployeeUnAuthorizeLeave CreateObject(DataReader oReader)
|
|
{
|
|
EmployeeUnAuthorizeLeave oEmployeeUnAuthorizeLeave = new EmployeeUnAuthorizeLeave();
|
|
MapObject(oEmployeeUnAuthorizeLeave, oReader);
|
|
return oEmployeeUnAuthorizeLeave;
|
|
}
|
|
#region Service implementation
|
|
|
|
public EmployeeUnAuthorizeLeave Get(ID id)
|
|
{
|
|
EmployeeUnAuthorizeLeave oEmployeeUnAuthorizeLeave = new EmployeeUnAuthorizeLeave();
|
|
#region Cache Header
|
|
oEmployeeUnAuthorizeLeave = _cache["Get", id] as EmployeeUnAuthorizeLeave;
|
|
if (oEmployeeUnAuthorizeLeave != null)
|
|
return oEmployeeUnAuthorizeLeave;
|
|
#endregion
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
DataReader oreader = new DataReader(EmployeeUnAuthorizeLeaveDA.Get(tc, id));
|
|
if (oreader.Read())
|
|
{
|
|
oEmployeeUnAuthorizeLeave = this.CreateObject<EmployeeUnAuthorizeLeave>(oreader);
|
|
}
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
throw new ServiceException(e.Message, e);
|
|
#endregion
|
|
}
|
|
#region Cache Footer
|
|
_cache.Add(oEmployeeUnAuthorizeLeave, "Get", id);
|
|
#endregion
|
|
return oEmployeeUnAuthorizeLeave;
|
|
}
|
|
|
|
public ObjectsTemplate<EmployeeUnAuthorizeLeave> Get(EnumLeaveEntryType type, DateTime month)
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<EmployeeUnAuthorizeLeave> employeeUnAuthorizeLeaves = _cache["Get", type] as ObjectsTemplate<EmployeeUnAuthorizeLeave>;
|
|
if (employeeUnAuthorizeLeaves != null)
|
|
return employeeUnAuthorizeLeaves;
|
|
|
|
#endregion
|
|
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
|
|
DataReader dr = new DataReader(EmployeeUnAuthorizeLeaveDA.Get(tc, type, month));
|
|
employeeUnAuthorizeLeaves = this.CreateObjects<EmployeeUnAuthorizeLeave>(dr);
|
|
dr.Close();
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(employeeUnAuthorizeLeaves, "Get", type);
|
|
|
|
#endregion
|
|
|
|
return employeeUnAuthorizeLeaves;
|
|
}
|
|
|
|
|
|
public ObjectsTemplate<EmployeeUnAuthorizeLeave> Get(DateTime fromDate, DateTime toDate,
|
|
EnumLeaveEntryType type)
|
|
{
|
|
ObjectsTemplate<EmployeeUnAuthorizeLeave> employeeUnAuthorizeLeaves = null;
|
|
|
|
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
|
|
DataReader dr = new DataReader(EmployeeUnAuthorizeLeaveDA.Get(tc, fromDate, toDate, type));
|
|
employeeUnAuthorizeLeaves = this.CreateObjects<EmployeeUnAuthorizeLeave>(dr);
|
|
dr.Close();
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return employeeUnAuthorizeLeaves;
|
|
}
|
|
|
|
public ObjectsTemplate<EmployeeUnAuthorizeLeave> Get()
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<EmployeeUnAuthorizeLeave> employeeUnAuthorizeLeaves = _cache["Get"] as ObjectsTemplate<EmployeeUnAuthorizeLeave>;
|
|
if (employeeUnAuthorizeLeaves != null)
|
|
return employeeUnAuthorizeLeaves;
|
|
|
|
#endregion
|
|
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
|
|
DataReader dr = new DataReader(EmployeeUnAuthorizeLeaveDA.Get(tc));
|
|
employeeUnAuthorizeLeaves = this.CreateObjects<EmployeeUnAuthorizeLeave>(dr);
|
|
dr.Close();
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(employeeUnAuthorizeLeaves, "Get");
|
|
|
|
#endregion
|
|
|
|
return employeeUnAuthorizeLeaves;
|
|
}
|
|
|
|
public ObjectsTemplate<EmployeeUnAuthorizeLeave> GetByEmployee(ID nEmpID, EnumLeaveEntryType type)
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<EmployeeUnAuthorizeLeave> employeeUnAuthorizeLeaves = _cache["GetByEmployee", nEmpID, type] as ObjectsTemplate<EmployeeUnAuthorizeLeave>;
|
|
if (employeeUnAuthorizeLeaves != null)
|
|
return employeeUnAuthorizeLeaves;
|
|
|
|
#endregion
|
|
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
|
|
DataReader dr = new DataReader(EmployeeUnAuthorizeLeaveDA.GetByEmployee(tc, nEmpID, type));
|
|
employeeUnAuthorizeLeaves = this.CreateObjects<EmployeeUnAuthorizeLeave>(dr);
|
|
dr.Close();
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(employeeUnAuthorizeLeaves, "GetByEmployee", nEmpID, type);
|
|
|
|
#endregion
|
|
|
|
return employeeUnAuthorizeLeaves;
|
|
}
|
|
|
|
public EmployeeUnAuthorizeLeave GetLeaveTypeByEmployee(ID nEmpID, DateTime dMonth, EnumLeaveEntryType type)
|
|
{
|
|
#region Cache Header
|
|
|
|
EmployeeUnAuthorizeLeave employeeUnAuthorizeLeave = null;
|
|
if (employeeUnAuthorizeLeave != null)
|
|
return employeeUnAuthorizeLeave;
|
|
|
|
#endregion
|
|
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
DataReader oreader = new DataReader(EmployeeUnAuthorizeLeaveDA.GetLeaveTypeByEmployee(tc, nEmpID, dMonth, type));
|
|
if (oreader.Read())
|
|
{
|
|
employeeUnAuthorizeLeave = this.CreateObject<EmployeeUnAuthorizeLeave>(oreader);
|
|
}
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(employeeUnAuthorizeLeave, "GetByEmployee", nEmpID, dMonth, type);
|
|
|
|
#endregion
|
|
|
|
return employeeUnAuthorizeLeave;
|
|
}
|
|
|
|
public int AdjustedDays(ID nID)
|
|
{
|
|
int nAjustedDays = 0;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
nAjustedDays = EmployeeUnAuthorizeLeaveDA.GetAdjustedDays(tc, nID);
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
return nAjustedDays;
|
|
}
|
|
|
|
public int AdjustedDays(ID nID, DateTime month)
|
|
{
|
|
int nAjustedDays = 0;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
nAjustedDays = EmployeeUnAuthorizeLeaveDA.GetAdjustedDays(tc, nID, month);
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
return nAjustedDays;
|
|
}
|
|
|
|
public ObjectsTemplate<EmployeeUnAuthorizeLeave> GetDeductedLeaves(ID nEmpID, ID nLeaveID, EnumLeaveEntryType type, DateTime nextPayProcessDate)
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<EmployeeUnAuthorizeLeave> employeeUnAuthorizeLeaves = _cache["GetDeductedLeaves", nEmpID, nLeaveID, type] as ObjectsTemplate<EmployeeUnAuthorizeLeave>;
|
|
if (employeeUnAuthorizeLeaves != null)
|
|
return employeeUnAuthorizeLeaves;
|
|
|
|
#endregion
|
|
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
|
|
DataReader dr = new DataReader(EmployeeUnAuthorizeLeaveDA.GetDeductedLeave(tc, nEmpID, nLeaveID, type, nextPayProcessDate));
|
|
employeeUnAuthorizeLeaves = this.CreateObjects<EmployeeUnAuthorizeLeave>(dr);
|
|
dr.Close();
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(employeeUnAuthorizeLeaves, "GetDeductedLeaves", nEmpID, nLeaveID, type);
|
|
|
|
#endregion
|
|
|
|
return employeeUnAuthorizeLeaves;
|
|
}
|
|
|
|
public ObjectsTemplate<EmployeeUnAuthorizeLeave> GetByEmployee(ID nEmpID, DateTime dMonth, EnumLeaveEntryType type)
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<EmployeeUnAuthorizeLeave> employeeUnAuthorizeLeaves = _cache["GetByEmployee", nEmpID, dMonth, type] as ObjectsTemplate<EmployeeUnAuthorizeLeave>;
|
|
if (employeeUnAuthorizeLeaves != null)
|
|
return employeeUnAuthorizeLeaves;
|
|
|
|
#endregion
|
|
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
|
|
DataReader dr = new DataReader(EmployeeUnAuthorizeLeaveDA.GetByEmployee(tc, nEmpID, dMonth, type));
|
|
employeeUnAuthorizeLeaves = this.CreateObjects<EmployeeUnAuthorizeLeave>(dr);
|
|
dr.Close();
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(employeeUnAuthorizeLeaves, "GetByEmployee", nEmpID, dMonth, type);
|
|
|
|
#endregion
|
|
|
|
return employeeUnAuthorizeLeaves;
|
|
}
|
|
|
|
public ObjectsTemplate<EmployeeUnAuthorizeLeave> GetByEmployee(ID nEmpID, ID nLeaveID, EnumLeaveEntryType type)
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<EmployeeUnAuthorizeLeave> employeeUnAuthorizeLeaves = _cache["GetByEmployee", nEmpID, nLeaveID, type] as ObjectsTemplate<EmployeeUnAuthorizeLeave>;
|
|
if (employeeUnAuthorizeLeaves != null)
|
|
return employeeUnAuthorizeLeaves;
|
|
|
|
#endregion
|
|
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
|
|
DataReader dr = new DataReader(EmployeeUnAuthorizeLeaveDA.GetByEmployee(tc, nEmpID, nLeaveID, type));
|
|
employeeUnAuthorizeLeaves = this.CreateObjects<EmployeeUnAuthorizeLeave>(dr);
|
|
dr.Close();
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(employeeUnAuthorizeLeaves, "GetByEmployee", nEmpID, nLeaveID, type);
|
|
|
|
#endregion
|
|
|
|
return employeeUnAuthorizeLeaves;
|
|
}
|
|
|
|
public ID Save(EmployeeUnAuthorizeLeave oEmployeeUnAuthorizeLeave)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
if (oEmployeeUnAuthorizeLeave.IsNew)
|
|
{
|
|
int id = tc.GenerateID("MONTHLYLEAVEENTRY", "EmpLeaveID");
|
|
base.SetObjectID(oEmployeeUnAuthorizeLeave, ID.FromInteger(id));
|
|
EmployeeUnAuthorizeLeaveDA.Insert(tc, oEmployeeUnAuthorizeLeave);
|
|
}
|
|
else
|
|
{
|
|
EmployeeUnAuthorizeLeaveDA.Update(tc, oEmployeeUnAuthorizeLeave);
|
|
}
|
|
tc.End();
|
|
return oEmployeeUnAuthorizeLeave.ID;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
throw new ServiceException(e.Message, e);
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
public void Save(TransactionContext tc, EmployeeUnAuthorizeLeave oEmployeeUnAuthorizeLeave)
|
|
{
|
|
try
|
|
{
|
|
int id = tc.GenerateID("MONTHLYLEAVEENTRY", "EmpLeaveID");
|
|
base.SetObjectID(oEmployeeUnAuthorizeLeave, ID.FromInteger(id));
|
|
EmployeeUnAuthorizeLeaveDA.Insert(tc, oEmployeeUnAuthorizeLeave);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
throw new ServiceException(e.Message, e);
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
public void Delete(ID id)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
EmployeeUnAuthorizeLeaveDA.Delete(tc, id);
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
throw new ServiceException(e.Message, e);
|
|
#endregion
|
|
}
|
|
}
|
|
public void SaveAuthorizeLeave(ID employeeId, DateTime month, ObjectsTemplate<EmployeeUnAuthorizeLeave> empLeaves)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
EmployeeUnAuthorizeLeaveDA.Delete(tc, month, employeeId);
|
|
foreach (EmployeeUnAuthorizeLeave leave in empLeaves)
|
|
{
|
|
leave.Type = EnumLeaveEntryType.PaidLeave;
|
|
leave.EmployeeID = employeeId;
|
|
leave.MonthDate = month;
|
|
this.Save(tc, leave);
|
|
}
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
throw new ServiceException(e.Message, e);
|
|
#endregion
|
|
}
|
|
|
|
}
|
|
public void Save(ObjectsTemplate<EmployeeUnAuthorizeLeave> empLeaves)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
|
|
//string sEmpIDs = string.Empty;
|
|
//string sLeaveIDs = string.Empty;
|
|
//EnumLeaveEntryType type = EnumLeaveEntryType.Normal;
|
|
|
|
|
|
//foreach (EmployeeUnAuthorizeLeave leave in empLeaves)
|
|
//{
|
|
// sEmpIDs += leave.EmployeeID.Integer + ",";
|
|
// sLeaveIDs += leave.UnAuthorizeleaveID.Integer + ",";
|
|
// type = leave.Type;
|
|
//}
|
|
|
|
//if (sEmpIDs.Length > 0)
|
|
//{
|
|
// sEmpIDs = sEmpIDs.Substring(0, sEmpIDs.Length - 1);
|
|
// sLeaveIDs = sLeaveIDs.Substring(0, sLeaveIDs.Length - 1);
|
|
//}
|
|
|
|
EmployeeUnAuthorizeLeaveDA.Delete(tc, SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|
foreach (EmployeeUnAuthorizeLeave leave in empLeaves)
|
|
{
|
|
this.Save(tc, leave);
|
|
}
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
throw new ServiceException(e.Message, e);
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
public DataSet GetUnAuthorizeLeave(DateTime date)
|
|
{
|
|
DataSet unAuthoLeaves = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
unAuthoLeaves = EmployeeUnAuthorizeLeaveDA.GetUnAuthorizeLeave(tc, date);
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
return unAuthoLeaves;
|
|
}
|
|
public DataSet GetCurrentUnAuthorizeLeave(DateTime date)
|
|
{
|
|
DataSet unAuthoLeaves = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
unAuthoLeaves = EmployeeUnAuthorizeLeaveDA.GetCurrentUnAuthorizeLeave(tc, date);
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
return unAuthoLeaves;
|
|
}
|
|
public DataSet GetPreviousUnAuthorizeLeave(DateTime date)
|
|
{
|
|
DataSet unAuthoLeaves = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
unAuthoLeaves = EmployeeUnAuthorizeLeaveDA.GetPreviousUnAuthorizeLeave(tc, date);
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
return unAuthoLeaves;
|
|
}
|
|
public DataSet GetUnPaidLeave(int nYear)
|
|
{
|
|
DataSet unAuthoLeaves = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
unAuthoLeaves = EmployeeUnAuthorizeLeaveDA.GetUnPaidLeave(tc,nYear);
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
return unAuthoLeaves;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
#endregion
|
|
}
|