Rework so employee dont use repos but servies

This commit is contained in:
Alex Pedersen
2026-07-30 10:23:27 +02:00
parent 6df185d519
commit 9497afe262
26 changed files with 630 additions and 125 deletions

View File

@@ -11,8 +11,8 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Database.Repository;
using Pos.Category;
using Pos.Service;
using Pos.Setting.ProductGroup;
namespace Pos.Setting
@@ -22,6 +22,9 @@ namespace Pos.Setting
/// </summary>
public partial class SettingWindow : Window
{
private readonly ProductGroupService _productGroupService =
new ProductGroupService();
public SettingWindow()
{
InitializeComponent();
@@ -42,10 +45,8 @@ namespace Pos.Setting
private void btnProductGroups_Click(object sender, RoutedEventArgs e)
{
ProductWindow productWindow = new ProductWindow();
//Check if there is any categories, if not close this window with a message.
ProductGroupRepository categoryRepository = new ProductGroupRepository();
bool anyExist = categoryRepository.Any();
bool anyExist = _productGroupService.HasProductGroups();
if (!anyExist)
{
MessageBox.Show("Der er ingen kategorier, opret dem først", "Kategorier", MessageBoxButton.OK,
@@ -53,6 +54,7 @@ namespace Pos.Setting
}
else
{
ProductWindow productWindow = new ProductWindow();
productWindow.Show();
}
}