public ProtocolGroupDetail GetProtocolGroupDetail(ProtocolGroup group, IPersistenceContext context) { List<ProtocolCodeSummary> codes = CollectionUtils.Map<ProtocolCode, ProtocolCodeSummary>( group.Codes, delegate(ProtocolCode code) { return GetProtocolCodeSummary(code); }); ProcedureTypeGroupAssembler assembler = new ProcedureTypeGroupAssembler(); List<ProcedureTypeGroupSummary> readingGroups = CollectionUtils.Map<ProcedureTypeGroup, ProcedureTypeGroupSummary>( group.ReadingGroups, delegate(ProcedureTypeGroup readingGroup) { return assembler.GetProcedureTypeGroupSummary(readingGroup, context); }); return new ProtocolGroupDetail(group.Name, group.Description, codes, readingGroups); }
public void UpdateProtocolGroup(ProtocolGroup group, ProtocolGroupDetail detail, IPersistenceContext context) { group.Name = detail.Name; group.Description = detail.Description; group.Codes.Clear(); detail.Codes.ForEach(delegate(ProtocolCodeSummary summary) { group.Codes.Add(context.Load<ProtocolCode>(summary.ProtocolCodeRef)); }); group.ReadingGroups.Clear(); detail.ReadingGroups.ForEach(delegate(ProcedureTypeGroupSummary procedureTypeGroupSummary) { group.ReadingGroups.Add(context.Load<ReadingGroup>(procedureTypeGroupSummary.ProcedureTypeGroupRef)); }); }
public ProtocolGroupDetail CreateProtocolGroupDetail(ProtocolGroup group, bool includeDeactivatedCodes, IPersistenceContext context) { var protocolCodes = includeDeactivatedCodes ? group.Codes : CollectionUtils.Select(group.Codes, code => !code.Deactivated); var protocolCodeSummaries = CollectionUtils.Map<ProtocolCode, ProtocolCodeSummary>( protocolCodes, CreateProtocolCodeSummary); var assembler = new ProcedureTypeGroupAssembler(); var groups = CollectionUtils.Map<ProcedureTypeGroup, ProcedureTypeGroupSummary>( group.ReadingGroups, readingGroup => assembler.GetProcedureTypeGroupSummary(readingGroup, context)); return new ProtocolGroupDetail(group.Name, group.Description, protocolCodeSummaries, groups); }
public AddProtocolGroupResponse AddProtocolGroup(AddProtocolGroupRequest request) { var assembler = new ProtocolGroupAssembler(); var group = new ProtocolGroup(); assembler.UpdateProtocolGroup(group, request.Detail, this.PersistenceContext); this.PersistenceContext.Lock(group, DirtyState.New); this.PersistenceContext.SynchState(); return new AddProtocolGroupResponse(assembler.GetProtocolGroupSummary(group)); }
public ProtocolGroupSummary GetProtocolGroupSummary(ProtocolGroup protocolGroup) { return new ProtocolGroupSummary(protocolGroup.GetRef(), protocolGroup.Name, protocolGroup.Description); }
public ProtocolGroupSummary CreateProtocolGroupSummary(ProtocolGroup group) { return new ProtocolGroupSummary(group.GetRef(), group.Name, group.Description); }