private void createReportBtn_Click(object sender, RoutedEventArgs e)
        {
            orderCheck curItem = orderChecksGrid.SelectedItem as orderCheck;
            Report     report  = new Report(curItem.waiter, curItem.table, curItem.dish_name, curItem.price);

            report.ShowDialog();
        }
Exemple #2
0
        private void cookBtn_Click(object sender, RoutedEventArgs e)
        {
            orderCheck curCheck   = (CurrentChecksGrid.SelectedItem as orderCheck);
            string     dish_name  = curCheck.dish_name;
            int        dish_count = curCheck.dish_count;
            int        checkId    = curCheck.id;
            Button     btn        = (Button)sender;

            if (btn.Content.ToString() == "Розпочати виконання" && btn.IsEnabled)
            {
                IngredientsList listWindow = new IngredientsList(dish_name, dish_count);
                if (listWindow.ShowDialog() == true)
                {
                    cooking newItem = new cooking()
                    {
                        check_id     = checkId,
                        status_id    = 4,
                        receive_time = DateTime.Now,
                        execute_time = DateTime.Now
                    };
                    _db.cooking.Add(newItem);
                    _db.SaveChanges();
                    if (CurrentChecksGrid.SelectedItem != null)
                    {
                        var row =
                            CurrentChecksGrid.ItemContainerGenerator.ContainerFromItem(CurrentChecksGrid.CurrentItem) as
                            DataGridRow;
                        row.IsEnabled  = false;
                        row.Background = Brushes.LightGray;
                    }

                    CurrentChecksGrid.UnselectAll();
                    btn.IsEnabled = false;
                    InProgressGrid.ItemsSource = GetCookingChecks();
                }
                else
                {
                    listWindow.Hide();
                    CurrentChecksGrid.UnselectAll();
                }
            }
        }