Ejemplo n.º 1
0
        private OperationData Map(TLG tlg, int?prescrptionId, string datacardPath, Dictionary <string, List <UniqueId> > linkedIds)
        {
            var tim        = _xmlReader.ReadTlgXmlData(datacardPath, tlg.A + ".xml").First();
            var isoRecords = _binaryReader.Read(datacardPath, tlg.A + ".bin", tim).ToList();
            var sections   = _sectionMapper.Map(new List <TIM> {
                tim
            }, isoRecords);
            var meters = sections != null?sections.SelectMany(x => x.GetWorkingDatas()).ToList() : new List <WorkingData>();

            var operationData = new OperationData
            {
                GetSpatialRecords    = () => _spatialRecordMapper.Map(isoRecords, meters),
                MaxDepth             = 0,
                GetDeviceElementUses = x => x == 0 ? sections : new List <DeviceElementUse>(),
                PrescriptionId       = prescrptionId
            };

            operationData.Id.UniqueIds.Add(_uniqueIdMapper.Map(tlg.A));

            if (linkedIds.ContainsKey(tlg.A))
            {
                foreach (var linkedId in linkedIds[tlg.A])
                {
                    operationData.Id.UniqueIds.Add(linkedId);
                }
            }

            return(operationData);
        }
Ejemplo n.º 2
0
        public TransferScript Map(Script script)
        {
            if (script == null)
            {
                return(null);
            }

            TransferScript transferScript = new TransferScript
            {
                ScriptId       = script.ScriptId,
                Title          = script.Title,
                CreatedDate    = script.CreatedDate,
                Description    = script.Description,
                LastEditedDate = script.LastEditedDate,

                OperatorId = script.OperatorId,
                PrompterId = script.PrompterId,
                OptionsId  = script.OptionsId,

                Operator = _userMapper.Map(script.Operator),
                Prompter = _userMapper.Map(script.Prompter),

                Options = _optionsMapper.Map(script.Options),

                EntityState = EntityState.Unchanged
            };

            if (script.Sections != null)
            {
                transferScript.Sections =
                    script.Sections
                    .Select(section => _sectionMapper.Map(section))
                    .ToList();
            }

            return(transferScript);
        }