internal override EntityRef Submit(OrderRequisition requisition, OrderEditorComponent component)
            {
                PlaceOrderResponse response = null;

                Platform.GetService <IOrderEntryService>(
                    service => response = service.PlaceOrder(new PlaceOrderRequest(requisition))
                    );

                return(response.Order.OrderRef);
            }
            internal override EntityRef Submit(OrderRequisition requisition, OrderEditorComponent component)
            {
                ReplaceOrderResponse response = null;

                Platform.GetService <IOrderEntryService>(
                    service => response = service.ReplaceOrder(new ReplaceOrderRequest(this.OrderRef, component.SelectedCancelReason, requisition))
                    );

                return(response.Order.OrderRef);
            }
            internal override EntityRef Submit(OrderRequisition requisition, OrderEditorComponent component)
            {
                ModifyOrderResponse response = null;

                requisition.OrderRef = component.OrderRef;
                Platform.GetService <IOrderEntryService>(service =>
                {
                    response = service.ModifyOrder(new ModifyOrderRequest(requisition));
                });
                return(response.Order.OrderRef);
            }
            internal override void Initialize(OrderEditorComponent component)
            {
                if (this.PatientProfile != null)
                {
                    component.UpdatePatientProfile(this.PatientProfile);
                }

                // need to apply the defaults here, since there is no "requisition" at this point
                if (this.Defaults.ScheduledTime.HasValue)
                {
                    component._schedulingRequestTime = this.Defaults.ScheduledTime;
                }
            }
 internal override void Initialize(OrderEditorComponent component)
 {
     // load the existing order
     Async.Request(component,
                   (IOrderEntryService service) =>
                   service.GetOrderRequisitionForEdit(new GetOrderRequisitionForEditRequest {
         OrderRef = this.OrderRef
     }),
                   response =>
     {
         component.OnOrderRequisitionLoaded(response.Requisition);
         // bug #3506: in replace mode, overwrite the procedures with clean one(s) based on diagnostic service
         component.UpdateDiagnosticService(response.Requisition.DiagnosticService);
         this.OrderRef = component.OrderRef;
     });
 }
            internal override void Initialize(OrderEditorComponent component)
            {
                // load the existing order
                Async.Request(component,
                              (IOrderEntryService service) =>
                              service.GetOrderRequisitionForEdit(new GetOrderRequisitionForEditRequest {
                    OrderRef = this.OrderRef, ProcedureRef = this.ProcedureRef
                }),
                              response =>
                {
                    component.OnOrderRequisitionLoaded(response.Requisition);

                    // if launched wrt a specific procedure, select it
                    if (this.ProcedureRef != null)
                    {
                        var x = component._proceduresTable.Items.Where(p => EntityRef.Equals(p.ProcedureRef, this.ProcedureRef, true));
                        component.SelectedProcedures = new Selection(x);
                    }
                });
            }
        protected bool ExecuteCore(WorklistItemSummaryBase item)
        {
            // first check for warnings
            var warnings = new List <string>();

            Platform.GetService <IOrderEntryService>(
                service => warnings = service.QueryCancelOrderWarnings(new QueryCancelOrderWarningsRequest(item.OrderRef)).Warnings);

            if (warnings.Count > 0)
            {
                var warn   = CollectionUtils.FirstElement(warnings);
                var action = this.Context.DesktopWindow.ShowMessageBox(
                    warn + "\n\nAre you sure you want to cancel and replace this order?",
                    MessageBoxActions.YesNo);
                if (action == DialogBoxAction.No)
                {
                    return(false);
                }
            }

            var title = string.Format("Replace Order {0} - {1} {2}",
                                      AccessionFormat.Format(item.AccessionNumber),
                                      PersonNameFormat.Format(item.PatientName),
                                      MrnFormat.Format(item.Mrn));
            var component = new OrderEditorComponent(new OrderEditorComponent.ReplaceOrderOperatingContext {
                OrderRef = item.OrderRef
            });
            var result = ApplicationComponent.LaunchAsDialog(
                this.Context.DesktopWindow,
                component,
                title);

            if (result == ApplicationComponentExitCode.Accepted)
            {
                InvalidateFolders();
                return(true);
            }

            return(false);
        }
