CEL_Payroll/Payroll.Service/Vender/Service/VendorBillService.cs

109 lines
3.0 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Payroll.BO;
using Ease.CoreV35.Model;
using Ease.CoreV35.DataAccess;
namespace Payroll.Service
{
class VendorBillService : ServiceTemplate, IVendorBillService
{
#region Map Functions
private void MapObject(VendorBill oBill, DataReader oReader)
{
base.SetObjectID(oBill, oReader.GetID("VendorBillID"));
oBill.VendorID = oReader.GetID("VendorID");
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.CoreV35.ObjectState.Saved);
}
protected override T CreateObject<T>(Ease.CoreV35.DataAccess.DataReader dr)
{
VendorBill oBill = new VendorBill();
MapObject(oBill, dr);
return oBill as T;
}
#endregion
#region IVendorBillService Members
#region Get
public VendorBill Get(ID id)
{
throw new NotImplementedException();
}
public ObjectsTemplate<VendorBill> GetByVendorID(ID id)
{
ObjectsTemplate<VendorBill> bills = new ObjectsTemplate<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 ObjectsTemplate<VendorBill> Get()
{
throw new NotImplementedException();
}
public ObjectsTemplate<VendorBill> Get(EnumVendorPaymentMode paymentMode)
{
throw new NotImplementedException();
}
#endregion
public ID Save(VendorBill oVendorBill)
{
throw new NotImplementedException();
}
public void Delete(ID id)
{
throw new NotImplementedException();
}
#endregion
}
}