コード例 #1
0
ファイル: ChefForm.cs プロジェクト: NWTC85464/82781_Team1
        public void GetDataTables()
        {
            // Getting the order data from the database
            OrderTableAdapt.GetData();
            // Filling the data to the datatable
            OrderTableAdapt.Fill(orders);


            // Getting the order data from the database
            OrderItemsTableAdapt.GetData();
            // Filling the data to the datatable
            OrderItemsTableAdapt.Fill(orderItems);


            // Getting the order data from the database
            MenuItemsTableAdapt.GetData();
            // Filling the data to the datatable
            MenuItemsTableAdapt.Fill(menuItems);

            ActiveOrders.Clear();
            // Put active orders inside active order list
            foreach (RestaurantDataSet.OrdersRow order in orders.Where(o => o.isActive == "1"))
            {
                ActiveOrders.Add(order);
            }
        }
コード例 #2
0
        private void AddItemToOrder(string itemName, int quantity)
        {
            int.TryParse(insertedOrderId, out int orderNumber);
            // Get item ID
            int itemId = GetItemId(itemName);

            // Setting up a variable for the datatable from the database
            RestaurantDataSet.OrderItemsDataTable orderItems = new RestaurantDataSet.OrderItemsDataTable();
            // Setting up an order items adaptor and it's to fill in the datatable
            RestaurantDataSetTableAdapters.OrderItemsTableAdapter orderItemsTableAdap = new RestaurantDataSetTableAdapters.OrderItemsTableAdapter();
            // Getting the order items data from the database
            orderItemsTableAdap.GetData();
            // Filling the data to the datatable
            orderItemsTableAdap.Fill(orderItems);
            // Add the selection to the preview list
            orderPreviewListBox.Items.Add(itemName + " (" + quantity + ")");
            // Adding the new record to the database
            orderItemsTableAdap.Insert(quantity.ToString(), itemId, orderNumber);
        }