361 lines
14 KiB
C#
361 lines
14 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 EmpLeaveStatus Service
|
|
// [Serializable]
|
|
// public class EmpLeaveStatusService : ServiceTemplate, ILeaveProcessService
|
|
// {
|
|
// #region Private functions and declaration
|
|
// Cache _cache = new Cache(typeof(EmpLeaveStatus));
|
|
|
|
// public EmpLeaveStatusService() { }
|
|
|
|
// private void MapObject(EmpLeaveStatus oEmpLeaveStatus, DataReader oReader)
|
|
// {
|
|
// //this.SetObjectID(oEmpLeaveStatus,ID.FromInteger(oReader.GetInt32("TranId")));
|
|
// base.SetObjectID(oEmpLeaveStatus, oReader.GetID("TranId"));
|
|
// oEmpLeaveStatus.ProcessId = oReader.GetInt32("ProcessId").Value;
|
|
// oEmpLeaveStatus.EmpId = oReader.GetInt32("EmpId").Value;
|
|
// oEmpLeaveStatus.LeaveYearID = oReader.GetInt32("LEAVEYEARID").Value;
|
|
// oEmpLeaveStatus.LeaveId = oReader.GetInt32("LeaveId").Value;
|
|
// //oEmpLeaveStatus.GradeId = oReader.GetInt32("GradeId");
|
|
// //oEmpLeaveStatus.ParamId = oReader.GetInt32("ParamId");
|
|
// oEmpLeaveStatus.CarryFromPrvYear = oReader.GetDouble("CarryFromPrvYear").Value;
|
|
// oEmpLeaveStatus.CFDays = oReader.GetDouble("CFDays").Value;
|
|
// oEmpLeaveStatus.EncashDays = oReader.GetDouble("EncashDays").Value;
|
|
// oEmpLeaveStatus.EncashAmount = oReader.GetDouble("EncashAmount").Value;
|
|
// oEmpLeaveStatus.NormalLeaveDays = oReader.GetDouble("NormalLeaveDays").Value;
|
|
// oEmpLeaveStatus.YearEndBalance = oReader.GetDouble("YearEndBalance").Value;
|
|
// oEmpLeaveStatus.LeaveAvailed = oReader.GetDouble("LEAVEAVAILED").Value;
|
|
// oEmpLeaveStatus.OpeningBalance = oReader.GetDouble("OPENINGBALANCE").Value;
|
|
// oEmpLeaveStatus.ForfitedDays = oReader.GetDouble("FORFITEDDAYS").Value;
|
|
// //this.SetObjectState(oEmpLeaveStatus, ObjectState.Saved);
|
|
// this.SetObjectState(oEmpLeaveStatus, Ease.CoreV35.ObjectState.Saved);
|
|
// }
|
|
// //private EmpLeaveStatus CreateObject(NullHandler oReader)
|
|
// protected override T CreateObject<T>(DataReader oReader)
|
|
// {
|
|
// EmpLeaveStatus oEmpLeaveStatus = new EmpLeaveStatus();
|
|
// MapObject(oEmpLeaveStatus, oReader);
|
|
// return oEmpLeaveStatus as T;
|
|
|
|
// }
|
|
// protected EmpLeaveStatus CreateObject(DataReader oReader)
|
|
// {
|
|
// EmpLeaveStatus oEmpLeaveStatus = new EmpLeaveStatus();
|
|
// MapObject(oEmpLeaveStatus, oReader);
|
|
// return oEmpLeaveStatus;
|
|
// }
|
|
// #endregion
|
|
|
|
// #region Service implementation
|
|
// public EmpLeaveStatus Get(ID id)
|
|
// {
|
|
// EmpLeaveStatus oEmpLeaveStatus = new EmpLeaveStatus();
|
|
// #region Cache Header
|
|
// oEmpLeaveStatus = (EmpLeaveStatus)_cache["Get", id.Integer];
|
|
// if (oEmpLeaveStatus != null)
|
|
// return oEmpLeaveStatus;
|
|
// #endregion
|
|
// TransactionContext tc = null;
|
|
// try
|
|
// {
|
|
// tc = TransactionContext.Begin();
|
|
// DataReader oreader = new DataReader(EmpLeaveStatusDA.Get(tc, id.Integer));
|
|
// if (oreader.Read())
|
|
// {
|
|
// oEmpLeaveStatus = CreateObject(oreader);
|
|
// }
|
|
// oreader.Close();
|
|
// tc.End();
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// #region Handle Exception
|
|
// if (tc != null)
|
|
// tc.HandleError();
|
|
// ExceptionLog.Write(e);
|
|
// throw new ServiceException("Failed to Get Employee Leave Status", e);
|
|
// #endregion
|
|
// }
|
|
// #region Cache Footer
|
|
// _cache.Add(oEmpLeaveStatus, "Get", id.Integer);
|
|
// #endregion
|
|
// return oEmpLeaveStatus;
|
|
// }
|
|
// public EmpLeaveStatus GetStatus(int empid, int leaveID, int leaveYearID)
|
|
// {
|
|
// EmpLeaveStatus oEmpLeaveStatus = new EmpLeaveStatus();
|
|
// #region Cache Header
|
|
// oEmpLeaveStatus = (EmpLeaveStatus)_cache["Get", empid, leaveID, leaveYearID];
|
|
// if (oEmpLeaveStatus != null)
|
|
// return oEmpLeaveStatus;
|
|
// #endregion
|
|
// TransactionContext tc = null;
|
|
// try
|
|
// {
|
|
// tc = TransactionContext.Begin();
|
|
// DataReader oreader =new DataReader(EmpLeaveStatusDA.GetStatus(tc, empid, leaveID, leaveYearID));
|
|
// if (oreader.Read())
|
|
// {
|
|
// oEmpLeaveStatus = CreateObject(oreader);
|
|
// }
|
|
// oreader.Close();
|
|
// tc.End();
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// #region Handle Exception
|
|
// if (tc != null)
|
|
// tc.HandleError();
|
|
// ExceptionLog.Write(e);
|
|
// throw new ServiceException("Failed to Get Employee Leave Status", e);
|
|
// #endregion
|
|
// }
|
|
// #region Cache Footer
|
|
// _cache.Add(oEmpLeaveStatus, "Get", empid, leaveID, leaveYearID);
|
|
// #endregion
|
|
// return oEmpLeaveStatus;
|
|
// }
|
|
// public EmpLeaveStatus GetByYear(int leaveyearID, int LeaveId, int EmpId)
|
|
// {
|
|
// EmpLeaveStatus oEmpLeaveStatus = null;
|
|
// TransactionContext tc = null;
|
|
// try
|
|
// {
|
|
// tc = TransactionContext.Begin();
|
|
// DataReader oreader = new DataReader(EmpLeaveStatusDA.GetByYear(tc, leaveyearID, LeaveId, EmpId));
|
|
// if (oreader.Read())
|
|
// {
|
|
// oEmpLeaveStatus = CreateObject(oreader);
|
|
// }
|
|
// oreader.Close();
|
|
// tc.End();
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// #region Handle Exception
|
|
// if (tc != null)
|
|
// tc.HandleError();
|
|
// ExceptionLog.Write(e);
|
|
// throw new ServiceException("Failed to Get Employee Leave Status", e);
|
|
// #endregion
|
|
// }
|
|
// return oEmpLeaveStatus;
|
|
// }
|
|
|
|
|
|
// public ObjectsTemplate<EmpLeaveStatus> GetByYear(int leaveyearID)
|
|
// {
|
|
// #region Cache Header
|
|
// ObjectsTemplate<EmpLeaveStatus> empLeaveStatuss = _cache["Get", leaveyearID] as ObjectsTemplate<EmpLeaveStatus>;
|
|
// if (empLeaveStatuss != null)
|
|
// return empLeaveStatuss;
|
|
// #endregion
|
|
// TransactionContext tc = null;
|
|
// try
|
|
// {
|
|
// tc = TransactionContext.Begin();
|
|
// DataReader oreader = new DataReader(EmpLeaveStatusDA.GetByYear(tc, leaveyearID));
|
|
// empLeaveStatuss =this.CreateObjects<EmpLeaveStatus>(oreader);
|
|
// oreader.Close();
|
|
// tc.End();
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// #region Handle Exception
|
|
// if (tc != null)
|
|
// tc.HandleError();
|
|
// ExceptionLog.Write(e);
|
|
// throw new ServiceException("Failed to Get Employee Leave Status", e);
|
|
// #endregion
|
|
// }
|
|
// #region Cache Footer
|
|
// _cache.Add(empLeaveStatuss, "Get", leaveyearID);
|
|
// #endregion
|
|
// return empLeaveStatuss;
|
|
// }
|
|
|
|
// public ObjectsTemplate<EmpLeaveStatus> Get(int nProcessId)
|
|
// {
|
|
// #region Cache Header
|
|
// ObjectsTemplate<EmpLeaveStatus> empLeaveStatuss = _cache["Get", nProcessId] as ObjectsTemplate<EmpLeaveStatus>;
|
|
// if (empLeaveStatuss != null)
|
|
// return empLeaveStatuss;
|
|
// #endregion
|
|
// TransactionContext tc = null;
|
|
// try
|
|
// {
|
|
// tc = TransactionContext.Begin();
|
|
// DataReader oReader = new DataReader(EmpLeaveStatusDA.GetByProcessId(tc, nProcessId));
|
|
// empLeaveStatuss =this.CreateObjects<EmpLeaveStatus>(oReader);
|
|
// oReader.Close();
|
|
// tc.End();
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// #region Handle Exception
|
|
// if (tc != null)
|
|
// tc.HandleError();
|
|
// ExceptionLog.Write(e);
|
|
// throw new ServiceException("Failed to Get Employee Leave Status", e);
|
|
// #endregion
|
|
// }
|
|
// #region Cache Footer
|
|
// _cache.Add(empLeaveStatuss, "Get", nProcessId);
|
|
// #endregion
|
|
// return empLeaveStatuss;
|
|
// }
|
|
// public ObjectsTemplate<EmpLeaveStatus> GetAllStatus(int empId)
|
|
// {
|
|
// #region Cache Header
|
|
// ObjectsTemplate<EmpLeaveStatus> empLeaveStatuss = _cache["Get", empId] as ObjectsTemplate<EmpLeaveStatus>;
|
|
// if (empLeaveStatuss != null)
|
|
// return empLeaveStatuss;
|
|
// #endregion
|
|
// TransactionContext tc = null;
|
|
// try
|
|
// {
|
|
// tc = TransactionContext.Begin();
|
|
// DataReader oReader =new DataReader(EmpLeaveStatusDA.GetAllStatus(tc, empId));
|
|
// empLeaveStatuss =this.CreateObjects<EmpLeaveStatus>(oReader);
|
|
// oReader.Close();
|
|
// tc.End();
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// #region Handle Exception
|
|
// if (tc != null)
|
|
// tc.HandleError();
|
|
// ExceptionLog.Write(e);
|
|
// throw new ServiceException("Failed to Get Employee Leave Status", e);
|
|
// #endregion
|
|
// }
|
|
// #region Cache Footer
|
|
// _cache.Add(empLeaveStatuss, "Get", empId);
|
|
// #endregion
|
|
// return empLeaveStatuss;
|
|
// }
|
|
|
|
// public ID Save(EmpLeaveStatus oEmpLeaveStatus)
|
|
// {
|
|
// TransactionContext tc = null;
|
|
// try
|
|
// {
|
|
// tc = TransactionContext.Begin(true);
|
|
// if (oEmpLeaveStatus.IsNew)
|
|
// {
|
|
// int id = tc.GenerateID("EmpLeaveStatus", "TranId");
|
|
// base.SetObjectID(oEmpLeaveStatus, ID.FromInteger(id));
|
|
// EmpLeaveStatusDA.Insert(tc, oEmpLeaveStatus);
|
|
// }
|
|
// else
|
|
// EmpLeaveStatusDA.Update(tc, oEmpLeaveStatus);
|
|
// tc.End();
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// #region Handle Exception
|
|
// if (tc != null)
|
|
// tc.HandleError();
|
|
// ExceptionLog.Write(e);
|
|
// throw new ServiceException("Failed to Save Employee Leave Status", e);
|
|
// #endregion
|
|
// }
|
|
// return oEmpLeaveStatus.ID;
|
|
// }
|
|
|
|
// public void SaveStatus(EmpLeaveStatus oEmpLeaveStatus)
|
|
// {
|
|
// TransactionContext tc = null;
|
|
// try
|
|
// {
|
|
// tc = TransactionContext.Begin(true);
|
|
// if (oEmpLeaveStatus.IsNew)
|
|
// {
|
|
// // this.SetObjectID(oEmpLeaveStatus, ID.FromInteger(EmpLeaveStatusDA.GetNewID(tc)));
|
|
// EmpLeaveStatusDA.Insert(tc, oEmpLeaveStatus);
|
|
|
|
// }
|
|
// //else
|
|
// // EmpLeaveStatusDA.Update(tc, oEmpLeaveStatus);
|
|
// tc.End();
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// #region Handle Exception
|
|
// if (tc != null)
|
|
// tc.HandleError();
|
|
// ExceptionLog.Write(e);
|
|
// throw new ServiceException("Failed to Save Employee Leave Status", e);
|
|
// #endregion
|
|
// }
|
|
|
|
// }
|
|
// internal void SaveAtProcessing(bool IsUpdate, int ProcessId,ObjectsTemplate<EmpLeaveStatus> oEmpLeaveStatuss, TransactionContext tc)
|
|
// {
|
|
|
|
// foreach (EmpLeaveStatus oItem in oEmpLeaveStatuss)
|
|
// {
|
|
// if (IsUpdate) EmpLeaveStatusDA.Update(tc, oItem);
|
|
// else
|
|
// {
|
|
// this.SetObjectID(oItem, ID.FromInteger(EmpLeaveStatusDA.GetNewID(tc)));
|
|
// oItem.ProcessId = ProcessId;
|
|
// EmpLeaveStatusDA.Insert(tc, oItem);
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// public void Delete(ID id)
|
|
// {
|
|
// TransactionContext tc = null;
|
|
// try
|
|
// {
|
|
// tc = TransactionContext.Begin(true);
|
|
// EmpLeaveStatusDA.Delete(tc, id.Integer);
|
|
// tc.End();
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// #region Handle Exception
|
|
// if (tc != null)
|
|
// tc.HandleError();
|
|
// ExceptionLog.Write(e);
|
|
// throw new ServiceException("Failed to Delete Employee Leave Status", e);
|
|
// #endregion
|
|
// }
|
|
// }
|
|
// public void Delete(int nProcessId)
|
|
// {
|
|
// TransactionContext tc = null;
|
|
// try
|
|
// {
|
|
// tc = TransactionContext.Begin(true);
|
|
// EmpLeaveStatusDA.DeleteByProcessId(tc, nProcessId);
|
|
// tc.End();
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// #region Handle Exception
|
|
// if (tc != null)
|
|
// tc.HandleError();
|
|
// ExceptionLog.Write(e);
|
|
// throw new ServiceException("Failed to Delete Employee Leave Status", e);
|
|
// #endregion
|
|
// }
|
|
// }
|
|
|
|
// #endregion
|
|
// }
|
|
// #endregion
|
|
//} |