//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 OrganogramSkillLevelService Service

//    
//    public class OrganogramSkillLevelService : ServiceTemplate,IOrganogramSkillLevel
//    {
//         #region Private functions and declaration
//        Cache _cache = new Cache(typeof(OrganogramSkillLevel));

//        #endregion

//        public OrganogramSkillLevelService()
//        { }

//        private void MapObject(OrganogramSkillLevel oOrganogramSkillLevel, DataReader oReader)
//        {
//            base.SetObjectID(oOrganogramSkillLevel, oReader.GetID("OrganogramSkillLevelID"));
//            oOrganogramSkillLevel.NodeID = oReader.GetID("NodeID");
//            oOrganogramSkillLevel.NodeResponsibilityID = oReader.GetID("NodeResponsibilityID");
//            oOrganogramSkillLevel.LevelID = oReader.GetID("LevelID");
//            oOrganogramSkillLevel.SkillID = oReader.GetID("SkillID");
//            oOrganogramSkillLevel.ModifiedBy = oReader.GetID("ModifiedBy");
//            oOrganogramSkillLevel.ModifiedDate = oReader.GetDateTime("ModifiedDate");
//            this.SetObjectState(oOrganogramSkillLevel, Ease.Core.ObjectState.Saved);
//        }

//        protected override T CreateObject<T>(DataReader oReader)
//        {
//            OrganogramSkillLevel oOrganogramSkillLevel = new OrganogramSkillLevel();
//            MapObject(oOrganogramSkillLevel, oReader);
//            return oOrganogramSkillLevel as T;
//        }

//        protected OrganogramSkillLevel CreateObject(DataReader oReader)
//        {
//            OrganogramSkillLevel oOrganogramSkillLevel = new OrganogramSkillLevel();
//            MapObject(oOrganogramSkillLevel, oReader);
//            return oOrganogramSkillLevel;
//        }

//        #region Service implementation

//        public ID Insert(OrganogramSkillLevel oOrganogramSkillLevel)
//        {
//            TransactionContext tc = null;
//            try
//            {
//                tc = TransactionContext.Begin(true);
//                if (oOrganogramSkillLevel.IsNew)
//                {
//                    int id = tc.GenerateID("OrganogramSkillLevel", "OrganogramSkillLevelID");
//                    base.SetObjectID(oOrganogramSkillLevel, ID.FromInteger(id));
//                    OrganogramSkillLevelDA.Insert(tc, oOrganogramSkillLevel);
//                }
//                else
//                {
//                    OrganogramSkillLevelDA.Update(tc, oOrganogramSkillLevel);
//                }
//                tc.End();

//                return oOrganogramSkillLevel.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);
//                OrganogramSkillLevelDA.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 OrganogramSkillLevel Get(int id)
//        {
//            OrganogramSkillLevel oOrganogramSkillLevel = new OrganogramSkillLevel();
//            #region Cache Header
//            oOrganogramSkillLevel = _cache["Get", id] as OrganogramSkillLevel;
//            if (oOrganogramSkillLevel != null)
//                return oOrganogramSkillLevel;
//            #endregion
//            TransactionContext tc = null;
//            try
//            {
//                tc = TransactionContext.Begin();
//                DataReader oreader = new DataReader(OrganogramSkillLevelDA.Get(tc, id));
//                if (oreader.Read())
//                {
//                    oOrganogramSkillLevel = this.CreateObject<OrganogramSkillLevel>(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(oOrganogramSkillLevel, "Get", id);
//            #endregion
//            return oOrganogramSkillLevel;
//        }

//        public List<OrganogramSkillLevel> Get()
//        {
//            #region Cache Header
//            List<OrganogramSkillLevel> oOrganogramSkillLevel = _cache["Get"] as List<OrganogramSkillLevel>;
//            if (oOrganogramSkillLevel != null)
//                return oOrganogramSkillLevel;
//            #endregion
//            TransactionContext tc = null;
//            try
//            {
//                tc = TransactionContext.Begin();
//                DataReader dr = new DataReader(OrganogramSkillLevelDA.Get(tc));
//                oOrganogramSkillLevel = this.CreateObjects<OrganogramSkillLevel>(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(oOrganogramSkillLevel, "Get");
//            #endregion
//            return oOrganogramSkillLevel;
//        }

//        #endregion

//    }
//    #endregion
//}