Exemplo n.º 1
0
        protected override DiagnosticServiceData Export(DiagnosticService entity, IReadContext context)
        {
            var data = new DiagnosticServiceData
            {
                Deactivated    = entity.Deactivated,
                Id             = entity.Id,
                Name           = entity.Name,
                ProcedureTypes = CollectionUtils.Map <ProcedureType, ProcedureTypeData>(entity.ProcedureTypes, pt => new ProcedureTypeData {
                    Id = pt.Id
                })
            };

            return(data);
        }
Exemplo n.º 2
0
        protected override void Import(DiagnosticServiceData data, IUpdateContext context)
        {
            var ds = GetDiagnosticService(data.Id, data.Name, context);

            ds.Deactivated = data.Deactivated;
            ds.Name        = data.Name;

            if (data.ProcedureTypes != null)
            {
                foreach (var s in data.ProcedureTypes)
                {
                    var where = new ProcedureTypeSearchCriteria();
                    where.Id.EqualTo(s.Id);
                    var pt = CollectionUtils.FirstElement(context.GetBroker <IProcedureTypeBroker>().Find(where));
                    if (pt != null)
                    {
                        ds.ProcedureTypes.Add(pt);
                    }
                }
            }
        }