183 lines
6.3 KiB
C#
183 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 SalaryMonthlyDetail Service
|
|||
|
//
|
|||
|
// public class SalaryMonthlyDetailService : ServiceTemplate, ISalaryMonthlyDetailService
|
|||
|
// {
|
|||
|
// #region Private functions and declaration
|
|||
|
// Cache _cache = new Cache(typeof(SalaryMonthlyDetail));
|
|||
|
|
|||
|
// #endregion
|
|||
|
// public SalaryMonthlyDetailService() { }
|
|||
|
|
|||
|
// private void MapObject(SalaryMonthlyDetail oSalaryMonthlyDetail, DataReader oReader)
|
|||
|
// {
|
|||
|
// base.SetObjectID(oSalaryMonthlyDetail, oReader.GetInt32("SalaryMonthlyDetailID"));
|
|||
|
// oSalaryMonthlyDetail.SalaryMonthlyID = oReader.GetInt32("SalaryMonthlyID");
|
|||
|
// oSalaryMonthlyDetail.ItemID = oReader.GetInt32("ItemID");
|
|||
|
// oSalaryMonthlyDetail.SupportID = oReader.GetInt32("SupportID");
|
|||
|
// oSalaryMonthlyDetail.Description = oReader.GetString("Description");
|
|||
|
// oSalaryMonthlyDetail.Position = oReader.GetInt32("Position").Value;
|
|||
|
// oSalaryMonthlyDetail.CalculatedAmount = oReader.GetDouble("CalculatedAmount").Value;
|
|||
|
// oSalaryMonthlyDetail.ChangedAmount = oReader.GetDouble("ChangedAmount").Value;
|
|||
|
// oSalaryMonthlyDetail.ItemCode = (EnumSalaryItemCode)oReader.GetInt32("ItemCode").Value;
|
|||
|
// this.SetObjectState(oSalaryMonthlyDetail, Ease.Core.ObjectState.Saved);
|
|||
|
// }
|
|||
|
// protected override T CreateObject<T>(DataReader oReader)
|
|||
|
// {
|
|||
|
// SalaryMonthlyDetail oSalaryMonthlyDetail = new SalaryMonthlyDetail();
|
|||
|
// MapObject(oSalaryMonthlyDetail, oReader);
|
|||
|
// return oSalaryMonthlyDetail as T;
|
|||
|
// }
|
|||
|
// protected SalaryMonthlyDetail CreateObject(DataReader oReader)
|
|||
|
// {
|
|||
|
// SalaryMonthlyDetail oSalaryMonthlyDetail = new SalaryMonthlyDetail();
|
|||
|
// MapObject(oSalaryMonthlyDetail, oReader);
|
|||
|
// return oSalaryMonthlyDetail;
|
|||
|
// }
|
|||
|
// #region Service implementation
|
|||
|
// public SalaryMonthlyDetail Get(int id)
|
|||
|
// {
|
|||
|
// SalaryMonthlyDetail oSalaryMonthlyDetail = new SalaryMonthlyDetail();
|
|||
|
//
|
|||
|
|
|||
|
// oSalaryMonthlyDetail = _cache["Get", id] as SalaryMonthlyDetail;
|
|||
|
// if (oSalaryMonthlyDetail != null)
|
|||
|
// return oSalaryMonthlyDetail;
|
|||
|
// #endregion
|
|||
|
// TransactionContext tc = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// tc = TransactionContext.Begin();
|
|||
|
// DataReader oreader = new DataReader(SalaryMonthlyDetailDA.Get(tc, id));
|
|||
|
// if (oreader.Read())
|
|||
|
// {
|
|||
|
// oSalaryMonthlyDetail = this.CreateObject<SalaryMonthlyDetail>(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(oSalaryMonthlyDetail, "Get", id);
|
|||
|
// #endregion
|
|||
|
// return oSalaryMonthlyDetail;
|
|||
|
// }
|
|||
|
|
|||
|
// public List<SalaryMonthlyDetail> Get()
|
|||
|
// {
|
|||
|
// #region Cache Header
|
|||
|
|
|||
|
// List<SalaryMonthlyDetail> salaryMonthlyDetails = _cache["Get"] as List<SalaryMonthlyDetail>;
|
|||
|
// if (salaryMonthlyDetails != null)
|
|||
|
// return salaryMonthlyDetails;
|
|||
|
|
|||
|
// #endregion
|
|||
|
|
|||
|
// TransactionContext tc = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// tc = TransactionContext.Begin();
|
|||
|
|
|||
|
// DataReader dr = new DataReader(SalaryMonthlyDA.Get(tc));
|
|||
|
// salaryMonthlyDetails = this.CreateObjects<SalaryMonthlyDetail>(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(salaryMonthlyDetails, "Get");
|
|||
|
|
|||
|
// #endregion
|
|||
|
|
|||
|
// return salaryMonthlyDetails;
|
|||
|
// }
|
|||
|
|
|||
|
|
|||
|
// public int Insert(SalaryMonthlyDetail oSalaryMonthlyDetail)
|
|||
|
// {
|
|||
|
// TransactionContext tc = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// tc = TransactionContext.Begin(true);
|
|||
|
// if (oSalaryMonthlyDetail.IsNew)
|
|||
|
// {
|
|||
|
// int id = tc.GenerateID("SalaryMonthlyDetail", "SalaryMonthlyDetailID");
|
|||
|
// base.SetObjectID(oSalaryMonthlyDetail, (id));
|
|||
|
// SalaryMonthlyDetailDA.Insert(tc, oSalaryMonthlyDetail);
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// SalaryMonthlyDetailDA.Update(tc, oSalaryMonthlyDetail);
|
|||
|
// }
|
|||
|
// tc.End();
|
|||
|
// return oSalaryMonthlyDetail.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);
|
|||
|
// SalaryMonthlyDetailDA.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
|
|||
|
// }
|
|||
|
// }
|
|||
|
// #endregion
|
|||
|
// }
|
|||
|
// #endregion
|
|||
|
//}
|
|||
|
|