EchoTex_Payroll/HRM.DA/Service/Vendor/VendorBillService.cs

109 lines
2.9 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
using System;
using Ease.Core.Model;
using Ease.Core.DataAccess;
using Ease.Core.Utility;
using System.Collections.Generic;
using HRM.BO;
using System.Data;
using Ease.Core;
using System.Linq;
namespace HRM.DA
{
class VendorBillService : ServiceTemplate, IVendorBillService
{
#region Map Functions
private void MapObject(VendorBill oBill, DataReader oReader)
{
base.SetObjectID(oBill, (oReader.GetInt32("VendorBillID").Value));
oBill.VendorID = oReader.GetInt32("VendorID", 0);
oBill.ChalanNumber = oReader.GetString("Challannumber");
oBill.EffectDate = oReader.GetDateTime("EffectDate").GetValueOrDefault();
oBill.Amount = oReader.GetDouble("Amount").GetValueOrDefault();
oBill.Remarks = oReader.GetString("Remarks");
oBill.IsAdvance = oReader.GetBoolean("IsAdvance").GetValueOrDefault();
oBill.IsFullPaid = oReader.GetBoolean("IsFullPaid").GetValueOrDefault();
oBill.PaymentMode = (EnumVendorPaymentMode)oReader.GetInt32("PaymentMode").GetValueOrDefault();
this.SetObjectState(oBill, Ease.Core.ObjectState.Saved);
}
protected override T CreateObject<T>(Ease.Core.DataAccess.DataReader dr)
{
VendorBill oBill = new VendorBill();
MapObject(oBill, dr);
return oBill as T;
}
#endregion
#region IVendorBillService Members
#region Get
public VendorBill Get(int id)
{
throw new NotImplementedException();
}
public List<VendorBill> GetByVendorID(int id)
{
List<VendorBill> bills = new List<VendorBill>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader oreader = new DataReader(VendorBillDA.GetByVendorID(tc, id));
bills = CreateObjects<VendorBill>(oreader);
oreader.Close();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
finally
{
tc.End();
}
return bills;
}
public List<VendorBill> Get()
{
throw new NotImplementedException();
}
public List<VendorBill> Get(EnumVendorPaymentMode paymentMode)
{
throw new NotImplementedException();
}
#endregion
public int Save(VendorBill oVendorBill)
{
throw new NotImplementedException();
}
public void Delete(int id)
{
throw new NotImplementedException();
}
#endregion
}
}