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)); } }
public virtual bool Save(TCloseReason reason) { _context.ReportContent = _reportContent.ToJsml(); return(true); }