using Ease.Core; using Ease.Core.DataAccess; using Ease.Core.Model; using HRM.BO; using HRM.DA; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HRM.DA { public class RowSumCalcItemService : ServiceTemplate, IRowSumCalcItemService { public RowSumCalcItemService() { } private void MapObject(RowSumCalcItem oRowSumCalcItem, DataReader oReader) { this.SetObjectID(oRowSumCalcItem, oReader.GetInt32("RowSumCalcItemID").Value); oRowSumCalcItem.CalcRowID = oReader.GetInt32("CalcRowID").Value; oRowSumCalcItem.OtherRowID = oReader.GetInt32("OtherRowID").Value; oRowSumCalcItem.Operator = (EnumOperator)oReader.GetInt32("Operator"); this.SetObjectState(oRowSumCalcItem, ObjectState.Saved); } protected override T CreateObject(DataReader oReader) { RowSumCalcItem oRowSumCalcItem = new RowSumCalcItem(); MapObject(oRowSumCalcItem, oReader); return oRowSumCalcItem as T; } //private RowSumCalcItem CreateObject(DataReader oReader) //{ // RowSumCalcItem oRowSumCalcItem = new RowSumCalcItem(); // MapObject(oRowSumCalcItem, oReader); // return oRowSumCalcItem; //} public List GetByRowID(int nRowID) { List oRowSumCalcItems = new List(); TransactionContext tc = null; try { tc = TransactionContext.Begin(true); DataReader oReader =new DataReader(RowSumCalcItemDA.GetByRowIDGetByRowID(tc, nRowID)); oRowSumCalcItems = CreateObjects(oReader); oReader.Close(); tc.End(); foreach(RowSumCalcItem oItem in oRowSumCalcItems) { oItem.RDReportRow = new RDReportRowService().Get(oItem.OtherRowID); } } catch (Exception e) { throw new ServiceException("Failed to Get RowSumCalcItem", e); } return oRowSumCalcItems; } } }