public IEnumerable <FactoryMaintenanceTask> GetAllFactoryMaintenanceTasks() { // Get all tasks and sort result by PriorityId and then by RegistrationDate. var maintenanceTasks = LiteDbHelper.GetCollection <FactoryMaintenanceTask>("FactoryMaintenanceTasks") .FindAll() .OrderByDescending(x => x.PriorityId) .ThenByDescending(x => x.TaskRegistrationDate); maintenanceTasks .ToList() .ForEach(x => x.FactoryDevice = GetSingleFactoryDevice(x.FactoryDeviceId)); return(maintenanceTasks); }
public IEnumerable <FactoryMaintenanceTask> GetFilteredByDeviceFactoryMaintenanceTasks(int factoryDeviceId) { // Get tasks by given device id and sort result by PriorityId and then by RegistrationDate. var maintenanceTasks = LiteDbHelper.GetCollection <FactoryMaintenanceTask>("FactoryMaintenanceTasks") .FindAll() .Where(x => x.FactoryDeviceId == factoryDeviceId) .OrderByDescending(x => x.PriorityId) .ThenByDescending(x => x.TaskRegistrationDate); // Get devices for task. maintenanceTasks .ToList() .ForEach(x => x.FactoryDevice = GetSingleFactoryDevice(x.FactoryDeviceId)); return(maintenanceTasks); }
public FactoryDevice GetSingleFactoryDevice(int factoryDeviceId) => LiteDbHelper.GetCollection <FactoryDevice>("FactoryDevices") .FindOne(x => x.DeviceId == factoryDeviceId);
public FactoryMaintenanceTask GetSingleFactoryMaintenanceTasks(Guid factoryMaintenanceTaskId) => LiteDbHelper.GetCollection <FactoryMaintenanceTask>("FactoryMaintenanceTasks") .FindOne(x => x.FactoryMaintenanceTaskId == factoryMaintenanceTaskId);
public IEnumerable <FactoryDevice> GetAllFactoryDevices() => LiteDbHelper.GetCollection <FactoryDevice>("FactoryDevices").FindAll();