177 lines
5.9 KiB
C#
177 lines
5.9 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 OrganogramAuthority Service
|
|||
|
|
|||
|
//
|
|||
|
// public class OrganogramAuthorityService : ServiceTemplate, IOrganogramAuthorityService
|
|||
|
// {
|
|||
|
|
|||
|
// #region Private functions and declaration
|
|||
|
// Cache _cache = new Cache(typeof(OrganogramAuthority));
|
|||
|
|
|||
|
// #endregion
|
|||
|
|
|||
|
// public OrganogramAuthorityService()
|
|||
|
// { }
|
|||
|
|
|||
|
// private void MapObject(OrganogramAuthority oOrganAuthority, DataReader oReader)
|
|||
|
// {
|
|||
|
// base.SetObjectID(oOrganAuthority, oReader.GetID("OrganogramAuthorityID"));
|
|||
|
// oOrganAuthority.NodeID = oReader.GetID("NodeID");
|
|||
|
// oOrganAuthority.AuthorityType = (EnumAuthorityType)oReader.GetInt32("AuthorityType").Value;
|
|||
|
// oOrganAuthority.ChildNodeID = oReader.GetID("ChildNodeID");
|
|||
|
// oOrganAuthority.ModifiedBy = oReader.GetID("ModifiedBy");
|
|||
|
// oOrganAuthority.ModifiedDate = oReader.GetDateTime("ModifiedDate");
|
|||
|
// this.SetObjectState(oOrganAuthority, Ease.Core.ObjectState.Saved);
|
|||
|
// }
|
|||
|
|
|||
|
// protected override T CreateObject<T>(DataReader oReader)
|
|||
|
// {
|
|||
|
// OrganogramAuthority oOrganAuthority = new OrganogramAuthority();
|
|||
|
// MapObject(oOrganAuthority, oReader);
|
|||
|
// return oOrganAuthority as T;
|
|||
|
// }
|
|||
|
|
|||
|
// protected OrganogramAuthority CreateObject(DataReader oReader)
|
|||
|
// {
|
|||
|
// OrganogramAuthority oOrganAuthority = new OrganogramAuthority();
|
|||
|
// MapObject(oOrganAuthority, oReader);
|
|||
|
// return oOrganAuthority;
|
|||
|
// }
|
|||
|
|
|||
|
// #region Service implementation
|
|||
|
|
|||
|
// public ID Insert(OrganogramAuthority oOrganAuthority)
|
|||
|
// {
|
|||
|
// TransactionContext tc = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// tc = TransactionContext.Begin(true);
|
|||
|
// if (oOrganAuthority.IsNew)
|
|||
|
// {
|
|||
|
// int id = tc.GenerateID("OrganogramAuthority", "OrganogramAuthorityID");
|
|||
|
// base.SetObjectID(oOrganAuthority, ID.FromInteger(id));
|
|||
|
// OrganogramAuthorityDA.Insert(tc, oOrganAuthority);
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// OrganogramAuthorityDA.Update(tc, oOrganAuthority);
|
|||
|
// }
|
|||
|
// tc.End();
|
|||
|
|
|||
|
// return oOrganAuthority.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);
|
|||
|
// OrganogramAuthorityDA.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 OrganogramAuthority Get(int id)
|
|||
|
// {
|
|||
|
// OrganogramAuthority oOrganAuthority = new OrganogramAuthority();
|
|||
|
// #region Cache Header
|
|||
|
// oOrganAuthority = _cache["Get", id] as OrganogramAuthority;
|
|||
|
// if (oOrganAuthority != null)
|
|||
|
// return oOrganAuthority;
|
|||
|
// #endregion
|
|||
|
// TransactionContext tc = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// tc = TransactionContext.Begin();
|
|||
|
// DataReader oreader = new DataReader(OrganogramAuthorityDA.Get(tc, id));
|
|||
|
// if (oreader.Read())
|
|||
|
// {
|
|||
|
// oOrganAuthority = this.CreateObject<OrganogramAuthority>(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(oOrganAuthority, "Get", id);
|
|||
|
// #endregion
|
|||
|
// return oOrganAuthority;
|
|||
|
// }
|
|||
|
|
|||
|
// public List<OrganogramAuthority> Get()
|
|||
|
// {
|
|||
|
// #region Cache Header
|
|||
|
// List<OrganogramAuthority> oOrganAuthority = _cache["Get"] as List<OrganogramAuthority>;
|
|||
|
// if (oOrganAuthority != null)
|
|||
|
// return oOrganAuthority;
|
|||
|
// #endregion
|
|||
|
// TransactionContext tc = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// tc = TransactionContext.Begin();
|
|||
|
// DataReader dr = new DataReader(OrganogramAuthorityDA.Get(tc));
|
|||
|
// oOrganAuthority = this.CreateObjects<OrganogramAuthority>(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(oOrganAuthority, "Get");
|
|||
|
// #endregion
|
|||
|
// return oOrganAuthority;
|
|||
|
// }
|
|||
|
|
|||
|
// #endregion
|
|||
|
// }
|
|||
|
// #endregion
|
|||
|
//}
|
|||
|
|