示例#8
0
        private static void NewOrder(PatientProfileSummary patientProfile, string title, IDesktopWindow desktopWindow)
        {
            try
            {
                var component = new OrderEditorComponent(new OrderEditorComponent.NewOrderOperatingContext {
                    PatientProfile = patientProfile
                });
                var result = ApplicationComponent.LaunchAsDialog(
                    desktopWindow,
                    component,
                    title);

                if (result == ApplicationComponentExitCode.Accepted)
                {
                    DocumentManager.InvalidateFolder(typeof(Folders.Registration.ScheduledFolder));
                }
            }
            catch (Exception e)
            {
                ExceptionHandler.Report(e, desktopWindow);
            }
        }
示例#9
0
        protected bool ExecuteCore(WorklistItemSummaryBase item)
        {
            var title = string.Format("Modify Order {0} - {1} {2}",
                                      AccessionFormat.Format(item.AccessionNumber),
                                      PersonNameFormat.Format(item.PatientName),
                                      MrnFormat.Format(item.Mrn));
            var component = new OrderEditorComponent(new OrderEditorComponent.ModifyOrderOperatingContext {
                OrderRef = item.OrderRef
            });
            var result = ApplicationComponent.LaunchAsDialog(
                this.Context.DesktopWindow,
                component,
                title);

            if (result == ApplicationComponentExitCode.Accepted)
            {
                InvalidateFolders();
                return(true);
            }

            return(false);
        }
		/// <summary>
		/// Constructor
		/// </summary>
		public OrderEditorComponentControl(OrderEditorComponent component)
			: base(component)
		{
			InitializeComponent();
			_component = component;

			InitTabPage(_component.OrderNoteSummaryHost, _notesPage);
			InitTabPage(_component.AttachmentsComponentHost, _attachmentsPage);

			foreach (var extensionPage in _component.ExtensionPages)
			{
				AddExtensionPage(extensionPage);
			}

			// force toolbars to be displayed (VS designer seems to have a bug with this)
			_proceduresTableView.ShowToolbar = true;
			_recipientsTableView.ShowToolbar = true;

			_patient.LookupHandler = _component.PatientProfileLookupHandler;
			_patient.DataBindings.Add("Value", _component, "SelectedPatientProfile", true, DataSourceUpdateMode.OnPropertyChanged);
			_patient.DataBindings.Add("Enabled", _component, "IsPatientProfileEditable");

			_diagnosticService.LookupHandler = _component.DiagnosticServiceLookupHandler;
			_diagnosticService.DataBindings.Add("Value", _component, "SelectedDiagnosticService", true, DataSourceUpdateMode.OnPropertyChanged);
			_diagnosticService.DataBindings.Add("Enabled", _component, "IsDiagnosticServiceEditable");

			_indication.DataBindings.Add("Value", _component, "Indication", true, DataSourceUpdateMode.OnPropertyChanged);
			_indication.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");

			_proceduresTableView.Table = _component.Procedures;
			_proceduresTableView.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
			_proceduresTableView.MenuModel = _component.ProceduresActionModel;
			_proceduresTableView.ToolbarModel = _component.ProceduresActionModel;
			_proceduresTableView.DataBindings.Add("Selection", _component, "SelectedProcedures", true, DataSourceUpdateMode.OnPropertyChanged);

			if(_component.IsCopiesToRecipientsPageVisible)
			{
				_recipientsTableView.Table = _component.Recipients;
				_recipientsTableView.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
				_recipientsTableView.MenuModel = _component.RecipientsActionModel;
				_recipientsTableView.ToolbarModel = _component.RecipientsActionModel;
				_recipientsTableView.DataBindings.Add("Selection", _component, "SelectedRecipient", true, DataSourceUpdateMode.OnPropertyChanged);

				_addConsultantButton.DataBindings.Add("Enabled", _component.RecipientsActionModel.Add, "Enabled");

				_recipientLookup.LookupHandler = _component.RecipientsLookupHandler;
				_recipientLookup.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
				_recipientLookup.DataBindings.Add("Value", _component, "RecipientToAdd", true, DataSourceUpdateMode.OnPropertyChanged);

				_recipientContactPoint.DataBindings.Add("DataSource", _component, "RecipientContactPointChoices", true, DataSourceUpdateMode.Never);
				_recipientContactPoint.DataBindings.Add("Value", _component, "RecipientContactPointToAdd", true, DataSourceUpdateMode.OnPropertyChanged);
				_recipientContactPoint.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
				_recipientContactPoint.Format += delegate(object source, ListControlConvertEventArgs e) { e.Value = _component.FormatContactPoint(e.ListItem); };
			}
			else
			{
				_mainTab.TabPages.Remove(_copiesToRecipients);
			}


			_visit.DataSource = _component.ActiveVisits;
			_visit.DataBindings.Add("Value", _component, "SelectedVisit", true, DataSourceUpdateMode.OnPropertyChanged);
			_visit.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
			_visit.DataBindings.Add("Visible", _component, "VisitVisible");
			_visit.Format += delegate(object source, ListControlConvertEventArgs e) { e.Value = _component.FormatVisit(e.ListItem); };
			_visitSummaryButton.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
			_visitSummaryButton.DataBindings.Add("Visible", _component, "VisitVisible");

			_priority.DataSource = _component.PriorityChoices;
			_priority.DataBindings.Add("Value", _component, "SelectedPriority", true, DataSourceUpdateMode.OnPropertyChanged);
			_priority.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");

			_orderingFacility.DataBindings.Add("Value", _component, "OrderingFacility", true, DataSourceUpdateMode.OnPropertyChanged);
			// Ordering Facility's Enabled is not bound since it is always readonly (via designer)

			_orderingPractitioner.LookupHandler = _component.OrderingPractitionerLookupHandler;
			_orderingPractitioner.DataBindings.Add("Value", _component, "SelectedOrderingPractitioner", true, DataSourceUpdateMode.OnPropertyChanged);
			_orderingPractitioner.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");

			_orderingPractitionerContactPoint.DataBindings.Add("DataSource", _component, "OrderingPractitionerContactPointChoices", true, DataSourceUpdateMode.Never);
			_orderingPractitionerContactPoint.DataBindings.Add("Value", _component, "SelectedOrderingPractitionerContactPoint", true, DataSourceUpdateMode.OnPropertyChanged);
			_orderingPractitionerContactPoint.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
			_orderingPractitionerContactPoint.Format += delegate(object source, ListControlConvertEventArgs e) { e.Value = _component.FormatContactPoint(e.ListItem); };

			// bind date and time to same property
			_schedulingRequestDate.DataBindings.Add("Value", _component, "SchedulingRequestTime", true, DataSourceUpdateMode.OnPropertyChanged);
			_schedulingRequestDate.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
			_schedulingRequestDate.DataBindings.Add("Visible", _component, "SchedulingRequestTimeVisible");
			_schedulingRequestTime.DataBindings.Add("Value", _component, "SchedulingRequestTime", true, DataSourceUpdateMode.OnPropertyChanged);
			_schedulingRequestTime.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
			_schedulingRequestTime.DataBindings.Add("Visible", _component, "SchedulingRequestTimeVisible");

			_reorderReason.DataSource = _component.CancelReasonChoices;
			_reorderReason.DataBindings.Add("Value", _component, "SelectedCancelReason", true, DataSourceUpdateMode.OnPropertyChanged);
			_reorderReason.DataBindings.Add("Visible", _component, "IsCancelReasonVisible");

			_downtimeAccession.DataBindings.Add("Visible", _component, "IsDowntimeAccessionNumberVisible");
			_downtimeAccession.DataBindings.Add("Value", _component, "DowntimeAccessionNumber", true, DataSourceUpdateMode.OnPropertyChanged);

			_component.PropertyChanged += _component_PropertyChanged;
		}
            internal override void ApplyDefaults(ProcedureRequisition procedureRequisition, OrderEditorComponent component)
            {
                // apply the defaults iff this requisition is specifically the one that was requested to be edited
                if (!EntityRef.Equals(procedureRequisition.ProcedureRef, this.ProcedureRef, true))
                {
                    return;
                }
                if (!procedureRequisition.CanModify)
                {
                    return;
                }

                if (this.Defaults.ScheduledTime.HasValue)
                {
                    procedureRequisition.ScheduledTime = this.Defaults.ScheduledTime.Value;
                }

                if (this.Defaults.ScheduledDuration.HasValue)
                {
                    procedureRequisition.ScheduledDuration = this.Defaults.ScheduledDuration.Value;
                }

                if (this.Defaults.ModalityRef != null)
                {
                    var modality = component._modalityChoices.FirstOrDefault(m => m.ModalityRef.Equals(this.Defaults.ModalityRef, true));
                    procedureRequisition.Modality = modality;
                }
            }
			/// <summary>
			/// Applies default values to the specified procedure requisition.
			/// </summary>
			/// <param name="procedureRequisition"></param>
			/// <param name="component"></param>
			internal abstract void ApplyDefaults(ProcedureRequisition procedureRequisition, OrderEditorComponent component);
			internal override void Initialize(OrderEditorComponent component)
			{
				if (this.PatientProfile != null)
				{
					component.UpdatePatientProfile(this.PatientProfile);
				}

				// need to apply the defaults here, since there is no "requisition" at this point
				if (this.Defaults.ScheduledTime.HasValue)
				{
					component._schedulingRequestTime = this.Defaults.ScheduledTime;
				}
			}
			/// <summary>
			/// Submit the specified order requisition to the server.
			/// </summary>
			/// <param name="requisition"></param>
			/// <param name="component"></param>
			/// <returns></returns>
			internal abstract EntityRef Submit(OrderRequisition requisition, OrderEditorComponent component);
			internal override void ApplyDefaults(ProcedureRequisition procedureRequisition, OrderEditorComponent component)
			{
				// apply the defaults iff this requisition is specifically the one that was requested to be edited
				if (!EntityRef.Equals(procedureRequisition.ProcedureRef, this.ProcedureRef, true))
					return;
				if (!procedureRequisition.CanModify)
					return;

				if (this.Defaults.ScheduledTime.HasValue)
				{
					procedureRequisition.ScheduledTime = this.Defaults.ScheduledTime.Value;
				}

				if (this.Defaults.ScheduledDuration.HasValue)
				{
					procedureRequisition.ScheduledDuration = this.Defaults.ScheduledDuration.Value;
				}

				if (this.Defaults.ModalityRef != null)
				{
					var modality = component._modalityChoices.FirstOrDefault(m => m.ModalityRef.Equals(this.Defaults.ModalityRef, true));
					procedureRequisition.Modality = modality;
				}
			}
			internal override EntityRef Submit(OrderRequisition requisition, OrderEditorComponent component)
			{
				PlaceOrderResponse response = null;
				Platform.GetService<IOrderEntryService>(
					service => response = service.PlaceOrder(new PlaceOrderRequest(requisition))
				);

				return response.Order.OrderRef;
			}
 /// <summary>
 /// Initialize the order editor component.
 /// </summary>
 /// <param name="component"></param>
 internal abstract void Initialize(OrderEditorComponent component);
 /// <summary>
 /// Applies default values to the specified procedure requisition.
 /// </summary>
 /// <param name="procedureRequisition"></param>
 /// <param name="component"></param>
 internal abstract void ApplyDefaults(ProcedureRequisition procedureRequisition, OrderEditorComponent component);
        /// <summary>
        /// Constructor
        /// </summary>
        public OrderEditorComponentControl(OrderEditorComponent component)
            : base(component)
        {
            InitializeComponent();
            _component = component;

            InitTabPage(_component.OrderNoteSummaryHost, _notesPage);
            InitTabPage(_component.AttachmentsComponentHost, _attachmentsPage);

            foreach (var extensionPage in _component.ExtensionPages)
            {
                AddExtensionPage(extensionPage);
            }

            // force toolbars to be displayed (VS designer seems to have a bug with this)
            _proceduresTableView.ShowToolbar = true;
            _recipientsTableView.ShowToolbar = true;

            _patient.LookupHandler = _component.PatientProfileLookupHandler;
            _patient.DataBindings.Add("Value", _component, "SelectedPatientProfile", true, DataSourceUpdateMode.OnPropertyChanged);
            _patient.DataBindings.Add("Enabled", _component, "IsPatientProfileEditable");

            _diagnosticService.LookupHandler = _component.DiagnosticServiceLookupHandler;
            _diagnosticService.DataBindings.Add("Value", _component, "SelectedDiagnosticService", true, DataSourceUpdateMode.OnPropertyChanged);
            _diagnosticService.DataBindings.Add("Enabled", _component, "IsDiagnosticServiceEditable");

            _indication.DataBindings.Add("Value", _component, "Indication", true, DataSourceUpdateMode.OnPropertyChanged);
            _indication.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");

            _proceduresTableView.Table = _component.Procedures;
            _proceduresTableView.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
            _proceduresTableView.MenuModel    = _component.ProceduresActionModel;
            _proceduresTableView.ToolbarModel = _component.ProceduresActionModel;
            _proceduresTableView.DataBindings.Add("Selection", _component, "SelectedProcedures", true, DataSourceUpdateMode.OnPropertyChanged);

            if (_component.IsCopiesToRecipientsPageVisible)
            {
                _recipientsTableView.Table = _component.Recipients;
                _recipientsTableView.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
                _recipientsTableView.MenuModel    = _component.RecipientsActionModel;
                _recipientsTableView.ToolbarModel = _component.RecipientsActionModel;
                _recipientsTableView.DataBindings.Add("Selection", _component, "SelectedRecipient", true, DataSourceUpdateMode.OnPropertyChanged);

                _addConsultantButton.DataBindings.Add("Enabled", _component.RecipientsActionModel.Add, "Enabled");

                _recipientLookup.LookupHandler = _component.RecipientsLookupHandler;
                _recipientLookup.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
                _recipientLookup.DataBindings.Add("Value", _component, "RecipientToAdd", true, DataSourceUpdateMode.OnPropertyChanged);

                _recipientContactPoint.DataBindings.Add("DataSource", _component, "RecipientContactPointChoices", true, DataSourceUpdateMode.Never);
                _recipientContactPoint.DataBindings.Add("Value", _component, "RecipientContactPointToAdd", true, DataSourceUpdateMode.OnPropertyChanged);
                _recipientContactPoint.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
                _recipientContactPoint.Format += delegate(object source, ListControlConvertEventArgs e) { e.Value = _component.FormatContactPoint(e.ListItem); };
            }
            else
            {
                _mainTab.TabPages.Remove(_copiesToRecipients);
            }


            _visit.DataSource = _component.ActiveVisits;
            _visit.DataBindings.Add("Value", _component, "SelectedVisit", true, DataSourceUpdateMode.OnPropertyChanged);
            _visit.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
            _visit.DataBindings.Add("Visible", _component, "VisitVisible");
            _visit.Format += delegate(object source, ListControlConvertEventArgs e) { e.Value = _component.FormatVisit(e.ListItem); };
            _visitSummaryButton.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
            _visitSummaryButton.DataBindings.Add("Visible", _component, "VisitVisible");

            _priority.DataSource = _component.PriorityChoices;
            _priority.DataBindings.Add("Value", _component, "SelectedPriority", true, DataSourceUpdateMode.OnPropertyChanged);
            _priority.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");

            _orderingFacility.DataBindings.Add("Value", _component, "OrderingFacility", true, DataSourceUpdateMode.OnPropertyChanged);
            // Ordering Facility's Enabled is not bound since it is always readonly (via designer)

            _orderingPractitioner.LookupHandler = _component.OrderingPractitionerLookupHandler;
            _orderingPractitioner.DataBindings.Add("Value", _component, "SelectedOrderingPractitioner", true, DataSourceUpdateMode.OnPropertyChanged);
            _orderingPractitioner.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");

            _orderingPractitionerContactPoint.DataBindings.Add("DataSource", _component, "OrderingPractitionerContactPointChoices", true, DataSourceUpdateMode.Never);
            _orderingPractitionerContactPoint.DataBindings.Add("Value", _component, "SelectedOrderingPractitionerContactPoint", true, DataSourceUpdateMode.OnPropertyChanged);
            _orderingPractitionerContactPoint.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
            _orderingPractitionerContactPoint.Format += delegate(object source, ListControlConvertEventArgs e) { e.Value = _component.FormatContactPoint(e.ListItem); };

            // bind date and time to same property
            _schedulingRequestDate.DataBindings.Add("Value", _component, "SchedulingRequestTime", true, DataSourceUpdateMode.OnPropertyChanged);
            _schedulingRequestDate.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
            _schedulingRequestDate.DataBindings.Add("Visible", _component, "SchedulingRequestTimeVisible");
            _schedulingRequestTime.DataBindings.Add("Value", _component, "SchedulingRequestTime", true, DataSourceUpdateMode.OnPropertyChanged);
            _schedulingRequestTime.DataBindings.Add("Enabled", _component, "OrderIsNotCompleted");
            _schedulingRequestTime.DataBindings.Add("Visible", _component, "SchedulingRequestTimeVisible");

            _reorderReason.DataSource = _component.CancelReasonChoices;
            _reorderReason.DataBindings.Add("Value", _component, "SelectedCancelReason", true, DataSourceUpdateMode.OnPropertyChanged);
            _reorderReason.DataBindings.Add("Visible", _component, "IsCancelReasonVisible");

            _downtimeAccession.DataBindings.Add("Visible", _component, "IsDowntimeAccessionNumberVisible");
            _downtimeAccession.DataBindings.Add("Value", _component, "DowntimeAccessionNumber", true, DataSourceUpdateMode.OnPropertyChanged);

            _component.PropertyChanged += _component_PropertyChanged;
        }
			/// <summary>
			/// Initialize the order editor component.
			/// </summary>
			/// <param name="component"></param>
			internal abstract void Initialize(OrderEditorComponent component);
