EchoTex_Payroll/HRM.DA/Service/Salary/SalaryEmpCostCenterService.cs
2024-10-14 10:01:49 +06:00

176 lines
6.0 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 SalaryEmpCostCenter Service
//
// public class SalaryEmpCostCenterService : ServiceTemplate, ISalaryEmpCostCenterService
// {
// #region Private functions and declaration
// Cache _cache = new Cache(typeof(SalaryEmpCostCenter));
// #endregion
// public SalaryEmpCostCenterService() { }
// private void MapObject(SalaryEmpCostCenter oSalaryEmpCostCenter, DataReader oReader)
// {
// base.SetObjectID(oSalaryEmpCostCenter, oReader.GetInt32("SalaryEmpCostCenterID"));
// oSalaryEmpCostCenter.SalaryMontlyID = oReader.GetInt32("SalaryMonthlyID");
// oSalaryEmpCostCenter.CostCenterID = oReader.GetInt32("CostCenterID");
// oSalaryEmpCostCenter.Percentage= oReader.GetDouble("Percentage").Value;
// oSalaryEmpCostCenter.EmployeeID = oReader.GetInt32("EmployeeID");
// this.SetObjectState(oSalaryEmpCostCenter, Ease.Core.ObjectState.Saved);
// }
// protected override T CreateObject<T>(DataReader oReader)
// {
// SalaryEmpCostCenter oSalaryEmpCostCenter = new SalaryEmpCostCenter();
// MapObject(oSalaryEmpCostCenter, oReader);
// return oSalaryEmpCostCenter as T;
// }
// protected SalaryEmpCostCenter CreateObject(DataReader oReader)
// {
// SalaryEmpCostCenter oSalaryEmpCostCenter = new SalaryEmpCostCenter();
// MapObject(oSalaryEmpCostCenter, oReader);
// return oSalaryEmpCostCenter;
// }
// #region Service implementation
// public SalaryEmpCostCenter Get(int id)
// {
// SalaryEmpCostCenter oSalaryEmpCostCenter = new SalaryEmpCostCenter();
// #region Cache Header
// oSalaryEmpCostCenter = _cache["Get", id] as SalaryEmpCostCenter;
// if (oSalaryEmpCostCenter != null)
// return oSalaryEmpCostCenter;
// #endregion
// TransactionContext tc = null;
// try
// {
// tc = TransactionContext.Begin();
// DataReader oreader = new DataReader(SalaryEmpCostCenterDA.Get(tc, id));
// if (oreader.Read())
// {
// oSalaryEmpCostCenter = this.CreateObject<SalaryEmpCostCenter>(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(oSalaryEmpCostCenter, "Get", id);
// #endregion
// return oSalaryEmpCostCenter;
// }
// public List<SalaryEmpCostCenter> Get()
// {
// #region Cache Header
// List<SalaryEmpCostCenter> salaryEmpCostCenters = _cache["Get"] as List<SalaryEmpCostCenter>;
// if (salaryEmpCostCenters != null)
// return salaryEmpCostCenters;
// #endregion
// TransactionContext tc = null;
// try
// {
// tc = TransactionContext.Begin();
// DataReader dr = new DataReader(SalaryMonthlyDA.Get(tc));
// salaryEmpCostCenters = this.CreateObjects<SalaryEmpCostCenter>(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(salaryEmpCostCenters, "Get");
// #endregion
// return salaryEmpCostCenters;
// }
// public int Insert(SalaryEmpCostCenter oSalaryEmpCostCenter)
// {
// TransactionContext tc = null;
// try
// {
// tc = TransactionContext.Begin(true);
// if (oSalaryEmpCostCenter.IsNew)
// {
// int id = tc.GenerateID("SalaryEmpCostCenter", "SalaryEmpCostCenterID");
// base.SetObjectID(oSalaryEmpCostCenter, (id));
// SalaryEmpCostCenterDA.Insert(tc, oSalaryEmpCostCenter);
// }
// else
// {
// SalaryEmpCostCenterDA.Update(tc, oSalaryEmpCostCenter);
// }
// tc.End();
// return oSalaryEmpCostCenter.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);
// SalaryEmpCostCenterDA.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
//}