public void RandomOrder() { var context = (IRegistrationWorkflowItemToolContext)this.ContextBase; try { var item = CollectionUtils.FirstElement(context.SelectedItems); if (item == null) { var profile = GetRandomPatient() ?? RandomUtils.CreatePatient(); PlaceRandomOrderForPatient(profile, profile.Mrn.AssigningAuthority); } else { PlaceRandomOrderForPatient(new PatientProfileSummary { PatientProfileRef = item.PatientProfileRef, PatientRef = item.PatientRef }, item.Mrn.AssigningAuthority); } // invalidate the scheduled worklist folders context.InvalidateFolders(typeof(Folders.Registration.ScheduledFolder)); } catch (Exception e) { ExceptionHandler.Report(e, context.DesktopWindow); } }