public bool IsExist(int id) { using (PurchaseOrderDataAdapter adapter = new PurchaseOrderDataAdapter()) { return adapter.IsExist(id); } }
public int GetMaxId() { using (PurchaseOrderDataAdapter adapter = new PurchaseOrderDataAdapter()) { return adapter.GetMaxId(); } }
public bool Delete(int id) { using (PurchaseOrderDataAdapter adapter = new PurchaseOrderDataAdapter()) { return adapter.DeletePurchaseOrder(id); } }
public PurchaseOrder GetPurchaseOrderById(int id) { PurchaseOrder po = new PurchaseOrder(); using (IDataReader dr = new PurchaseOrderDataAdapter().GetPurchaseOrderById(id)) { if (dr.Read()) { po = PopulateReader(dr); } } return po; }
public IOrderedEnumerable<PurchaseOrder> GetPurchaseOrdes() { PurchaseOrderCollection collection = new PurchaseOrderCollection(); using (PurchaseOrderDataAdapter adapter = new PurchaseOrderDataAdapter()) { IDataReader dr = adapter.GetPurchaseOrders(); while (dr.Read()) { collection.Add(PopulateReader(dr)); } dr.Dispose(); adapter.Dispose(); } return collection.OrderByDescending(P=>P.Id); }
public PurchaseOrder Save(PurchaseOrder purchaseOrder) { using (PurchaseOrderDataAdapter adapter = new PurchaseOrderDataAdapter()) { if (this.IsExist(purchaseOrder.Id)) adapter.UpdatePurchaseOrder(purchaseOrder.Id, purchaseOrder.CustomerId , purchaseOrder.PONo, purchaseOrder.DateCreated, purchaseOrder.Quantity , purchaseOrder.Remarks, purchaseOrder.Price, purchaseOrder.DeliveryDateTime , purchaseOrder.TotalPrice, purchaseOrder.CreatedBy, purchaseOrder.Status); else adapter.InsertPurchaseOrder(purchaseOrder.CustomerId , purchaseOrder.PONo, purchaseOrder.DateCreated, purchaseOrder.Quantity , purchaseOrder.Remarks, purchaseOrder.Price, purchaseOrder.DeliveryDateTime , purchaseOrder.TotalPrice, purchaseOrder.CreatedBy, purchaseOrder.Status); } return purchaseOrder; }
public void GetPurchaseOrders() { PurchaseOrderDataAdapter adapter = new PurchaseOrderDataAdapter(); IDataReader reader = adapter.GetPurchaseOrders(); }