public void AddSupplyOrder()
        {
            int tempId = SupplyOrder.GetNextOrderId();
            SupplyOrderEntry tempEntry1 = new SupplyOrderEntry(tempId, 1, "tempName1", 1, 1000);
            SupplyOrderEntry tempEntry2 = new SupplyOrderEntry(tempId, 2, "tempName2", 1, 1000);
            SupplyOrder      newOrder   = new SupplyOrder(tempId, 1);

            newOrder.AddEntry(tempEntry1);
            newOrder.AddEntry(tempEntry2);
            newOrder.SupplierId   = 1;
            newOrder.SupplierName = "Randil";
            Assert.IsTrue(SupplyOrder.AddSupplyOrder(newOrder));
        }
        public void CheckTheTransactionMode()
        {
            int tempId = SupplyOrder.GetNextOrderId();
            SupplyOrderEntry tempEntry1 = new SupplyOrderEntry(tempId, 1, "tempName1", 1, 1000);
            //add a item with same itemid, but when teh items are adding using gui this was prevented
            SupplyOrderEntry tempEntry2 = new SupplyOrderEntry(tempId, 1, "tempName2", 1, 1000);
            SupplyOrder      newOrder   = new SupplyOrder(tempId, 1);

            newOrder.AddEntry(tempEntry1);
            newOrder.AddEntry(tempEntry2);
            newOrder.SupplierId   = 1;
            newOrder.SupplierName = "Randil";
            Assert.IsFalse(SupplyOrder.AddSupplyOrder(newOrder));
            Assert.IsFalse(SupplyOrder.GetSupplyOrders(false, orderId: tempId.ToString()).Any());
        }
 public void SaveOrder()
 {
     if (SupplyOrder.AddSupplyOrder(_newOrder))
     {
         MessageBox.Show("Successfully Added", "Information", MessageBoxButton.OK,
                         MessageBoxImage.Information);
         InitializeNewOrder();
         SearchComboBox.Focus();
         NotifyObservers();
     }
     else
     {
         MessageBox.Show("Not Added", "Error", MessageBoxButton.OK,
                         MessageBoxImage.Error);
     }
 }