using System; using System.Data; using Ease.Core.Model; using Ease.Core.DataAccess; using Ease.Core; using System.Collections.Generic; using Ease.Core.Utility; using HRM.BO; namespace HRM.DA { #region UnAuthorizeLeaveParameter Service public class UnAuthorizeLeaveParameterService : ServiceTemplate { public UnAuthorizeLeaveParameterService() { } private void MapObject(UnAuthorizeLeaveParamDetail oUnAuthorizeLeaveParameter, DataReader oReader) { base.SetObjectID(oUnAuthorizeLeaveParameter, (oReader.GetInt32("ParamDetailID").Value)); oUnAuthorizeLeaveParameter.LeaveID = oReader.GetInt32("LeaveID", 0); oUnAuthorizeLeaveParameter.AllowanceID = oReader.GetInt32("ALLOWANCEID", 0); oUnAuthorizeLeaveParameter.UNLeaveParamID = oReader.GetInt32("UaLeaveParamID", 0); oUnAuthorizeLeaveParameter.ValueInPercent = oReader.GetDouble("VALUEINPERCENT").Value; oUnAuthorizeLeaveParameter.Type = (EnumSalaryComponent)oReader.GetInt32("Type").Value; this.SetObjectState(oUnAuthorizeLeaveParameter, Ease.Core.ObjectState.Saved); } protected override T CreateObject(DataReader oReader) { UnAuthorizeLeaveParamDetail oUnAuthorizeLeaveParameter = new UnAuthorizeLeaveParamDetail(); MapObject(oUnAuthorizeLeaveParameter, oReader); return oUnAuthorizeLeaveParameter as T; } protected UnAuthorizeLeaveParamDetail CreateObject(DataReader oReader) { UnAuthorizeLeaveParamDetail oUnAuthorizeLeaveParameter = new UnAuthorizeLeaveParamDetail(); MapObject(oUnAuthorizeLeaveParameter, oReader); return oUnAuthorizeLeaveParameter; } #region Service implementation public UnAuthorizeLeaveParamDetail Get(int id) { UnAuthorizeLeaveParamDetail oUnAuthorizeLeaveParameter = new UnAuthorizeLeaveParamDetail(); TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(UnAuthorizeLeaveParameterDA.Get(tc, id)); if (oreader.Read()) { oUnAuthorizeLeaveParameter = this.CreateObject(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 } return oUnAuthorizeLeaveParameter; } //public List Get() //{ // List unAuthorizeLeaveParameters = null; // TransactionContext tc = null; // try // { // tc = TransactionContext.Begin(); // DataReader dr = new DataReader(UnAuthorizeLeaveParameterDA.Get(tc)); // unAuthorizeLeaveParameters = this.CreateObjects(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 unAuthorizeLeaveParameters; //} public List GetDetail(int nUnLeaveParamID) { List unAuthorizeLeaveParameters = null; TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader dr = new DataReader(UnAuthorizeLeaveParameterDA.GetDetail(tc, nUnLeaveParamID)); unAuthorizeLeaveParameters = this.CreateObjects(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 unAuthorizeLeaveParameters; } #endregion } #endregion }