HRM-10/HRM.DA/Service/Fund/VoucherSetup/RowSumCalcItemService.cs
Mohaimen Hasan 838b8d4480 first commit
2026-11-03 13:06:00 +06:00

70 lines
2.2 KiB
C#

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<T>(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<RowSumCalcItem> GetByRowID(int nRowID)
{
List<RowSumCalcItem> oRowSumCalcItems = new List<RowSumCalcItem>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
DataReader oReader =new DataReader(RowSumCalcItemDA.GetByRowIDGetByRowID(tc, nRowID));
oRowSumCalcItems = CreateObjects<RowSumCalcItem>(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;
}
}
}