public LoadProtocolCodeForEditResponse LoadProtocolCodeForEdit(LoadProtocolCodeForEditRequest request)
		{
			var code = this.PersistenceContext.Load<ProtocolCode>(request.ProtocolCodeRef);

			var assembler = new ProtocolGroupAssembler();
			return new LoadProtocolCodeForEditResponse(assembler.GetProtocolCodeDetail(code));
		}
Example #2
0
		public UpdateProtocolCodeResponse UpdateProtocolCode(UpdateProtocolCodeRequest request)
		{
			var code = this.PersistenceContext.Load<ProtocolCode>(request.ProtocolCode.ProtocolCodeRef);
			var assembler = new ProtocolGroupAssembler();
			assembler.UpdateProtocolCode(code, request.ProtocolCode);

			this.PersistenceContext.SynchState();

			return new UpdateProtocolCodeResponse(assembler.GetProtocolCodeSummary(code));
		}
		public AddProtocolCodeResponse AddProtocolCode(AddProtocolCodeRequest request)
		{
			var assembler = new ProtocolGroupAssembler();
			var protocolCode = new ProtocolCode();
			assembler.UpdateProtocolCode(protocolCode, request.ProtocolCode);
			this.PersistenceContext.Lock(protocolCode, DirtyState.New);

			this.PersistenceContext.SynchState();

			return new AddProtocolCodeResponse(assembler.GetProtocolCodeSummary(protocolCode));
		}
		public ListProtocolCodesResponse ListProtocolCodes(ListProtocolCodesRequest request)
		{
			var where = new ProtocolCodeSearchCriteria();
			where.Name.SortAsc(0);
			if (!request.IncludeDeactivated)
				where.Deactivated.EqualTo(false);

			var codes = this.PersistenceContext.GetBroker<IProtocolCodeBroker>().Find(where, request.Page);

			var assembler = new ProtocolGroupAssembler();
			return new ListProtocolCodesResponse(
				CollectionUtils.Map<ProtocolCode, ProtocolCodeSummary>(
					codes,
					code => assembler.GetProtocolCodeSummary(code)));
		}
		public UpdateProtocolGroupResponse UpdateProtocolGroup(UpdateProtocolGroupRequest request)
		{
			var group = this.PersistenceContext.Load<ProtocolGroup>(request.ProtocolGroupRef);

			var assembler = new ProtocolGroupAssembler();
			assembler.UpdateProtocolGroup(group, request.Detail, this.PersistenceContext);

			this.PersistenceContext.SynchState();

			return new UpdateProtocolGroupResponse(assembler.GetProtocolGroupSummary(group));
		}
		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 GetProtocolGroupEditFormDataResponse GetProtocolGroupEditFormData(
			GetProtocolGroupEditFormDataRequest request)
		{
			var protocolAssembler = new ProtocolGroupAssembler();
			var codes = CollectionUtils.Map<ProtocolCode, ProtocolCodeSummary>(
				this.PersistenceContext.GetBroker<IProtocolCodeBroker>().FindAll(false),
				code => protocolAssembler.GetProtocolCodeSummary(code));

			var procedureTypeGroupAssembler = new ProcedureTypeGroupAssembler();

			var readingGroups = CollectionUtils.Map<ProcedureTypeGroup, ProcedureTypeGroupSummary>(
				this.PersistenceContext.GetBroker<IReadingGroupBroker>().FindAll(),
				readingGroup => procedureTypeGroupAssembler.GetProcedureTypeGroupSummary(readingGroup, this.PersistenceContext));

			return new GetProtocolGroupEditFormDataResponse(codes, readingGroups);
		}
		public LoadProtocolGroupForEditResponse LoadProtocolGroupForEdit(LoadProtocolGroupForEditRequest request)
		{
			var group = this.PersistenceContext.Load<ProtocolGroup>(request.ProtocolGroupRef);

			var assembler = new ProtocolGroupAssembler();
			return new LoadProtocolGroupForEditResponse(group.GetRef(), assembler.GetProtocolGroupDetail(group, this.PersistenceContext));
		}