Hi there,
currently I am working on a project to create custom reports.
I do that in this way:
I created a WCF-Service with a method which returns a Stream. This stream is the custom report, rendered to a pdf that is shown in a RadPDFViewer.
I do that because we need to send a list of all Reports that should be merged to one reportbook where every report is one single site with different data.
To create one report, I use this function:
Now I want to create a function that gives me a list of all available reports with its ReportParameters.
I already get a list of reports, but I am now looking for a way to get the parameters.
This is what I have at the moment:
Any kind of idea or hint?
Best Regards
Manfred
currently I am working on a project to create custom reports.
I do that in this way:
I created a WCF-Service with a method which returns a Stream. This stream is the custom report, rendered to a pdf that is shown in a RadPDFViewer.
I do that because we need to send a list of all Reports that should be merged to one reportbook where every report is one single site with different data.
To create one report, I use this function:
public
Report GetReport(ReportEntry entry)
{
dynamic newReport =
new
Object();
string
parameterNameWithError =
string
.Empty;
string
parameterValue =
string
.Empty;
string
parameterType =
string
.Empty;
try
{
Type reportType = Type.GetType(
"ReportingService.Reports."
+ entry.Name);
newReport = Activator.CreateInstance(reportType);
foreach
(var para
in
entry.ParameterList)
{
parameterNameWithError = para.Name;
parameterValue = para.Value;
parameterType = para.Type;
newReport.ReportParameters[para.Name].Value = para.Value;
}
}
catch
(Exception ex)
{
newReport =
new
Reports.ErrorReport();
newReport.ReportParameters[
"ReportName"
].Value = entry.Name;
newReport.ReportParameters[
"ParameterName"
].Value = parameterNameWithError;
newReport.ReportParameters[
"ParameterValue"
].Value = parameterValue;
newReport.ReportParameters[
"ParameterType"
].Value = parameterType;
newReport.ReportParameters[
"ErrorMessage"
].Value = ex.Message;
}
return
newReport;
}
Now I want to create a function that gives me a list of all available reports with its ReportParameters.
I already get a list of reports, but I am now looking for a way to get the parameters.
This is what I have at the moment:
Type[] classes = Assembly.GetExecutingAssembly().GetExportedTypes();
foreach
(Type t
in
classes)
{
if
(t.FullName.Contains(
"Reports.Report"
))
{
PropertyInfo[] props = t.GetProperties();
foreach
(var prop
in
props)
{
if
(prop.Name.Equals(
"ReportParameters"
))
{
// What should I do here ???
}
}
}
Any kind of idea or hint?
Best Regards
Manfred