Exemple #1
0
		public ProtocolDetail CreateProtocolDetail(Protocol protocol, IPersistenceContext context)
		{
			var detail = new ProtocolDetail();
			var staffAssembler = new StaffAssembler();

			detail.ProtocolRef = protocol.GetRef();
			detail.Author = protocol.Author != null ? staffAssembler.CreateStaffSummary(protocol.Author, context) : null;
			detail.Supervisor = protocol.Supervisor != null ? staffAssembler.CreateStaffSummary(protocol.Supervisor, context) : null;
			detail.Status = EnumUtils.GetEnumValueInfo(protocol.Status, context);
			detail.Urgency = EnumUtils.GetEnumValueInfo(protocol.Urgency);
			detail.RejectReason = EnumUtils.GetEnumValueInfo(protocol.RejectReason);

			detail.Codes = protocol.Codes == null
				? new List<ProtocolCodeSummary>()
				: CollectionUtils.Map<ProtocolCode, ProtocolCodeSummary>(protocol.Codes, CreateProtocolCodeSummary);

			var procedureAssembler = new ProcedureAssembler();
			detail.Procedures = protocol.Procedures == null
				? new List<ProcedureDetail>()
				: CollectionUtils.Map<Procedure, ProcedureDetail>(
					protocol.Procedures,
					procedure => procedureAssembler.CreateProcedureDetail(procedure, delegate { return false; }, false, context));

			return detail;
		}
        public override ProcedureStep CreateInstance(XmlElement xmlNode, Procedure procedure)
        {
            Protocol protocol = new Protocol(procedure);
            ProtocolAssignmentStep step = new ProtocolAssignmentStep(protocol);

            //note: this is not ideal but there is no other way to save the protocol object
            PersistenceScope.CurrentContext.Lock(protocol, DirtyState.New);

            return step;
        }
Exemple #3
0
		public void UpdateProtocol(Protocol protocol, ProtocolDetail detail, IPersistenceContext context)
		{
			protocol.Urgency = EnumUtils.GetEnumValue<ProtocolUrgencyEnum>(detail.Urgency, context);

			// if detail specifies a supervisor use it otherwise retain previous supervisor (null or valued)
			protocol.Supervisor = detail.Supervisor != null ? context.Load<Staff>(detail.Supervisor.StaffRef) : protocol.Supervisor;

			protocol.Codes.Clear();
			foreach (var codeSummary in detail.Codes)
			{
				var code = context.Load<ProtocolCode>(codeSummary.ProtocolCodeRef, EntityLoadFlags.Proxy);
				protocol.Codes.Add(code);
			}
		}
 public ProtocolProcedureStep(Protocol protocol)
 {
     Platform.CheckForNullReference(protocol, "protocol");
     _protocol = protocol;
 }
 public ProtocolAssignmentStep(Protocol protocol)
     : base(protocol)
 {
 }