public IEnumerable <OperationData> PostProcessOperationData(TaskDataMapper taskDataMapper, IEnumerable <OperationData> operationDatas) { var result = new List <OperationData>(); var catalog = taskDataMapper.AdaptDataModel.Catalog; foreach (var operationData in operationDatas) { var deviceModels = operationData.GetAllSections() .Select(x => catalog.DeviceElementConfigurations.FirstOrDefault(y => y.Id.ReferenceId == x.DeviceConfigurationId)) .Where(x => x != null) .Select(x => catalog.DeviceElements.FirstOrDefault(y => y.Id.ReferenceId == x.DeviceElementId)) .Where(x => x != null) .Select(x => x.DeviceModelId) .Distinct() .Select(x => catalog.DeviceModels.FirstOrDefault(y => y.Id.ReferenceId == x)) .Where(x => x != null) .ToList(); if (deviceModels.Count == 1 && !string.IsNullOrWhiteSpace(deviceModels[0].Description)) { var trimmed = deviceModels[0].Description.Trim(); if (trimmed.EqualsIgnoreCase("Trip Computer Data")) { operationData.OperationType = OperationTypeEnum.DataCollection; } else if (trimmed.EqualsIgnoreCase("Vehicle Geometry")) { continue; } } result.Add(operationData); } return(result); }
public TimeLogMapperFactory(TaskDataMapper taskDataMapper) { _taskDataMapper = taskDataMapper; _timeLogMapper = new TimeLogMapper(taskDataMapper); _multiFileTimeLogMapper = new MultiFileTimeLogMapper(taskDataMapper); _manufacturer = ManufacturerFactory.GetManufacturer(taskDataMapper); }
public static IManufacturer GetManufacturer(TaskDataMapper taskDataMapper) { if (taskDataMapper.ISOTaskData.TaskControllerManufacturer.EqualsIgnoreCase(CNHManufacturer)) { return(new CNH()); } return(null); }
void IPlugin.Export(ApplicationDataModel.ADM.ApplicationDataModel dataModel, string exportPath, Properties properties) { //Convert the ADAPT model into the ISO model string outputPath = exportPath.WithTaskDataPath(); TaskDataMapper taskDataMapper = new TaskDataMapper(outputPath, properties); ISO11783_TaskData taskData = taskDataMapper.Export(dataModel); //Serialize the ISO model to XML TaskDocumentWriter writer = new TaskDocumentWriter(); writer.WriteTaskData(exportPath, taskData); //Serialize the Link List writer.WriteLinkList(exportPath, taskData.LinkList); }
public IList <ApplicationDataModel.ADM.ApplicationDataModel> Import(string dataPath, Properties properties = null) { var taskDataObjects = ReadDataCard(dataPath); if (taskDataObjects == null) { return(null); } var adms = new List <ApplicationDataModel.ADM.ApplicationDataModel>(); foreach (var taskData in taskDataObjects) { //Convert the ISO model to ADAPT TaskDataMapper taskDataMapper = new TaskDataMapper(taskData.DataFolder, properties); ApplicationDataModel.ADM.ApplicationDataModel dataModel = taskDataMapper.Import(taskData); adms.Add(dataModel); } return(adms); }