or
public ReportSource ReportSource
{
get
{
// create the report source for the report
var reportSource = new TypeReportSource
{
TypeName = _model.Report.TypeName + ", " + _model.Report.AssemblyName
};
// add all report parameters
foreach (var parameter in _model.Parameters)
{
reportSource.Parameters.Add(parameter.Parameter.Name, parameter.Value);
}
// set a title parameter to the title of the user's report
reportSource.Parameters.Add("Title", _model.Title);
return reportSource;
}
}
public ReportSource ReportSource
{
get
{
// create the report source for the report
var reportSource = new InstanceReportSource
{
ReportDocument = new BidTabReportByStatus()
};
// add all report parameters
foreach (var parameter in _model.Parameters)
{
reportSource.Parameters.Add(parameter.Parameter.Name, parameter.Value);
}
// set a title parameter to the title of the user's report
reportSource.Parameters.Add("Title", _model.Title);
return reportSource;
}
}
@{
// display the report
@(Html.TelerikReporting().ReportViewer()
.Id("reportViewer")
.ServiceUrl("/api/reports/")
.TemplateUrl("/ReportViewer/templates/telerikReportViewerTemplate.html")
.ReportSource(Model.ReportSource)
.ViewMode(ViewModes.INTERACTIVE)
.ScaleMode(ScaleModes.SPECIFIC)
.Scale(1.0)
.PersistSession(false))
}
@model StdPOTOrderPrint
@{
var uriRS = new UriReportSource() { Uri = @Model.ReportParms };
}
@(Html.TelerikReporting().ReportViewer()
.Id("reportViewer1")
.ServiceUrl(Url.Content("~/api/reports/"))
.TemplateUrl(Url.Content("~/ReportViewer/templates/telerikReportViewerTemplate.html"))
.ReportSource(uriRS)
.ViewMode(ViewModes.INTERACTIVE)
.ScaleMode(ScaleModes.SPECIFIC)
.Scale(1.0)
.PersistSession(false)
)
namespace CPR.WebPortal.Controllers
{
public class ReportsController : ReportsControllerBase
{
protected override IReportResolver CreateReportResolver()
{
return new CustomReportResolver();
}
protected override ICache CreateCache()
{
return Telerik.Reporting.Services.Engine.CacheFactory.CreateFileCache();
}
}
public class CustomReportResolver : IReportResolver
{
public Telerik.Reporting.ReportSource Resolve(string reportparms)
{
string[] stringSeparators = new string[] {"|"};
string[] sarray = reportparms.Split(stringSeparators, StringSplitOptions.None);
long patientid = Convert.ToInt64(sarray[0]);
long orderid = Convert.ToInt64(sarray[1]);
....
PatientPhysicianOrderStandardPropertyBag orderBag = new PatientPhysicianOrderStandardPropertyBag();
PatientHelper.Populate(order, orderBag);
PatientPhysicianOrderStandardDataObject _dataSource = new PatientPhysicianOrderStandardDataObject(workContext, orderBag);
Telerik.Reporting.Report report = new DHS.Client.Controllers.Reporting.ReportDefinitions.PatientPhysicianOrderStandardReport();
report.DataSource = orderBag;
Telerik.Reporting.InstanceReportSource irs = new Telerik.Reporting.InstanceReportSource();
irs.ReportDocument = report;
return irs;
}
}
}