145 lines
4.9 KiB
C#
145 lines
4.9 KiB
C#
|
//using System;
|
|||
|
//using System.Data;
|
|||
|
//
|
|||
|
//using Ease.Core.Model;
|
|||
|
//using Ease.Core.DataAccess;
|
|||
|
//
|
|||
|
//using Ease.Core;
|
|||
|
//using System.Collections.Generic;
|
|||
|
//using Ease.Core.Utility;
|
|||
|
//
|
|||
|
|
|||
|
//namespace HRM.DA
|
|||
|
//{
|
|||
|
// public class ApprenticeSalaryService : ServiceTemplate, IApprenticeSalaryService
|
|||
|
// {
|
|||
|
// #region Private functions and declaration
|
|||
|
// Cache _cache = new Cache(typeof(ApprenticeSalary));
|
|||
|
|
|||
|
// public ApprenticeSalaryService() { }
|
|||
|
|
|||
|
// private void MapObject(ApprenticeSalary apprenticeSalary, DataReader oReader)
|
|||
|
// {
|
|||
|
// base.SetObjectID(apprenticeSalary, (oReader.GetInt32("apprenticeSalaryID").Value));
|
|||
|
// apprenticeSalary.FirstYear = oReader.GetDouble("FirstYear") == null ? 0 : oReader.GetDouble("FirstYear").Value;
|
|||
|
// apprenticeSalary.SecondYear = oReader.GetDouble("SecondYear") == null ? 0 : oReader.GetDouble("SecondYear").Value;
|
|||
|
// apprenticeSalary.ThirdYear = oReader.GetDouble("ThirdYear") == null ? 0 : oReader.GetDouble("ThirdYear").Value;
|
|||
|
// this.SetObjectState(apprenticeSalary, Ease.Core.ObjectState.Saved);
|
|||
|
|
|||
|
// }
|
|||
|
// protected override T CreateObject<T>(DataReader oReader)
|
|||
|
// {
|
|||
|
// ApprenticeSalary apprenticeSalary = new ApprenticeSalary();
|
|||
|
// MapObject(apprenticeSalary, oReader);
|
|||
|
// return apprenticeSalary as T;
|
|||
|
// }
|
|||
|
// private ApprenticeSalary CreateObject(DataReader oReader)
|
|||
|
// {
|
|||
|
// ApprenticeSalary apprenticeSalary = new ApprenticeSalary();
|
|||
|
// MapObject(apprenticeSalary, oReader);
|
|||
|
// return apprenticeSalary;
|
|||
|
// }
|
|||
|
|
|||
|
// #endregion
|
|||
|
|
|||
|
// #region Service implementation
|
|||
|
// //public List<ApprenticeSalary> Get()
|
|||
|
// //{
|
|||
|
// // #region Cache Header
|
|||
|
// // List<ApprenticeSalary> apprenticeSalarys = _cache["Get"] as List<ApprenticeSalary>;
|
|||
|
// // if (apprenticeSalarys != null)
|
|||
|
// // return apprenticeSalarys;
|
|||
|
// // #endregion
|
|||
|
|
|||
|
// // TransactionContext tc = null;
|
|||
|
// // try
|
|||
|
// // {
|
|||
|
// // tc = TransactionContext.Begin();
|
|||
|
// // DataReader dr = new DataReader(ApprenticeSalaryDA.Get(tc));
|
|||
|
// // apprenticeSalarys = this.CreateObjects<ApprenticeSalary>(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(apprenticeSalarys, "Get");
|
|||
|
// // #endregion
|
|||
|
// // return apprenticeSalarys;
|
|||
|
// //}
|
|||
|
|
|||
|
// public ApprenticeSalary Get()
|
|||
|
// {
|
|||
|
// #region Cache Header
|
|||
|
// ApprenticeSalary apprenticeSalary = _cache["Get"] as ApprenticeSalary;
|
|||
|
// if (apprenticeSalary != null)
|
|||
|
// return apprenticeSalary;
|
|||
|
// #endregion
|
|||
|
|
|||
|
// TransactionContext tc = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// tc = TransactionContext.Begin();
|
|||
|
// DataReader dr = new DataReader(ApprenticeSalaryDA.Get(tc));
|
|||
|
// if (dr.Read())
|
|||
|
// {
|
|||
|
// apprenticeSalary = this.CreateObject<ApprenticeSalary>(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(apprenticeSalary, "Get");
|
|||
|
// #endregion
|
|||
|
// return apprenticeSalary;
|
|||
|
// }
|
|||
|
|
|||
|
|
|||
|
// public void Insert(ApprenticeSalary apprenticeSalarys)
|
|||
|
// {
|
|||
|
// TransactionContext tc = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// tc = TransactionContext.Begin(true);
|
|||
|
// int id = tc.GenerateID("ApprenticeSalary", "ApprenticeSalaryID");
|
|||
|
// ApprenticeSalaryDA.DeleteAll(tc);
|
|||
|
// base.SetObjectID(apprenticeSalarys, (id));
|
|||
|
// ApprenticeSalaryDA.Insert(tc, apprenticeSalarys);
|
|||
|
|
|||
|
|
|||
|
// tc.End();
|
|||
|
// }
|
|||
|
// catch (Exception e)
|
|||
|
// {
|
|||
|
// #region Handle Exception
|
|||
|
// if (tc != null)
|
|||
|
// tc.HandleError();
|
|||
|
// ExceptionLog.Write(e);
|
|||
|
// throw new ServiceException(e.Message, e);
|
|||
|
// #endregion
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// #endregion
|
|||
|
// }
|
|||
|
//}
|
|||
|
|