Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 public FactoryDevice GetSingleFactoryDevice(int factoryDeviceId)
 => LiteDbHelper.GetCollection <FactoryDevice>("FactoryDevices")
 .FindOne(x => x.DeviceId == factoryDeviceId);
Exemple #4
0
 public FactoryMaintenanceTask GetSingleFactoryMaintenanceTasks(Guid factoryMaintenanceTaskId)
 => LiteDbHelper.GetCollection <FactoryMaintenanceTask>("FactoryMaintenanceTasks")
 .FindOne(x => x.FactoryMaintenanceTaskId == factoryMaintenanceTaskId);
Exemple #5
0
 public IEnumerable <FactoryDevice> GetAllFactoryDevices()
 => LiteDbHelper.GetCollection <FactoryDevice>("FactoryDevices").FindAll();