Exemple #1
0
        private void WorklistItemChangedEventHandler(object sender, EventArgs e)
        {
            this.Modified = false;              // clear modified flag

            if (_context.WorklistItem != null)
            {
                LoadOrCreateReportContent();
            }
            else
            {
                _reportContent = null;
            }
            _previewComponent.Refresh();
            NotifyPropertyChanged("EditorText");
            NotifyPropertyChanged("PreviewVisible");
        }
Exemple #2
0
        protected virtual void LoadOrCreateReportContent()
        {
            if (!string.IsNullOrEmpty(_context.ReportContent))
            {
                // editing an existing report - just deserialize the content
                _reportContent = JsmlSerializer.Deserialize <ReportContent>(_context.ReportContent);
            }
            else
            {
                // create a new ReportContent object
                _reportContent = new ReportContent(null);

                // HACK: update the active ReportPart object with the structured report
                // (this is solely for the benefit of the Preview component, it does not have any affect on what is ultimately saved)
                var activePart = _context.Report.GetPart(_context.ActiveReportPartIndex);
                activePart.Content = _reportContent.ToJsml();
            }

            // Reset component validation since we just reloaded the report content
            ShowValidation(false);
        }
        public void Accept()
        {
            // only need to validate if submitting a report
            if (_hasReport && this.HasValidationErrors)
            {
                this.ShowValidation(true);
                return;
            }

            try
            {
                Platform.GetService <IReportingWorkflowService>(
                    service =>
                {
                    var reportData = new Dictionary <string, string>();
                    if (_hasReport)
                    {
                        var content = new ReportContent(_reportText);
                        reportData[ReportPartDetail.ReportContentKey] = content.ToJsml();
                    }

                    service.CompleteDowntimeProcedure(
                        new CompleteDowntimeProcedureRequest(
                            _procedureRef,
                            _hasReport,
                            reportData,
                            _interpreter == null ? null : _interpreter.StaffRef,
                            _transcriptionist == null ? null : _transcriptionist.StaffRef));
                });

                Exit(ApplicationComponentExitCode.Accepted);
            }
            catch (Exception e)
            {
                ExceptionHandler.Report(e, "", this.Host.DesktopWindow, () => Exit(ApplicationComponentExitCode.Error));
            }
        }