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