protected static string GetHtmlMessageFromResult(BaseResult distibuteResult) { if (distibuteResult.Success) { if (distibuteResult.GetType() == typeof(HubResult)) { var hubResult = CastResult <HubResult>(distibuteResult); return($"<p>Click on the following link <a href=\"{hubResult.FullLink}\">{hubResult.ReportName}</a> to open the report on the hub.</p>"); } else if (distibuteResult.GetType() == typeof(FTPResult)) { var ftpResult = CastResult <FTPResult>(distibuteResult); return($"<p>Click on the following link <a href=\"{ftpResult.FtpPath}\">{ftpResult.ReportName}</a> to open the report on the ftp server.</p>"); } else if (distibuteResult.GetType() == typeof(FileResult)) { var fileResult = CastResult <FileResult>(distibuteResult); return($"<p>The file was saved to the path '{fileResult.CopyPath}'.</p>"); } else if (distibuteResult.GetType() == typeof(MailResult)) { var mailResult = CastResult <MailResult>(distibuteResult); return($"<p>The Mail was sent to '{mailResult.To}'.</p>"); } else { throw new Exception($"Unknown result type '{distibuteResult?.GetType()?.Name ?? null}'."); } } else { return($"The generation of the report '{distibuteResult.ReportName}' has an error."); } }