180 lines
6.3 KiB
C#
180 lines
6.3 KiB
C#
|
//using System;
|
|||
|
//using System.Data;
|
|||
|
//using System.Linq;
|
|||
|
//using Ease.Core;
|
|||
|
//using Ease.Core.Model;
|
|||
|
//using Ease.Core.DataAccess;
|
|||
|
//using System.Collections.Generic;
|
|||
|
//
|
|||
|
//using Ease.Core.Caching;
|
|||
|
|
|||
|
//namespace Payroll.Service
|
|||
|
//{
|
|||
|
// #region OrganogramDelegation Service
|
|||
|
|
|||
|
//
|
|||
|
// public class OrganogramDelegationService : ServiceTemplate,IOrganogramDelegationService
|
|||
|
// {
|
|||
|
// #region Private functions and declaration
|
|||
|
// Cache _cache = new Cache(typeof(OrganogramDelegation));
|
|||
|
|
|||
|
// #endregion
|
|||
|
|
|||
|
// public OrganogramDelegationService()
|
|||
|
// { }
|
|||
|
|
|||
|
// private void MapObject(OrganogramDelegation oOrganogramDelegation, DataReader oReader)
|
|||
|
// {
|
|||
|
// base.SetObjectID(oOrganogramDelegation, oReader.GetID("OrganogramDelegationID"));
|
|||
|
// oOrganogramDelegation.NodeID = oReader.GetID("NodeID");
|
|||
|
// oOrganogramDelegation.EmployeeID = oReader.GetID("EmployeeID");
|
|||
|
// oOrganogramDelegation.FromDate= oReader.GetDateTime("FromDate").Value;
|
|||
|
// oOrganogramDelegation.ToDate = oReader.GetDateTime("ToDate").Value;
|
|||
|
// oOrganogramDelegation.DelegationType = oReader.GetString("DelegationType");
|
|||
|
// oOrganogramDelegation.IsActive = oReader.GetBoolean("IsActive").Value;
|
|||
|
// oOrganogramDelegation.ModifiedBy = oReader.GetID("ModifiedBy");
|
|||
|
// oOrganogramDelegation.ModifiedDate = oReader.GetDateTime("ModifiedDate");
|
|||
|
// this.SetObjectState(oOrganogramDelegation, Ease.Core.ObjectState.Saved);
|
|||
|
// }
|
|||
|
|
|||
|
// protected override T CreateObject<T>(DataReader oReader)
|
|||
|
// {
|
|||
|
// OrganogramDelegation oOrganogramDelegation = new OrganogramDelegation();
|
|||
|
// MapObject(oOrganogramDelegation, oReader);
|
|||
|
// return oOrganogramDelegation as T;
|
|||
|
// }
|
|||
|
|
|||
|
// protected OrganogramDelegation CreateObject(DataReader oReader)
|
|||
|
// {
|
|||
|
// OrganogramDelegation oOrganogramDelegation = new OrganogramDelegation();
|
|||
|
// MapObject(oOrganogramDelegation, oReader);
|
|||
|
// return oOrganogramDelegation;
|
|||
|
// }
|
|||
|
|
|||
|
// #region Service implementation
|
|||
|
|
|||
|
// public ID Insert(OrganogramDelegation oOrganogramDelegation)
|
|||
|
// {
|
|||
|
// TransactionContext tc = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// tc = TransactionContext.Begin(true);
|
|||
|
// if (oOrganogramDelegation.IsNew)
|
|||
|
// {
|
|||
|
// int id = tc.GenerateID("OrganogramDelegation", "OrganogramDelegationID");
|
|||
|
// base.SetObjectID(oOrganogramDelegation, ID.FromInteger(id));
|
|||
|
// OrganogramDelegationDA.Insert(tc, oOrganogramDelegation);
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// OrganogramDelegationDA.Update(tc, oOrganogramDelegation);
|
|||
|
// }
|
|||
|
// tc.End();
|
|||
|
|
|||
|
// return oOrganogramDelegation.ID;
|
|||
|
// }
|
|||
|
// catch (Exception e)
|
|||
|
// {
|
|||
|
// #region Handle Exception
|
|||
|
// if (tc != null)
|
|||
|
// tc.HandleError();
|
|||
|
// ExceptionLog.Write(e);
|
|||
|
// throw new ServiceException(e.Message, e);
|
|||
|
// #endregion
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// public void Delete(int id)
|
|||
|
// {
|
|||
|
// TransactionContext tc = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// tc = TransactionContext.Begin(true);
|
|||
|
// OrganogramDelegationDA.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 OrganogramDelegation Get(int id)
|
|||
|
// {
|
|||
|
// OrganogramDelegation oOrganogramDelegation = new OrganogramDelegation();
|
|||
|
// #region Cache Header
|
|||
|
// oOrganogramDelegation = _cache["Get", id] as OrganogramDelegation;
|
|||
|
// if (oOrganogramDelegation != null)
|
|||
|
// return oOrganogramDelegation;
|
|||
|
// #endregion
|
|||
|
// TransactionContext tc = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// tc = TransactionContext.Begin();
|
|||
|
// DataReader oreader = new DataReader(OrganogramDelegationDA.Get(tc, id));
|
|||
|
// if (oreader.Read())
|
|||
|
// {
|
|||
|
// oOrganogramDelegation = this.CreateObject<OrganogramDelegation>(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(oOrganogramDelegation, "Get", id);
|
|||
|
// #endregion
|
|||
|
// return oOrganogramDelegation;
|
|||
|
// }
|
|||
|
|
|||
|
// public List<OrganogramDelegation> Get()
|
|||
|
// {
|
|||
|
// #region Cache Header
|
|||
|
// List<OrganogramDelegation> oOrganogramDelegation = _cache["Get"] as List<OrganogramDelegation>;
|
|||
|
// if (oOrganogramDelegation != null)
|
|||
|
// return oOrganogramDelegation;
|
|||
|
// #endregion
|
|||
|
// TransactionContext tc = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// tc = TransactionContext.Begin();
|
|||
|
// DataReader dr = new DataReader(OrganogramDelegationDA.Get(tc));
|
|||
|
// oOrganogramDelegation = this.CreateObjects<OrganogramDelegation>(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(oOrganogramDelegation, "Get");
|
|||
|
// #endregion
|
|||
|
// return oOrganogramDelegation;
|
|||
|
// }
|
|||
|
|
|||
|
// #endregion
|
|||
|
|
|||
|
|
|||
|
// }
|
|||
|
// #endregion
|
|||
|
//}
|
|||
|
|