コード例 #1
0
 public bool IsExist(int id)
 {
     using (PurchaseOrderDataAdapter adapter = new PurchaseOrderDataAdapter())
     {
         return adapter.IsExist(id);
     }
 }
コード例 #2
0
 public int GetMaxId()
 {
     using (PurchaseOrderDataAdapter adapter = new PurchaseOrderDataAdapter())
     {
         return adapter.GetMaxId();
     }
 }
コード例 #3
0
 public bool Delete(int id)
 {
     using (PurchaseOrderDataAdapter adapter = new PurchaseOrderDataAdapter())
     {
         return adapter.DeletePurchaseOrder(id);
     }
 }
コード例 #4
0
 public PurchaseOrder GetPurchaseOrderById(int id)
 {
     PurchaseOrder po = new PurchaseOrder();
     using (IDataReader dr = new PurchaseOrderDataAdapter().GetPurchaseOrderById(id))
     {
         if (dr.Read())
         {
             po = PopulateReader(dr);
         }
     }
     return po;
 }
コード例 #5
0
        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);
        }
コード例 #6
0
        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;
        }
コード例 #7
0
 public void GetPurchaseOrders()
 {
     PurchaseOrderDataAdapter adapter = new PurchaseOrderDataAdapter();
     IDataReader reader = adapter.GetPurchaseOrders();
 }