示例#1
0
        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));
        }
 private void InitializeNewOrder()
 {
     _orderId = SupplyOrder.GetNextOrderId();
     SearchComboBox.ItemsSource = Supplier.GetSuppliers();
     InvoiceIdTextBox.Text      = _orderId.ToString();
     TotalAmountTextBox.Text    = "";
     CheckBox.IsChecked         = false;
     RefreshDataGrid();
     _newOrder = new SupplyOrder(_orderId, 1)
     {
         Paid = false
     };
     RefreshSupplyDataGrid();
 }
示例#3
0
        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());
        }