Exemplo n.º 1
0
        private void Submit_Button_Click(object sender, RoutedEventArgs e)
        {
            //Create the Order
            string query = "INSERT INTO table_name (orderDate, deliveryDate, paid, supplierNo, EmployeeNo) VALUES(); ";

            DatabaseManagement.Add(query);
        }
Exemplo n.º 2
0
        private void Submit_Button_Click(object sender, RoutedEventArgs e)
        {
            //Create the Order
            List <List <String> > supp     = DatabaseManagement.SelectQuery("Select supplierID from supplier where supplierName = '" + label.Content.ToString() + "';");
            List <String>         supplier = supp[0];
            string SupplierId = supplier[0];
            string delivery   = "";

            if (DatePick.SelectedDate.HasValue)
            {
                delivery = DatePick.SelectedDate.Value.ToString("yyyy-MM-dd");
            }
            else
            {
                delivery = DatePick.DisplayDateStart.Value.ToString("yyyy-MM-dd");
            }
            string query = "INSERT INTO `order` (orderDate, deliveryDate, paid, supplierNo, EmployeeNo, Authorized) VALUES ('" + DateTime.Today.ToString("yyyy-MM-dd") + "','" + delivery + "','" + label2_Copy2.Content.ToString() + "','" + SupplierId + "','3', '0'" + "); ";

            DatabaseManagement.Add(query);

            query = "SELECT orderNo FROM `order` WHERE orderNo = (SELECT max(orderNo)  FROM `order`);";
            List <List <String> > order   = DatabaseManagement.SelectQuery(query);
            List <String>         orderID = order[0];

            foreach (var item in OrderingItem)
            {
                query = "INSERT INTO `ItemsOrdered` (ItemID, OrderID, Quantity) VALUES ('" + item.ID + "','" + orderID[0] + "','" + item.Quantity + "');";
                DatabaseManagement.Add(query);
            }
            MessageBox.Show("Order has been succesfully placed", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);

            button1_Click(sender, e);
        }
Exemplo n.º 3
0
        private void button_Copy_Click(object sender, RoutedEventArgs e)
        {
            //add a supplier
            string query = "INSERT INTO supplier (supplierName, postalCode, location, country, deliveryDays) VALUES";

            DatabaseManagement.Add(query);
        }
Exemplo n.º 4
0
        private void Submit_Button_Click(object sender, RoutedEventArgs e)
        {
            foreach (ItemsOrdered item in orderedItems)
            {
                string Query = "INSERT INTO `delivery` (orderID, itemID, deliveredDate, Damaged, missing) VALUES('" + item.OrderID + "','" + item.ItemID + "','" + DateTime.Today.ToString("yyyy-MM-dd") + "','" + item.Dammaged + "','" + item.Missing + "'); ";
                DatabaseManagement.Add(Query);
                Query = "Update `garden` set StockLevel = 'StockLevel + " + (item.Quantity - item.Dammaged - item.Missing) + "' where itemId ='" + item.ItemID + "'";
                DatabaseManagement.Update(Query);
            }
            string query = "Update `order` set delivered = 1 where orderNo =" + orderItems[Orders.SelectedIndex].ID;

            DatabaseManagement.Update(query);
            Cancel_Button_Click(sender, e);
        }
Exemplo n.º 5
0
 private void YesButton_Click(object sender, RoutedEventArgs e)
 {
     if (SupplierTextBox.Text != string.Empty && PostalTextBox.Text != string.Empty && locationTextBox.Text != string.Empty && CountryTextBox.Text != string.Empty && DeliveryTextBox.Text != string.Empty)
     {
         //add a supplier
         string query = "INSERT INTO supplier (supplierName, postalCode, location, country, deliveryDays) VALUES('" + SupplierTextBox.Text + "','" + PostalTextBox.Text + "','" + locationTextBox.Text + "','" + CountryTextBox.Text + "','" + DeliveryTextBox.Text + "');";
         DatabaseManagement.Add(query);
         SupplierTextBox.Text   = null;
         PostalTextBox.Text     = null;
         locationTextBox.Text   = null;
         CountryTextBox.Text    = null;
         DeliveryTextBox.Text   = null;
         NewSupplier.Visibility = System.Windows.Visibility.Collapsed;
     }
 }