Initial commit

Initial commit til Git.
V2 er deployed
This commit is contained in:
2026-06-13 17:31:50 +02:00
parent 9fcd2b145e
commit 41e23b6184
375 changed files with 15956 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Database.Models;
using Database.Repository;
namespace Pos.Service
{
public static class CacheService
{
private static bool _invalidEmployee = false;
private static bool _invalidProductGroup = false;
private static List<EmployeeEntity> _employees;
private static List<ProductGroupEntity> _productGroups;
public static void Invalidate()
{
_invalidEmployee = true;
_invalidProductGroup = true;
}
public static ObservableCollection<EmployeeEntity> GetEmployee()
{
ObservableCollection<EmployeeEntity> obsEmployees = new ObservableCollection<EmployeeEntity>();
if (_invalidEmployee)
{
EmployeeRepository employeeRepository = new EmployeeRepository();
_employees = employeeRepository.GetAll();
foreach (EmployeeEntity employee in _employees)
{
obsEmployees.Add(employee);
}
_invalidEmployee = false;
}
return obsEmployees;
}
public static ObservableCollection<ProductGroupEntity> GetProductGroupsIncludeProducts()
{
ObservableCollection<ProductGroupEntity> obsProductGroups = new ObservableCollection<ProductGroupEntity>();
if(_invalidProductGroup)
{
ProductGroupRepository productGroupRepository = new ProductGroupRepository();
_productGroups = productGroupRepository.GetAll();
_invalidProductGroup = false;
foreach (ProductGroupEntity productGroup in _productGroups)
{
obsProductGroups.Add(productGroup);
}
}
return obsProductGroups;
}
}
}