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(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 GetByVendorID(int id) { List bills = new List(); 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 List Get() { throw new NotImplementedException(); } public List Get(EnumVendorPaymentMode paymentMode) { throw new NotImplementedException(); } #endregion public int Save(VendorBill oVendorBill) { throw new NotImplementedException(); } public void Delete(int id) { throw new NotImplementedException(); } #endregion } }