Exemple #1
0
        protected override ProcedureTypeData Export(ProcedureType entity, IReadContext context)
        {
            var data = new ProcedureTypeData
            {
                Deactivated     = entity.Deactivated,
                Id              = entity.Id,
                Name            = entity.Name,
                DefaultDuration = entity.DefaultDuration
            };

            if (entity.Plan.IsDefault)
            {
                data.DefaultModality = entity.Plan.DefaultModality.Id;
            }
            else
            {
                data.PlanXml = entity.Plan.AsXml();
                if (entity.BaseType != null)
                {
                    data.BaseTypeId = entity.BaseType.Id;
                }
            }

            return(data);
        }
        protected override ProcedureTypeGroupData Export(ProcedureTypeGroup entity, IReadContext context)
        {
            ProcedureTypeGroupData data = new ProcedureTypeGroupData();

            data.Name        = entity.Name;
            data.Class       = entity.GetClass().FullName;
            data.Description = entity.Description;

            data.ProcedureTypes = CollectionUtils.Map <ProcedureType, ProcedureTypeData>(
                entity.ProcedureTypes,
                delegate(ProcedureType pt)
            {
                ProcedureTypeData ptdata = new ProcedureTypeData();
                ptdata.Id = pt.Id;
                return(ptdata);
            });

            return(data);
        }
Exemple #3
0
        protected override void Import(ProcedureTypeData data, IUpdateContext context)
        {
            var pt = LoadOrCreateProcedureType(data.Id, data.Name, context);

            pt.Deactivated     = data.Deactivated;
            pt.DefaultDuration = data.DefaultDuration;
            if (!string.IsNullOrEmpty(data.DefaultModality))
            {
                pt.Plan = ProcedurePlan.CreateDefaultPlan(data.Name, GetModality(data.DefaultModality, context));
            }
            else
            {
                pt.Plan = new ProcedurePlan(data.PlanXml);
                if (!string.IsNullOrEmpty(data.BaseTypeId))
                {
                    pt.BaseType = LoadOrCreateProcedureType(data.BaseTypeId, data.BaseTypeId, context);
                }
            }
        }