private void Close_Program(object sender, RoutedEventArgs e) { ConfirmReadiness confWindow = new ConfirmReadiness("Ви впевнені, що хочете вийти?"); if (confWindow.ShowDialog() == true) { this.Close(); } else { confWindow.Hide(); } }
private void Change_User(object sender, RoutedEventArgs e) { ConfirmReadiness confWindow = new ConfirmReadiness("Ви впевнені, що хочете вийти?"); if (confWindow.ShowDialog() == true) { LoginScreen login = new LoginScreen(); login.Show(); this.Close(); } else { confWindow.Hide(); } }
private void deleteIngrBtn_Click(object sender, RoutedEventArgs e) { ConfirmReadiness confWindow = new ConfirmReadiness("Ви підтверджуєте видалення інгредієнту?"); if (confWindow.ShowDialog() == true) { int recipe_id = (IngredientsGrid.SelectedItem as RecipeContent).id; var deleteIngr = _db.recipes.First(c => c.id == recipe_id); _db.recipes.Remove(deleteIngr); _db.SaveChanges(); IngredientsGrid.ItemsSource = GetItems(dishName).ToList(); } else { confWindow.Hide(); } }
private void deleteBtn_Click(object sender, RoutedEventArgs e) { ConfirmReadiness confWindow = new ConfirmReadiness("Ви підтверджуєте видалення рецепту?"); if (confWindow.ShowDialog() == true) { int menu_id = (RecipesGrid.SelectedItem as MenuTable).menu_id; var deleteDish = _db.menu.First(c => c.id == menu_id); _db.menu.Remove(deleteDish); _db.SaveChanges(); RecipesGrid.ItemsSource = GetItems().ToList(); } else { confWindow.Hide(); } }
private void readyBtn_Click(object sender, RoutedEventArgs e) { cookingCheck cookCheck = (InProgressGrid.SelectedItem as cookingCheck); int check_id = cookCheck.check_id; Button btn = (Button)sender; ConfirmReadiness confWindow = new ConfirmReadiness("Ви підтверджуєте готовність замовлення?"); if (confWindow.ShowDialog() == true && btn.IsEnabled) { cooking curCooking = _db.getCurrentCooking(check_id).Single(); curCooking.status_id = 3; curCooking.execute_time = DateTime.Now; _db.SaveChanges(); btn.Content = "Виконано"; CurrentChecksGrid.UnselectAll(); btn.IsEnabled = false; InProgressGrid.ItemsSource = GetCookingChecks(); AllChecksGrid.ItemsSource = GetChecks(DateTime.Now); } else { confWindow.Hide(); } }