176 lines
6.4 KiB
C#
176 lines
6.4 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 OrganogramResponsibility Service
|
|||
|
|
|||
|
//
|
|||
|
// public class OrganogramResponsibilityService : ServiceTemplate,IOrganogramResponsibility
|
|||
|
// {
|
|||
|
// #region Private functions and declaration
|
|||
|
// Cache _cache = new Cache(typeof(OrganogramResponsibility));
|
|||
|
|
|||
|
// #endregion
|
|||
|
|
|||
|
// public OrganogramResponsibilityService()
|
|||
|
// { }
|
|||
|
|
|||
|
// private void MapObject(OrganogramResponsibility oOrganogramResponsibility, DataReader oReader)
|
|||
|
// {
|
|||
|
// base.SetObjectID(oOrganogramResponsibility, oReader.GetID("OrganogramResponsibilityID"));
|
|||
|
// oOrganogramResponsibility.NodeID = oReader.GetID("NodeID");
|
|||
|
// oOrganogramResponsibility.Responsibility = oReader.GetString("Responsibility");
|
|||
|
// oOrganogramResponsibility.IsPrimary = oReader.GetBoolean("IsPrimary").Value;
|
|||
|
// oOrganogramResponsibility.ModifiedBy = oReader.GetID("ModifiedBy");
|
|||
|
// oOrganogramResponsibility.ModifiedDate = oReader.GetDateTime("ModifiedDate");
|
|||
|
// this.SetObjectState(oOrganogramResponsibility, Ease.Core.ObjectState.Saved);
|
|||
|
// }
|
|||
|
|
|||
|
// protected override T CreateObject<T>(DataReader oReader)
|
|||
|
// {
|
|||
|
// OrganogramResponsibility oOrganogramResponsibility = new OrganogramResponsibility();
|
|||
|
// MapObject(oOrganogramResponsibility, oReader);
|
|||
|
// return oOrganogramResponsibility as T;
|
|||
|
// }
|
|||
|
|
|||
|
// protected OrganogramResponsibility CreateObject(DataReader oReader)
|
|||
|
// {
|
|||
|
// OrganogramResponsibility oOrganogramResponsibility = new OrganogramResponsibility();
|
|||
|
// MapObject(oOrganogramResponsibility, oReader);
|
|||
|
// return oOrganogramResponsibility;
|
|||
|
// }
|
|||
|
|
|||
|
// #region Service implementation
|
|||
|
|
|||
|
// public ID Insert(OrganogramResponsibility oOrganogramResponsibility)
|
|||
|
// {
|
|||
|
// TransactionContext tc = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// tc = TransactionContext.Begin(true);
|
|||
|
// if (oOrganogramResponsibility.IsNew)
|
|||
|
// {
|
|||
|
// int id = tc.GenerateID("OrganogramResponsibility", "OrganogramResponsibilityID");
|
|||
|
// base.SetObjectID(oOrganogramResponsibility, ID.FromInteger(id));
|
|||
|
// OrganogramResponsibilityDA.Insert(tc, oOrganogramResponsibility);
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// OrganogramResponsibilityDA.Update(tc, oOrganogramResponsibility);
|
|||
|
// }
|
|||
|
// tc.End();
|
|||
|
|
|||
|
// return oOrganogramResponsibility.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);
|
|||
|
// OrganogramResponsibilityDA.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 OrganogramResponsibility Get(int id)
|
|||
|
// {
|
|||
|
// OrganogramResponsibility oOrganogramResponsibility = new OrganogramResponsibility();
|
|||
|
// #region Cache Header
|
|||
|
// oOrganogramResponsibility = _cache["Get", id] as OrganogramResponsibility;
|
|||
|
// if (oOrganogramResponsibility != null)
|
|||
|
// return oOrganogramResponsibility;
|
|||
|
// #endregion
|
|||
|
// TransactionContext tc = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// tc = TransactionContext.Begin();
|
|||
|
// DataReader oreader = new DataReader(OrganogramResponsibilityDA.Get(tc, id));
|
|||
|
// if (oreader.Read())
|
|||
|
// {
|
|||
|
// oOrganogramResponsibility = this.CreateObject<OrganogramResponsibility>(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(oOrganogramResponsibility, "Get", id);
|
|||
|
// #endregion
|
|||
|
// return oOrganogramResponsibility;
|
|||
|
// }
|
|||
|
|
|||
|
// public List<OrganogramResponsibility> Get()
|
|||
|
// {
|
|||
|
// #region Cache Header
|
|||
|
// List<OrganogramResponsibility> oOrganogramResponsibility = _cache["Get"] as List<OrganogramResponsibility>;
|
|||
|
// if (oOrganogramResponsibility != null)
|
|||
|
// return oOrganogramResponsibility;
|
|||
|
// #endregion
|
|||
|
// TransactionContext tc = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// tc = TransactionContext.Begin();
|
|||
|
// DataReader dr = new DataReader(OrganogramResponsibilityDA.Get(tc));
|
|||
|
// oOrganogramResponsibility = this.CreateObjects<OrganogramResponsibility>(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(oOrganogramResponsibility, "Get");
|
|||
|
// #endregion
|
|||
|
// return oOrganogramResponsibility;
|
|||
|
// }
|
|||
|
|
|||
|
// #endregion
|
|||
|
|
|||
|
// }
|
|||
|
// #endregion
|
|||
|
//}
|
|||
|
|