private void _reportViewer_Load(object sender, EventArgs e) { if( ! _isReportViewerLoaded ) { Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); Microsoft.Reporting.WinForms.ReportDataSource reportDataSourceHeader = new Microsoft.Reporting.WinForms.ReportDataSource(); Microsoft.Reporting.WinForms.ReportDataSource reportDataSourceVendor = new Microsoft.Reporting.WinForms.ReportDataSource(); _reportViewer.LocalReport.ReportEmbeddedResource = "ReportsTestApp.Report1.rdlc"; // get access to the database WADALFacade DataLayer = new WADALFacade(); // get unit of work var uow = DataLayer.GetUnitOfWork(); // expression for getting line items Expression<Func<Rquote, bool>> exp = entity => entity.rquote == "8765" && entity.item != 999; // expression for getting header Expression<Func<Rquote, bool>> expHeader = entity => entity.rquote == "8765" && entity.item == 999; // get line items var results = uow.RquoteRepo.GetByQuery(exp); // get the header var header = uow.RquoteRepo.GetByQuery(expHeader); string idnum = string.Empty; foreach (var h in header) idnum = h.vendorId; // expression for getting the vendor record Expression<Func<Contact, bool>> expVendor = entity => entity.idnum == idnum; // get the vendor var vendor = uow.ContactRepo.GetByQuery(expVendor); // return the unit of work DataLayer.ReturnUnitOfWork(); reportDataSource1.Name = "DataSet1"; reportDataSourceHeader.Name = "DataSetHeader"; reportDataSourceVendor.Name = "DataSetVendor"; reportDataSource1.Value = results; reportDataSourceHeader.Value = header; reportDataSourceVendor.Value = vendor; _reportViewer.LocalReport.DataSources.Add(reportDataSource1); _reportViewer.LocalReport.DataSources.Add(reportDataSourceHeader); _reportViewer.LocalReport.DataSources.Add(reportDataSourceVendor); _reportViewer.RefreshReport(); _isReportViewerLoaded = true; } }
public void TearDown() { facade = null; }
public void Setup() { productType = typeof(Product); facade = new WADALFacade(); }