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(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 GetByVendorID(ID id) { ObjectsTemplate bills = new ObjectsTemplate(); TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(VendorBillDA.GetByVendorID(tc, id)); bills = CreateObjects(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 Get() { throw new NotImplementedException(); } public ObjectsTemplate Get(EnumVendorPaymentMode paymentMode) { throw new NotImplementedException(); } #endregion public ID Save(VendorBill oVendorBill) { throw new NotImplementedException(); } public void Delete(ID id) { throw new NotImplementedException(); } #endregion } }