From a3f6121eda8e1f7ad4aba86a6efb6e53c72ed7c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miskolczi=20Rich=C3=A1rd?= Date: Sun, 5 May 2024 18:20:50 +0200 Subject: [PATCH] Fixed missing buttons for deletion --- .../ViewModels/GetAllCustomersViewModel.cs | 17 ++++++++++++++++- .../GetAllMaintainerTeamsViewModel.cs | 11 +++++++++++ .../Windows/GetAll/GetAllCustomers.xaml | 7 ++++--- .../Windows/GetAll/GetAllMaintainerTeams.xaml | 5 +++-- .../Windows/GetAll/GetAllServices.xaml | 2 +- 5 files changed, 35 insertions(+), 7 deletions(-) diff --git a/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetAllCustomersViewModel.cs b/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetAllCustomersViewModel.cs index b3f6872..2280a6a 100644 --- a/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetAllCustomersViewModel.cs +++ b/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetAllCustomersViewModel.cs @@ -16,10 +16,16 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels public Customer SelectedCustomer { get { return selectedCustomer; } - set { SetProperty(ref selectedCustomer, value); (UpdateCustomerCommand as RelayCommand).NotifyCanExecuteChanged(); } + set + { + SetProperty(ref selectedCustomer, value); + (UpdateCustomerCommand as RelayCommand).NotifyCanExecuteChanged(); + (DeleteCustomerCommand as RelayCommand).NotifyCanExecuteChanged(); + } } public ICommand UpdateCustomerCommand { get; set; } + public ICommand DeleteCustomerCommand { get; set; } public static bool IsInDesignMode { @@ -44,6 +50,15 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels { return SelectedCustomer != null; }); + + DeleteCustomerCommand = new RelayCommand(() => + { + Customers.Delete(SelectedCustomer.ID); + }, + () => + { + return SelectedCustomer != null; + }); } } } diff --git a/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetAllMaintainerTeamsViewModel.cs b/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetAllMaintainerTeamsViewModel.cs index 2e85bec..b4c8048 100644 --- a/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetAllMaintainerTeamsViewModel.cs +++ b/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetAllMaintainerTeamsViewModel.cs @@ -22,11 +22,13 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels SetProperty(ref selectedMaintainerTeam, value); (UpdateMaintainerTeamCommand as RelayCommand).NotifyCanExecuteChanged(); (GetColleaguesCommand as RelayCommand).NotifyCanExecuteChanged(); + (DeleteMaintainerTeamCommand as RelayCommand).NotifyCanExecuteChanged(); } } public ICommand UpdateMaintainerTeamCommand { get; set; } public ICommand GetColleaguesCommand { get; set; } + public ICommand DeleteMaintainerTeamCommand { get; set; } public static bool IsInDesignMode { @@ -52,6 +54,15 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels return SelectedMaintainerTeam != null; }); + DeleteMaintainerTeamCommand = new RelayCommand(() => + { + MaintainerTeams.Delete(SelectedMaintainerTeam.ID); + }, + () => + { + return SelectedMaintainerTeam != null; + }); + GetColleaguesCommand = new RelayCommand(() => { Window window = new GetColleagues(SelectedMaintainerTeam); diff --git a/WD7UVN_SzTGUI_2023242.Client.WPF/Windows/GetAll/GetAllCustomers.xaml b/WD7UVN_SzTGUI_2023242.Client.WPF/Windows/GetAll/GetAllCustomers.xaml index e1466bc..d994e08 100644 --- a/WD7UVN_SzTGUI_2023242.Client.WPF/Windows/GetAll/GetAllCustomers.xaml +++ b/WD7UVN_SzTGUI_2023242.Client.WPF/Windows/GetAll/GetAllCustomers.xaml @@ -13,8 +13,8 @@ - - + + @@ -68,8 +68,9 @@ - +