public MemoryStreamResult Execute(object sourceData, CreationType exportCreationType) { _logger.Log(LogType.Trace, this.GetAssemblyName(), string.Format("Enter {0}.Execute, DebuggerAttached={1}", this.GetType().Name, this._debuggerIsAttached), this.GetType().Name); Guard.IsNotNull(sourceData, "sourceData"); // Generate the report MemoryStreamResult result = this.GenerateReport(sourceData, exportCreationType); var resultStatus = result == null ? MemoryStreamResultStatus.Unknown : result.Status; _logger.Log(LogType.Trace, this.GetAssemblyName(), string.Format("Exit {0}.Execute, with status {1}", this.GetType().Name, resultStatus), this.GetType().Name); return(result); }
private static void TryWriteAndOpen(MemoryStreamResult result, string name) { switch (result.Status) { case MemoryStreamResultStatus.Failure: MessageBox.Show(result.ErrorMessage, "Result Status=Failure"); break; case MemoryStreamResultStatus.Success: // Write to file and open string filePath = string.Format(@"{0}\TestOutput_{1}.xlsx", Directory.GetCurrentDirectory(), name); File.WriteAllBytes(filePath, result.MemoryStream.ToArray()); System.Diagnostics.Process.Start(filePath); break; default: MessageBox.Show("Unknown Status"); break; } }