public static void AddScheduledProcedureStep(this MWLDataset ds, ImagingServiceRequest request, WorklistRequestedProcedure procedure, WorklistScheduledProcedureStep procedureStep) { MWLDataset.ScheduledProcedureStepRow sps = ds.ScheduledProcedureStep.NewScheduledProcedureStepRow(); procedureStep.CopyTo <MWLDataset.ScheduledProcedureStepRow>(sps); sps.AccessionNumber = request.AccessionNumber; sps.RequestedProcedureID = procedure.RequestedProcedureID; if (procedureStep.ScheduledProcedureStepStartDate_Time != null && procedureStep.ScheduledProcedureStepStartDate_Time.StartDate.HasValue) { sps.ScheduledProcedureStepStartDate_Time = procedureStep.ScheduledProcedureStepStartDate_Time.StartDate.Value; } ds.ScheduledProcedureStep.AddScheduledProcedureStepRow(sps); if (procedureStep.ScheduledStationAETitle != null && procedureStep.ScheduledStationAETitle.Count > 0) { foreach (string ae in procedureStep.ScheduledStationAETitle) { MWLDataset.ScheduledStationAETitlesRow row = ds.ScheduledStationAETitles.NewScheduledStationAETitlesRow(); row.ScheduledStationAETitle = ae; row.ScheduledProcedureStepID = procedureStep.ScheduledProcedureStepID; ds.ScheduledStationAETitles.Rows.Add(row); } } if (procedureStep.ScheduledStationName != null && procedureStep.ScheduledStationName.Count > 0) { foreach (string name in procedureStep.ScheduledStationName) { MWLDataset.ScheduledStationNamesRow row = ds.ScheduledStationNames.NewScheduledStationNamesRow(); row.ScheduledStationName = name; row.ScheduledProcedureStepID = procedureStep.ScheduledProcedureStepID; ds.ScheduledStationNames.Rows.Add(row); } } if (procedureStep.ScheduledProtocolCodeSequence != null) { foreach (ScheduledProtocolCodeSequence spcs in procedureStep.ScheduledProtocolCodeSequence) { MWLDataset.ScheduledProtocolCodeSequenceRow row = ds.ScheduledProtocolCodeSequence.NewScheduledProtocolCodeSequenceRow(); row.CodeMeaning = spcs.CodeMeaning; row.CodeValue = spcs.CodeValue; row.CodingSchemeDesignator = spcs.CodingSchemeDesignator; row.CodingSchemeVersion = spcs.CodingSchemeVersion; row.SetOrderNumberNull(); row.ScheduledProcedureStepID = procedureStep.ScheduledProcedureStepID; ds.ScheduledProtocolCodeSequence.AddScheduledProtocolCodeSequenceRow(row); } } }
public void AddScheduledProcedureStep(string userName, string accessionNumber, string requestedProcedureID, WorklistScheduledProcedureStep procedureStep) { ImagingServiceRequest imgRequest = new ImagingServiceRequest() { AccessionNumber = accessionNumber }; WorklistRequestedProcedure reqProcedure = new WorklistRequestedProcedure() { RequestedProcedureID = requestedProcedureID }; Check.ArgumentNotNullOrEmpty(requestedProcedureID, "requestedProcedureID"); Check.ArgumentNotNullOrEmpty(accessionNumber, "accessionNumber"); Check.ArgumentNotNullOrEmpty(requestedProcedureID, "requestedProcedureID"); Check.ArgumentNotNull(procedureStep.ScheduledProcedureStepStartDate_Time, "ScheduledProcedureStepStartDate_Time"); Check.ArgumentNotNullOrEmpty(procedureStep.Modality, "Modality"); Check.ArgumentNotNullOrEmpty(procedureStep.ScheduledProcedureStepDescription, "ScheduledProcedureStepDescription"); if (procedureStep.ScheduledProtocolCodeSequence != null) { foreach (ScheduledProtocolCodeSequence cs in procedureStep.ScheduledProtocolCodeSequence) { Check.ArgumentNotNullOrEmpty(cs.CodeValue, "ScheduledProtocolCodeSequence.CodeValue"); Check.ArgumentNotNullOrEmpty(cs.CodingSchemeDesignator, "ScheduledProtocolCodeSequence.CodingSchemeDesignator"); } } using (MWLDataset ds = _DataAccessAgent.Find(imgRequest, reqProcedure)) { if (ds != null && ds.RequestedProcedure.Rows.Count > 0) { ds.AddScheduledProcedureStep(imgRequest, reqProcedure, procedureStep); _DataAccessAgent.UpdateMWL(ds); } } }