示例#21
0
 public void SetComponent(IApplicationComponent component)
 {
     _component = (OrderEditorComponent)component;
 }
			internal override void Initialize(OrderEditorComponent component)
			{
				// load the existing order
				Async.Request(component,
							  (IOrderEntryService service) =>
							  service.GetOrderRequisitionForEdit(new GetOrderRequisitionForEditRequest { OrderRef = this.OrderRef }),
							  response =>
							  {
								  component.OnOrderRequisitionLoaded(response.Requisition);
								  // bug #3506: in replace mode, overwrite the procedures with clean one(s) based on diagnostic service
								  component.UpdateDiagnosticService(response.Requisition.DiagnosticService);
								  this.OrderRef = component.OrderRef;
							  });
			}
			internal override EntityRef Submit(OrderRequisition requisition, OrderEditorComponent component)
			{
				ModifyOrderResponse response = null;
				requisition.OrderRef = component.OrderRef;
				Platform.GetService<IOrderEntryService>(service =>
				{
					response = service.ModifyOrder(new ModifyOrderRequest(requisition));
				});
				return response.Order.OrderRef;
			}
            internal override void ApplyDefaults(ProcedureRequisition procedureRequisition, OrderEditorComponent component)
            {
                if (this.Defaults.ScheduledTime.HasValue)
                {
                    procedureRequisition.ScheduledTime = ComputeScheduledTime(this.Defaults.ScheduledTime.Value, component._proceduresTable.Items);
                }

                if (this.Defaults.ModalityRef != null)
                {
                    var modality = component._modalityChoices.FirstOrDefault(m => m.ModalityRef.Equals(this.Defaults.ModalityRef, true));
                    procedureRequisition.Modality = modality;
                }
            }
 /// <summary>
 /// Submit the specified order requisition to the server.
 /// </summary>
 /// <param name="requisition"></param>
 /// <param name="component"></param>
 /// <returns></returns>
 internal abstract EntityRef Submit(OrderRequisition requisition, OrderEditorComponent component);
			internal override void ApplyDefaults(ProcedureRequisition procedureRequisition, OrderEditorComponent component)
			{
				if (this.Defaults.ScheduledTime.HasValue)
				{
					procedureRequisition.ScheduledTime = ComputeScheduledTime(this.Defaults.ScheduledTime.Value, component._proceduresTable.Items);
				}

				if (this.Defaults.ModalityRef != null)
				{
					var modality = component._modalityChoices.FirstOrDefault(m => m.ModalityRef.Equals(this.Defaults.ModalityRef, true));
					procedureRequisition.Modality = modality;
				}
			}
			internal override void Initialize(OrderEditorComponent component)
			{
				// load the existing order
				Async.Request(component,
							  (IOrderEntryService service) =>
							  service.GetOrderRequisitionForEdit(new GetOrderRequisitionForEditRequest { OrderRef = this.OrderRef, ProcedureRef = this.ProcedureRef }),
							  response =>
							  	{
							  		component.OnOrderRequisitionLoaded(response.Requisition);

									// if launched wrt a specific procedure, select it
									if(this.ProcedureRef != null)
									{
										var x = component._proceduresTable.Items.Where(p => EntityRef.Equals(p.ProcedureRef, this.ProcedureRef, true));
										component.SelectedProcedures = new Selection(x);
									}
							  	});
			}
 public void SetComponent(IApplicationComponent component)
 {
     _component = (OrderEditorComponent)component;
 }
			internal override EntityRef Submit(OrderRequisition requisition, OrderEditorComponent component)
			{
				ReplaceOrderResponse response = null;
				Platform.GetService<IOrderEntryService>(
					service => response = service.ReplaceOrder(new ReplaceOrderRequest(this.OrderRef, component.SelectedCancelReason, requisition))
				);

				return response.Order.OrderRef;
			}