Crystal Reports : How to add an external assembly class?
- by Sunil
I am using VS2010, CrystalReport13 & MVC3. My problem is unable to add an external assembly in Crystal Report using "Database Expert" Option.
I have a class named WeeklyReportModel in an external assembly. In my web project, data retrieving from DB as IEnumerable collection of WeeklyReportModel.
I tried ProjectData - .NetObjects in Crystal Report for adding the WeeklyReportModel. But this external assembly is not showing under ".NetObjects".
Then I tried other option as
Create New Connection - ADO.Net – Make New Connection and pointed this External Assembly. It has been added under Ado.Net node, but while expanding displays as "...no items found..."
Totally frustrated. Please help.
External Assembly Class:
namespace SMS.Domain
{
public class WeeklyReportModel
{
public int StoreId { get; set; }
public string StoreName{ get; set; }
public decimal Saturday { get; set; }
public decimal Sunday { get; set; }
public decimal Monday { get; set; }
public decimal Tuesday { get; set; }
public decimal Wednesday { get; set; }
public decimal Thurday { get; set; }
public decimal Friday { get; set; }
public decimal Average { get; set; }
public string DateRange { get; set; }
}
}
In Controller-action[Data retrieving as Collection Of WeeklyReportModel]
namespace SMS.UI.Controllers
{
public class ReportController : Controller
{
public ActionResult StoreWeeklyReport(string id)
{
DateTime weekStart, weekClose;
string[] dateArray = id.Split('_');
weekStart = Convert.ToDateTime(dateArray[0].ToString());
weekClose = Convert.ToDateTime(dateArray[1].ToString());
SMS.Infrastructure.Report.AuditReport weeklyReport
= new SMS.Infrastructure.Report.AuditReport();
IEnumerable<SMS.Domain.WeeklyReportModel> weeklyRpt =
weeklyReport.ReportByStore().WeeklyReport(weekStart, weekClose);
Session["WeeklyData"] = weeklyRpt;
Response.Redirect("~/Reports/Weekly/StoreWeekly.aspx");
return View();
}
}
}
Thanks in advance.