public override void imprimir() { ReportViewerForm reporte = new ReportViewerForm(); reporte.setDocumento(new ProductosReport()); reporte.Show(); }
private void PrintStickersToolStripMenuItem_Click(object sender, EventArgs e) { if (documentListDataGridView.Rows.Count < 1) { MessageBox.Show(WindowMessages.NO_DATA_AVAILABLE_FOR_PRINT, WindowMessages.WARNING_TITLE); return; } if (new PrintStickersSelectionForm(this).ShowDialog() != DialogResult.OK) { return; } var allRows = documentListDataGridView.Rows.Cast <DataGridViewRow>().Select(r => r.DataBoundItem).Cast <UPNDocument>().ToList(); var stickersDataSet = allRows.Where(upn => upn.Selected).Select(upn => upn.Member).ToList(); for (var i = 0; i < stickersToSkip; i++) { stickersDataSet.Insert(0, new Member()); } var form = ReportViewerForm.GetInstance(); form.SetReport( stickerFormat, new ReportDataSource("DataSet1", stickersDataSet), new List <ReportParameter>() ); }
private void additionToolStripMenuItem_Click(object sender, EventArgs e) { OLAXPayrollBL.Company cmp = new OLAXPayrollBL.Company(); ReportViewerForm myReportViewer = new ReportViewerForm(); DataTable addition = new DataTable(); addition = objAdd.ALLAdditions(); DataSet ds = new DataSet(); ds.Tables.Add(addition); if (ds.Tables[0].Rows.Count > 0) { addition.WriteXml("additionList.xml"); PRAdditionRPT myAlladdition = new PRAdditionRPT(); myAlladdition.SetDataSource(ds); myReportViewer.Show(); myAlladdition.SetParameterValue("CompanyName", objComp.getCompanyName()); myAlladdition.SetParameterValue("Division", User.StrDivision); myReportViewer.cryRPTViewer.ReportSource = myAlladdition; myReportViewer.Show(); } }
private void button2_Click(object sender, EventArgs e) { var Stomach = new Stomach { Name = TName.Text, Age = TAge.Text, Gender = CGender.Text, FileNo = TFileNo.Text, Date = dateTimePicker1.Value, Premedication = TPremedication.Text, Scope = CScope.Text, ReferredDoctor = TReferredDoctor.Text, ClinicalData = TClinicalData.Text, GEJ = TGEJ.Text, Esophagus = TEsophagus.Text, StomachDetails = TStomach.Text, D1 = TD1.Text, D2 = TD2.Text, Conclusion = TConclusion.Text, Assistant = TAssistant.Text, Endoscopist = TEndoscopist.Text, }; _context.Stomaches.Add(Stomach); _context.SaveChanges(); CrystalReport2 cr = new CrystalReport2(); cr.SetParameterValue("@Id", Stomach.Id); var ForCr = new ReportViewerForm(); ForCr.crystalReportViewer1.ReportSource = cr; ForCr.crystalReportViewer1.Refresh(); ForCr.Show(); }
private void activeLoansToolStripMenuItem_Click(object sender, EventArgs e) { try { if (ReportService.GetInstance().CanLoadDocument()) { var reportName = (sender as ToolStripMenuItem).Tag.ToString(); var report = ReportService.GetInstance().GetReportByName(reportName); var reportParamsForm = new ReportParamsForm(report.Params, report.Title); if (reportParamsForm.ShowDialog() != DialogResult.OK) { return; } var progressForm = new ReportLoadingProgressForm(); progressForm.Show(); var bw = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true, }; bw.DoWork += (obj, args) => { ReportService.GetInstance().LoadReport(report); bw.ReportProgress(100); }; bw.RunWorkerCompleted += (obj, args) => { progressForm.Close(); if (args.Error != null) { Fail(args.Error.Message); return; } if (args.Cancelled) { return; } report.OpenCount++; report.SaveOpenCount(); var reportViewer = new ReportViewerForm(report); reportViewer.Show(); }; bw.RunWorkerAsync(report); } else { var translationService = new TranslationService(); MessageBox.Show(translationService.Translate("Crystal reports haven't been installed.")); } } catch (Exception ex) { Fail(ex.Message); } }
static void Main(string[] args) { // Add the event handler for handling UI thread exceptions to the event. Application.ThreadException += new ThreadExceptionEventHandler(ExceptionHandler); // Set the unhandled exception mode to force all Windows Forms errors to go through // our handler. Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); bool execute = (args.Length >= 1 && args[0].ToLower() == "/e"); bool executeOutputOrView = (args.Length >= 1 && args[0].ToLower() == "/x"); string reportToOpen = null; if (args.Length >= 2 && File.Exists(args[1])) { reportToOpen = args[1]; } if ((execute || executeOutputOrView) && reportToOpen != null) { //Execute only var report = Report.LoadFromFile(reportToOpen, Repository.Create()); string outputGUID = null, viewGUID = null; if (executeOutputOrView) { string guid = (args.Length >= 3 ? args[2] : ""); if (!string.IsNullOrEmpty(guid)) { if (report.Views.Exists(i => i.GUID == guid)) { viewGUID = guid; } if (report.Outputs.Exists(i => i.GUID == guid)) { outputGUID = guid; } } else { //by default execute first output if (report.Outputs.Count > 0) { outputGUID = report.Outputs[0].GUID; } } } var reportViewer = new ReportViewerForm(true, Properties.Settings.Default.ShowScriptErrors); reportViewer.ViewReport(report, false, viewGUID, outputGUID, report.FilePath); Application.Run(); } else { Application.Run(new ReportDesigner()); } }
private void OnPrintCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) { Report r = e.Result as Report; Debug.Assert(r != null, "Report not loaded"); ReportViewerForm frm = new ReportViewerForm(r); frm.Show(); //btnPrint.StopProgress(); }
private void OnReportsClick(object sender, LinkLabelLinkClickedEventArgs e) { try { var reportName = (sender as LinkLabel).Tag.ToString(); var report = ReportService.GetInstance().GetReportByName(reportName); var reportParamsForm = new ReportParamsForm(report.Params, report.Title); if (reportParamsForm.ShowDialog() != DialogResult.OK) { return; } var progressForm = new ReportLoadingProgressForm(); progressForm.Show(); var bw = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true, }; bw.DoWork += (obj, args) => { ReportService.GetInstance().LoadReport(report); bw.ReportProgress(100); }; bw.RunWorkerCompleted += (obj, args) => { progressForm.Close(); if (args.Error != null) { Fail(args.Error.Message); return; } if (args.Cancelled) { return; } report.OpenCount++; report.SaveOpenCount(); var reportViewer = new ReportViewerForm(report); reportViewer.Show(); }; bw.RunWorkerAsync(report); } catch (Exception ex) { Fail(ex.Message); } }
private void showReportButton_Click(object sender, EventArgs e) { var selectedStat = (Report)reportsListBox.SelectedItem; var form = ReportViewerForm.GetInstance(); //form.SetReport(selectedStat.ReportPath, selectedStat.DataSource, selectedStat.Parameters); form.SetReport( selectedStat.ReportPath, selectedStat.GetDataSource(GetQueryParameterValues()), GetReportParameterValues() ); }
private void PrintReport(Guid guid) { ReportService rs = ReportService.GetInstance(); Report report = rs.GetReport(guid); if (null == report) { return; } try { List <ReportParamV2> additionalParams = report.Params .Where(p => p.Additional && p.Visible) .ToList(); if (additionalParams.Count != 0) { ReportParamsForm reportParamsForm = new ReportParamsForm(additionalParams, report.Title); if (reportParamsForm.ShowDialog() != DialogResult.OK) { return; } } ReportInitializer(report); try { StartProgress(); rs.LoadReport(report); } finally { StopProgress(); } } catch (Exception exception) { new frmShowError( CustomExceptionHandler.ShowExceptionText(exception) ).ShowDialog(); throw; } ReportViewerForm frm = new ReportViewerForm(report); frm.Show(); }
private void OnPrintCompleted(object sender, RunWorkerCompletedEventArgs e) { try { Report r = e.Result as Report; Debug.Assert(r != null, "Report not loaded"); ReportViewerForm frm = new ReportViewerForm(r); frm.Show(); } catch (Exception) { MessageBox.Show("Error generating teller report"); } //btnPrint.StopProgress(); }
private void PrintPaymentsListToolStripMenuItem_Click(object sender, EventArgs e) { if (paymentsDataGridView.Rows.Count < 1) { MessageBox.Show(WindowMessages.NO_DATA_AVAILABLE_FOR_PRINT, WindowMessages.WARNING_TITLE); return; } //new ReportViewerForm(GetReportDefinition(), GetDataSource(), new List<ReportParameter>()).Show(); var form = ReportViewerForm.GetInstance(); form.SetCustomReport( GetReportDefinition(), GetDataSource(), new List <ReportParameter>() ); }
private void PrintButton_Click(object sender, EventArgs e) { if (paymentDebtsDataGridView.Rows.Count < 1) { MessageBox.Show(WindowMessages.NO_DATA_AVAILABLE_FOR_PRINT, WindowMessages.WARNING_TITLE); return; } //new ReportViewerForm(REPORT_NAME, GetReportDataSet(), new List<ReportParameter>()).Show(); //form.SetReport(selectedStat.ReportPath, selectedStat.DataSource, selectedStat.Parameters); ReportViewerForm.GetInstance().SetReport( REPORT_NAME, GetReportDataSet(), new List <ReportParameter>() ); }
private void employeeToolStripMenuItem_Click(object sender, EventArgs e) { DataSet ds = objEmp.getAllEmployeeDetail(); if (ds.Tables[0].Rows.Count > 0) { ds.WriteXml("EmployeeMasterDetail.xml"); EmployeeMasterListRPT myReport = new EmployeeMasterListRPT(); myReport.SetDataSource(ds); ReportViewerForm reportViewer = new ReportViewerForm(); myReport.SetParameterValue("Division", User.StrDivision); myReport.SetParameterValue("CompanyName", new OLAXPayrollBL.Company().getCompanyName()); reportViewer.cryRPTViewer.ReportSource = myReport; reportViewer.Show(); } else { MessageBox.Show("Not data in report!!!"); } }
private void butExport_Click(object sender, EventArgs e) { double exchangeRate; Currency pivotCurrency = ServicesProvider.GetInstance().GetCurrencyServices().GetPivot(); exchangeRate = 1; Currency indexCurrency = pivotCurrency; if (_CurrencyId > 0) { indexCurrency = ServicesProvider.GetInstance().GetCurrencyServices().GetCurrency(_CurrencyId); if (!pivotCurrency.Equals(indexCurrency)) { exchangeRate = ServicesProvider.GetInstance().GetExchangeRateServices().GetMostRecentlyRate(TimeProvider.Today, indexCurrency); } } if (exchangeRate == 0) { MessageBox.Show(@"Please enter an exchange rate", @"Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { ReportService rs = ReportService.GetInstance(); Report report = rs.GetReportByName("Accounting_Balances.zip"); if (!report.IsLoaded) { return; } report.AddParam("PIVOT_CURRENCY", pivotCurrency.Code); report.AddParam("INDEX_CURRENCY", indexCurrency.Code); report.AddParam("currencyId", _CurrencyId); rs.LoadReport(report); ReportViewerForm frmViewer = new ReportViewerForm(report); frmViewer.Show(); } }
private void designationToolStripMenuItem_Click(object sender, EventArgs e) { DataTable dt = Desi.ListDesignation(); dt.TableName = "Designation"; if (dt.Rows.Count > 0) { dt.WriteXml("DesignationRPT.xml"); PRDesignationRPT DesignationRPT = new PRDesignationRPT(); DesignationRPT.SetDataSource(dt); DesignationRPT.SetParameterValue("CompanyName", objComp.getCompanyName()); ReportViewerForm reportViewer = new ReportViewerForm(); reportViewer.cryRPTViewer.ReportSource = DesignationRPT; reportViewer.Show(); } else { MessageBox.Show("No data Preview"); } }
private void companyToolStripMenuItem_Click(object sender, EventArgs e) { DataSet dsCompanyReport = new DataSet(); dsCompanyReport = objComp.ListRPTCompany(); if (dsCompanyReport.Tables[0].Rows.Count > 0) { dsCompanyReport.WriteXml("Company.xml"); PRCompanyRPT CompanyRPT = new PRCompanyRPT(); CompanyRPT.SetDataSource(dsCompanyReport); CompanyRPT.SetParameterValue("CompanyName", objComp.getCompanyName()); CompanyRPT.SetParameterValue("Estate", "Estate :" + objEstate.ListEstates().Rows[0][0].ToString()); ReportViewerForm objReportViewer = new ReportViewerForm(); objReportViewer.cryRPTViewer.ReportSource = CompanyRPT; objReportViewer.Show(); } else { MessageBox.Show("No data Preview"); } }
private void butExport_Click(object sender, EventArgs e) { double exchangeRate; Currency pivotCurrency = ServicesProvider.GetInstance().GetCurrencyServices().GetPivot(); exchangeRate = 1; Currency indexCurrency = pivotCurrency; if (_CurrencyId > 0) { indexCurrency = ServicesProvider.GetInstance().GetCurrencyServices().GetCurrency(_CurrencyId); if (!pivotCurrency.Equals(indexCurrency)) exchangeRate = ServicesProvider.GetInstance().GetExchangeRateServices().GetMostRecentlyRate(TimeProvider.Today,indexCurrency); } if (exchangeRate == 0) MessageBox.Show(@"Please enter an exchange rate", @"Information", MessageBoxButtons.OK, MessageBoxIcon.Information); else { ReportService rs = ReportService.GetInstance(); Report report = rs.GetReportByName("Accounting_Balances.zip"); if (!report.IsLoaded) return; report.AddParam("PIVOT_CURRENCY", pivotCurrency.Code); report.AddParam("INDEX_CURRENCY", indexCurrency.Code); report.AddParam("currencyId", _CurrencyId); rs.LoadReport(report); ReportViewerForm frmViewer = new ReportViewerForm(report); frmViewer.Show(); } }
public static void ScanReports(UIHierarchy solExplorer, bool LookForUnusedDatasets) { string sCurrentFile = string.Empty; try { //UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer; UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0)); SolutionClass solution = hierItem.Object as SolutionClass; List <string> lstRdls = new List <string>(); if (hierItem.Object is Project) { Project p = (Project)hierItem.Object; lstRdls.AddRange(GetRdlFilesInProjectItems(p.ProjectItems, true)); } else if (hierItem.Object is ProjectItem) { ProjectItem pi = hierItem.Object as ProjectItem; Project p = pi.SubProject; lstRdls.AddRange(GetRdlFilesInProjectItems(p.ProjectItems, true)); } else if (solution != null) { foreach (Project p in solution.Projects) { lstRdls.AddRange(GetRdlFilesInProjectItems(p.ProjectItems, true)); } } List <UsedRsDataSets.RsDataSetUsage> lstDataSets = new List <UsedRsDataSets.RsDataSetUsage>(); foreach (string file in lstRdls) { sCurrentFile = file; UsedRsDataSets urds = new UsedRsDataSets(file); foreach (UsedRsDataSets.RsDataSet ds in urds.DataSets) { if (LookForUnusedDatasets && ds.Usages.Count == 0) { UsedRsDataSets.RsDataSetUsage u = new UsedRsDataSets.RsDataSetUsage(); u.ReportName = ds.ReportName; u.DataSetName = ds.DataSetName; lstDataSets.Add(u); } else if (!LookForUnusedDatasets && ds.Usages.Count > 0) { foreach (string usage in ds.Usages) { UsedRsDataSets.RsDataSetUsage u = new UsedRsDataSets.RsDataSetUsage(); u.ReportName = ds.ReportName; u.DataSetName = ds.DataSetName; u.Usage = usage; lstDataSets.Add(u); } } } } if (lstDataSets.Count == 0) { if (LookForUnusedDatasets) { MessageBox.Show("All datasets are in use.", "BIDS Helper Unused Datasets Report"); } else { MessageBox.Show("No datasets found.", "BIDS Helper Used Datasets Report"); } } else { ReportViewerForm frm = new ReportViewerForm(); frm.ReportBindingSource.DataSource = lstDataSets; if (LookForUnusedDatasets) { frm.Report = "SSRS.UnusedDatasets.rdlc"; frm.Caption = "Unused Datasets Report"; } else { frm.Report = "SSRS.UsedDatasets.rdlc"; frm.Caption = "Used Datasets Report"; } Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource1.Name = "BIDSHelper_SSRS_RsDataSetUsage"; reportDataSource1.Value = frm.ReportBindingSource; frm.ReportViewerControl.LocalReport.DataSources.Add(reportDataSource1); frm.WindowState = System.Windows.Forms.FormWindowState.Maximized; frm.Show(); } } catch (System.Exception ex) { string sError = string.Empty; if (!string.IsNullOrEmpty(sCurrentFile)) { sError += "Error while scanning report: " + sCurrentFile + "\r\n"; } while (ex != null) { sError += ex.Message + "\r\n" + ex.StackTrace + "\r\n\r\n"; ex = ex.InnerException; } MessageBox.Show(sError); } }
private void activeLoansToolStripMenuItem_Click(object sender, EventArgs e) { try { var reportName = (sender as ToolStripMenuItem).Tag.ToString(); var report = ReportService.GetInstance().GetReportByName(reportName); var reportParamsForm = new ReportParamsForm(report.Params, report.Title); if (reportParamsForm.ShowDialog() != DialogResult.OK) return; var progressForm = new ReportLoadingProgressForm(); progressForm.Show(); var bw = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true, }; bw.DoWork += (obj, args) => { ReportService.GetInstance().LoadReport(report); bw.ReportProgress(100); }; bw.RunWorkerCompleted += (obj, args) => { progressForm.Close(); if (args.Error != null) { Fail(args.Error.Message); return; } if (args.Cancelled) return; report.OpenCount++; report.SaveOpenCount(); var reportViewer = new ReportViewerForm(report); reportViewer.Show(); }; bw.RunWorkerAsync(report); } catch (Exception ex) { Fail(ex.Message); } }
public override void Exec() { try { UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer; UIHierarchyItem hierItem = (UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0); ProjectItem projItem = (ProjectItem)hierItem.Object; DsvColumnResult results = null; string sFileName = ((ProjectItem)hierItem.Object).Name.ToLower(); if (sFileName.EndsWith(".bim")) { Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox = TabularHelpers.GetTabularSandboxFromBimFile(this, true); #if DENALI || SQL2014 DataSourceViewCollection dsvs = sandbox.Database.DataSourceViews; foreach (DataSourceView o in dsvs) { results = DsvHelpers.IterateDsvColumns(o); } #else if (sandbox.IsTabularMetadata) { Microsoft.AnalysisServices.BackEnd.EditMappingUtility util = new Microsoft.AnalysisServices.BackEnd.EditMappingUtility(sandbox); results = new DsvColumnResult(null); foreach (Microsoft.AnalysisServices.BackEnd.DataModelingTable table in sandbox.Tables) { if (table.IsCalculated || table.IsPushedData) { continue; } if (table.IsStructuredDataSource) { MessageBox.Show("BI Developer Extensions does not yet support modern (Power Query) data sources.", "BI Developer Extensions"); return; } foreach (Microsoft.AnalysisServices.BackEnd.DataModelingColumn col in table.Columns) { if (col.IsRowNumber || col.IsCalculated) { continue; } results.UsedColumns.Add(new UnusedColumnsPlugin.UsedColumn(col)); } } } else //AMO Tabular { DataSourceViewCollection dsvs = sandbox.AMOServer.Databases[sandbox.DatabaseID].DataSourceViews; foreach (DataSourceView o in dsvs) { results = DsvHelpers.IterateDsvColumns(o); } } #endif } else { DataSourceView dsv = (DataSourceView)projItem.Object; results = DsvHelpers.IterateDsvColumns(dsv); } ReportViewerForm frm = new ReportViewerForm(); frm.ReportBindingSource.DataSource = results.UsedColumns; frm.Report = "SSAS.UsedColumns.rdlc"; Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource1.Name = "BIDSHelper_UsedColumn"; reportDataSource1.Value = frm.ReportBindingSource; frm.ReportViewerControl.LocalReport.DataSources.Add(reportDataSource1); frm.ReportViewerControl.LocalReport.ReportEmbeddedResource = "SSAS.UsedColumns.rdlc"; frm.Caption = "Used Columns Report"; frm.WindowState = FormWindowState.Maximized; frm.Show(); } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Determines if the command should be displayed or not. /// </summary> /// <param name="item"></param> /// <returns></returns> //public override bool DisplayCommand(UIHierarchyItem item) //{ // try // { // UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer; // if (((System.Array)solExplorer.SelectedItems).Length != 1) // return false; // UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0)); // string sFileName = ((ProjectItem)hierItem.Object).Name.ToLower(); // if (sFileName.EndsWith(".bim")) // { // return true; // } // return (((ProjectItem)hierItem.Object).Object is Cube); // } // catch // { // return false; // } //} public override void Exec() { try { UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer; UIHierarchyItem hierItem = (UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0); ProjectItem projItem = (ProjectItem)hierItem.Object; string sFileName = ((ProjectItem)hierItem.Object).Name.ToLower(); #if DENALI || SQL2014 Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox = null; #else //Microsoft.AnalysisServices.BackEnd.DataModelingSandboxAmo sandbox = null; DataModelingSandboxWrapper sandbox = null; #endif bool bIsTabular = false; Cube cub = null; if (projItem.Object is Cube) { cub = (Cube)projItem.Object; } else if (sFileName.EndsWith(".bim")) { #if DENALI || SQL2014 sandbox = TabularHelpers.GetTabularSandboxFromBimFile(this, true); cub = sandbox.Cube; bIsTabular = true; Microsoft.AnalysisServices.BackEnd.IDataModelingObjectCollection <Microsoft.AnalysisServices.BackEnd.DataModelingMeasure> measures = sandbox.Measures; #else sandbox = new DataModelingSandboxWrapper(this); //sandbox = TabularHelpers.GetTabularSandboxAmoFromBimFile(this, true); //cub = sandbox.Cube; bIsTabular = true; //Microsoft.AnalysisServices.BackEnd.IDataModelingObjectCollection<Microsoft.AnalysisServices.BackEnd.DataModelingMeasure> measures = sandbox.Cube.AllMeasures; #endif } else { //if you are launching this feature from the Dimension Usage tab, but some other item in Solution Explorer is highlighted, then this code works and the above doesn't projItem = this.ApplicationObject.ActiveWindow.ProjectItem; cub = (Cube)projItem.Object; } DialogResult res = MessageBox.Show("Would you like a detailed report?\r\n\r\nPress Yes to see a detailed dimension usage report.\r\n\r\nPress No to see a summary level Bus Matrix dimension usage report.", "BIDS Helper - Printer Friendly Dimension Usage - Which Report Type?", MessageBoxButtons.YesNo); ReportViewerForm frm = new ReportViewerForm(); if (bIsTabular) { bool bIsBusMatrix = (res == DialogResult.No); System.Collections.Generic.List <DimensionUsage> list = PrinterFriendlyDimensionUsage.GetTabularDimensionUsage(sandbox, bIsBusMatrix); DeploymentSettings _deploymentSettings = new DeploymentSettings(projItem); //reset the database and cube name per the deployment settings foreach (DimensionUsage du in list) { du.DatabaseName = _deploymentSettings.TargetDatabase; du.CubeName = _deploymentSettings.TargetCubeName; } frm.ReportBindingSource.DataSource = list; } else { frm.ReportBindingSource.DataSource = PrinterFriendlyDimensionUsage.GetDimensionUsage(cub); } if (res == DialogResult.No) { frm.Report = "SSAS.PrinterFriendlyDimensionUsageBusMatrix.rdlc"; } else { frm.Report = "SSAS.PrinterFriendlyDimensionUsage.rdlc"; } Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource1.Name = "BIDSHelper_DimensionUsage"; reportDataSource1.Value = frm.ReportBindingSource; frm.ReportViewerControl.LocalReport.DataSources.Add(reportDataSource1); if (res == DialogResult.No) { frm.ReportViewerControl.LocalReport.ReportEmbeddedResource = "BIDSHelper.PrinterFriendlyDimensionUsageBusMatrix.rdlc"; frm.Caption = "Printer Friendly Dimension Usage Bus Matrix"; } else { frm.ReportViewerControl.LocalReport.ReportEmbeddedResource = "BIDSHelper.PrinterFriendlyDimensionUsage.rdlc"; frm.Caption = "Printer Friendly Dimension Usage"; } frm.Show(); } catch (System.Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public override void Exec() { ProjectItem piCurrent = null; try { listNonDefaultProperties = new List <NonDefaultProperty>(); UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer; UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0)); SolutionClass solution = hierItem.Object as SolutionClass; EnvDTE.Project p = GetSelectedProjectReference(); if (p != null) { Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt projExt = (Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt)p; if (projExt.Kind == BIDSProjectKinds.SSAS) { Database db = (Database)p.Object; ScanAnalysisServicesProperties(db); } else { this.DatabaseName = "Project: " + p.Name; this.SSASProject = false; try { using (WaitCursor cursor1 = new WaitCursor()) { int iProgress = 0; ApplicationObject.StatusBar.Animate(true, vsStatusAnimation.vsStatusAnimationGeneral); Microsoft.SqlServer.Dts.Runtime.Application app = SSIS.PackageHelper.Application; //sets the proper TargetServerVersion foreach (ProjectItem pi in p.ProjectItems) { ApplicationObject.StatusBar.Progress(true, "Scanning package " + pi.Name, iProgress++, p.ProjectItems.Count); string sFileName = pi.Name.ToLower(); if (!sFileName.EndsWith(".dtsx")) { continue; } piCurrent = pi; this.PackagePathPrefix = pi.Name; Package package = GetPackageFromIntegrationServicesProjectItem(pi); ScanIntegrationServicesProperties(package); } } } finally { try { ApplicationObject.StatusBar.Animate(false, vsStatusAnimation.vsStatusAnimationGeneral); ApplicationObject.StatusBar.Progress(false, "", 1, 1); } catch { } } } } else if (solution != null) { this.DatabaseName = "Solution: " + System.IO.Path.GetFileNameWithoutExtension(solution.FullName); try { this.DatabaseName = "Solution: " + solution.Properties.Item("Name").Value; } catch { } this.SSASProject = false; try { using (WaitCursor cursor1 = new WaitCursor()) { ApplicationObject.StatusBar.Animate(true, vsStatusAnimation.vsStatusAnimationGeneral); foreach (EnvDTE.Project proj in solution.Projects) { Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt projExt = (Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt)proj; if (projExt.Kind == BIDSProjectKinds.SSIS) { int iProgress = 0; Microsoft.SqlServer.Dts.Runtime.Application app = SSIS.PackageHelper.Application; //sets the proper TargetServerVersion; foreach (ProjectItem pi in proj.ProjectItems) { ApplicationObject.StatusBar.Progress(true, "Scanning project " + proj.Name + " package " + pi.Name, iProgress++, proj.ProjectItems.Count); string sFileName = pi.Name.ToLower(); if (!sFileName.EndsWith(".dtsx")) { continue; } piCurrent = pi; this.PackagePathPrefix = proj.Name + "\\" + pi.Name; Package package = GetPackageFromIntegrationServicesProjectItem(pi); ScanIntegrationServicesProperties(package); } } } } } finally { try { ApplicationObject.StatusBar.Animate(false, vsStatusAnimation.vsStatusAnimationGeneral); ApplicationObject.StatusBar.Progress(false, "", 1, 1); } catch { } } } else { ProjectItem pi = (ProjectItem)hierItem.Object; piCurrent = pi; Package package = GetPackageFromIntegrationServicesProjectItem(pi); this.DatabaseName = "Package: " + package.Name; this.SSASProject = false; this.PackagePathPrefix = string.Empty; ScanIntegrationServicesProperties(package); } //clear the cache this.packageDefault = null; this.dictCachedDtsObjects.Clear(); if (listNonDefaultProperties.Count == 0) { MessageBox.Show("No properties set to non-default values were found.", "BIDS Helper - Non-Default Properties Report"); return; } //pop up the form to let the user exclude properties from showing on the report List <string> listExcludedProperties = new List <string>(this.ExcludedProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)); BIDSHelper.SSAS.NonDefaultPropertiesSelectionForm selector = new BIDSHelper.SSAS.NonDefaultPropertiesSelectionForm(); foreach (NonDefaultProperty prop in listNonDefaultProperties) { if (!selector.listProperties.Items.Contains(prop.PropertyName)) { bool bChecked = !listExcludedProperties.Contains(prop.PropertyName); selector.listProperties.Items.Add(prop.PropertyName, bChecked); } } DialogResult selectorResult = selector.ShowDialog(); if (selectorResult == DialogResult.OK) { //remove the the report rows they unchecked for (int i = 0; i < listNonDefaultProperties.Count; i++) { if (!selector.listProperties.CheckedItems.Contains(listNonDefaultProperties[i].PropertyName)) { listNonDefaultProperties.RemoveAt(i--); } } //save their prefs... keep previously prefs which haven't been changes (because an excluded property may not show up in the possible properties list each time you run the report) foreach (object item in selector.listProperties.Items) { if (!selector.listProperties.CheckedItems.Contains(item)) //if excluded, then add to the excluded list { if (!listExcludedProperties.Contains(item.ToString())) { listExcludedProperties.Add(item.ToString()); } } else //if included, then remove from the excluded list { if (listExcludedProperties.Contains(item.ToString())) { listExcludedProperties.Remove(item.ToString()); } } } this.ExcludedProperties = string.Join(",", listExcludedProperties.ToArray()); ReportViewerForm frm = new ReportViewerForm(); frm.ReportBindingSource.DataSource = this.listNonDefaultProperties; frm.Report = "SSAS.NonDefaultProperties.rdlc"; Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource1.Name = "BIDSHelper_NonDefaultProperty"; reportDataSource1.Value = frm.ReportBindingSource; frm.ReportViewerControl.LocalReport.DataSources.Add(reportDataSource1); frm.ReportViewerControl.LocalReport.ReportEmbeddedResource = frm.Report; frm.Caption = "Non-Default Properties Report"; frm.WindowState = FormWindowState.Maximized; frm.Show(); } } catch (DtsRuntimeException ex) { if (ex.ErrorCode == -1073659849L) { MessageBox.Show((piCurrent == null ? "This package" : piCurrent.Name) + " has a package password. Please open the package designer, specify the password when the dialog prompts you, then rerun the Non-Default Properties report.\r\n\r\nDetailed error was:\r\n" + ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Password Not Specified"); } else { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error" + (piCurrent == null ? string.Empty : " scanning " + piCurrent.Name)); } } catch (System.Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error" + (piCurrent == null ? string.Empty : " scanning " + piCurrent.Name)); } }
protected void ScanReports(bool LookForUnusedDatasets) { string sCurrentFile = string.Empty; try { UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer; UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0)); SolutionClass solution = hierItem.Object as SolutionClass; List<string> lstRdls = new List<string>(); if (hierItem.Object is Project) { Project p = (Project)hierItem.Object; lstRdls.AddRange(GetRdlFilesInProjectItems(p.ProjectItems, true)); } else if (hierItem.Object is ProjectItem) { ProjectItem pi = hierItem.Object as ProjectItem; Project p = pi.SubProject; lstRdls.AddRange(GetRdlFilesInProjectItems(p.ProjectItems, true)); } else if (solution != null) { foreach (Project p in solution.Projects) { lstRdls.AddRange(GetRdlFilesInProjectItems(p.ProjectItems, true)); } } List<UsedRsDataSets.RsDataSetUsage> lstDataSets = new List<UsedRsDataSets.RsDataSetUsage>(); foreach (string file in lstRdls) { sCurrentFile = file; UsedRsDataSets urds = new UsedRsDataSets(file); foreach (UsedRsDataSets.RsDataSet ds in urds.DataSets) { if (LookForUnusedDatasets && ds.Usages.Count == 0) { UsedRsDataSets.RsDataSetUsage u = new UsedRsDataSets.RsDataSetUsage(); u.ReportName = ds.ReportName; u.DataSetName = ds.DataSetName; lstDataSets.Add(u); } else if (!LookForUnusedDatasets && ds.Usages.Count > 0) { foreach (string usage in ds.Usages) { UsedRsDataSets.RsDataSetUsage u = new UsedRsDataSets.RsDataSetUsage(); u.ReportName = ds.ReportName; u.DataSetName = ds.DataSetName; u.Usage = usage; lstDataSets.Add(u); } } } } if (lstDataSets.Count == 0) { if (LookForUnusedDatasets) MessageBox.Show("All datasets are in use.", "BIDS Helper Unused Datasets Report"); else MessageBox.Show("No datasets found.", "BIDS Helper Used Datasets Report"); } else { ReportViewerForm frm = new ReportViewerForm(); frm.ReportBindingSource.DataSource = lstDataSets; if (LookForUnusedDatasets) { frm.Report = "SSRS.UnusedDatasets.rdlc"; frm.Caption = "Unused Datasets Report"; } else { frm.Report = "SSRS.UsedDatasets.rdlc"; frm.Caption = "Used Datasets Report"; } Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource1.Name = "BIDSHelper_SSRS_RsDataSetUsage"; reportDataSource1.Value = frm.ReportBindingSource; frm.ReportViewerControl.LocalReport.DataSources.Add(reportDataSource1); frm.WindowState = FormWindowState.Maximized; frm.Show(); } } catch (System.Exception ex) { string sError = string.Empty; if (!string.IsNullOrEmpty(sCurrentFile)) sError += "Error while scanning report: " + sCurrentFile + "\r\n"; while (ex != null) { sError += ex.Message + "\r\n" + ex.StackTrace + "\r\n\r\n"; ex = ex.InnerException; } MessageBox.Show(sError); } }
public override void Exec() { try { UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer; UIHierarchyItem hierItem = (UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0); ProjectItem projItem = (ProjectItem)hierItem.Object; DsvColumnResult results = null; string sFileName = ((ProjectItem)hierItem.Object).Name.ToLower(); if (sFileName.EndsWith(".bim")) { Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox = TabularHelpers.GetTabularSandboxFromBimFile(this, true); #if DENALI || SQL2014 DataSourceViewCollection dsvs = sandbox.Database.DataSourceViews; foreach (DataSourceView o in dsvs) { results = DsvHelpers.IterateDsvColumns(o); } #else if (sandbox.IsTabularMetadata) { Microsoft.AnalysisServices.BackEnd.EditMappingUtility util = new Microsoft.AnalysisServices.BackEnd.EditMappingUtility(sandbox); results = new DsvColumnResult(null); TabularHelpers.EnsureDataSourceCredentials(sandbox); foreach (Microsoft.AnalysisServices.BackEnd.DataModelingTable table in sandbox.Tables) { if (table.IsCalculated || table.IsPushedData) { continue; } if (table.IsStructuredDataSource) { MessageBox.Show("BI Developer Extensions does not yet support modern (Power Query) data sources.", "BI Developer Extensions"); return; } //new 1200 models don't appear to have an equivalent of the DSV where the list of columns from the SQL query are cached, so we will have to get the columns from executing (schema only) the SQL query var conn = ((Microsoft.AnalysisServices.BackEnd.RelationalDataStorage)((util.GetDataSourceConnection(util.GetDataSourceID(table.Id), sandbox)))).DataSourceConnection; conn.Open(); System.Data.Common.DbCommand cmd = conn.CreateCommand(); cmd.CommandText = sandbox.GetSourceQueryDefinition(table.Id); cmd.CommandTimeout = 0; cmd.Prepare(); System.Data.Common.DbDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly); DataTable tbl = reader.GetSchemaTable(); for (int i = 0; i < tbl.Rows.Count; i++) { string sColumnName = Convert.ToString(tbl.Rows[i]["ColumnName"]); Type oDataType = (Type)tbl.Rows[i]["DataType"]; bool bFound = false; foreach (Microsoft.AnalysisServices.BackEnd.DataModelingColumn col in table.Columns) { if (col.IsCalculated || col.IsRowNumber) { continue; } if (sColumnName == col.DBColumnName) { bFound = true; break; } } if (!bFound) { DataTable t = new DataTable(table.Name); DataColumn c = t.Columns.Add(sColumnName, oDataType); results.UnusedColumns.Add("[" + t.TableName + "].[" + sColumnName + "]", new UnusedColumn(c, null)); } } } } else //AMO Tabular { DataSourceViewCollection dsvs = sandbox.AMOServer.Databases[sandbox.DatabaseID].DataSourceViews; foreach (DataSourceView o in dsvs) { results = DsvHelpers.IterateDsvColumns(o); } } #endif } else { DataSourceView dsv = (DataSourceView)projItem.Object; results = DsvHelpers.IterateDsvColumns(dsv); } if (results == null || results.UnusedColumns == null || results.UnusedColumns.Count == 0) { MessageBox.Show("There are no unused columns.", "BIDS Helper - Unused Columns Report"); return; } ReportViewerForm frm = new ReportViewerForm(); frm.ReportBindingSource.DataSource = results.UnusedColumns.Values; frm.Report = "SSAS.UnusedColumns.rdlc"; Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource1.Name = "BIDSHelper_UnusedColumn"; reportDataSource1.Value = frm.ReportBindingSource; frm.ReportViewerControl.LocalReport.DataSources.Add(reportDataSource1); frm.ReportViewerControl.LocalReport.ReportEmbeddedResource = "SSAS.UnusedColumns.rdlc"; frm.Caption = "Unused Columns Report"; frm.WindowState = FormWindowState.Maximized; frm.Show(); } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
public override void Exec() { ProjectItem piCurrent = null; try { listPackageProperties = new List <PackageProperties>(); UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer; UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0)); SolutionClass solution = hierItem.Object as SolutionClass; EnvDTE.Project proj = GetSelectedProjectReference(); if (proj != null) { Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt projExt = (Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt)proj; this.DatabaseName = "Project: " + proj.Name; PackageHelper.SetTargetServerVersion(proj); //sets the target version try { using (WaitCursor cursor1 = new WaitCursor()) { int iProgress = 0; ApplicationObject.StatusBar.Animate(true, vsStatusAnimation.vsStatusAnimationGeneral); foreach (ProjectItem pi in proj.ProjectItems) { ApplicationObject.StatusBar.Progress(true, "Scanning package " + pi.Name, iProgress++, proj.ProjectItems.Count); string sFileName = pi.Name.ToLower(); if (!sFileName.EndsWith(".dtsx")) { continue; } piCurrent = pi; this.PackagePathPrefix = pi.Name; PackageProperties props = GetPackageProperties(pi); if (props == null) { continue; } listPackageProperties.Add(props); } } } finally { try { ApplicationObject.StatusBar.Animate(false, vsStatusAnimation.vsStatusAnimationGeneral); ApplicationObject.StatusBar.Progress(false, "", 1, 1); } catch { } } } else if (solution != null) { this.DatabaseName = "Solution: " + System.IO.Path.GetFileNameWithoutExtension(solution.FullName); try { this.DatabaseName = "Solution: " + solution.Properties.Item("Name").Value; } catch { } try { using (WaitCursor cursor1 = new WaitCursor()) { ApplicationObject.StatusBar.Animate(true, vsStatusAnimation.vsStatusAnimationGeneral); foreach (EnvDTE.Project p in solution.Projects) { Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt projExt = (Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt)p; if (projExt.Kind == BIDSProjectKinds.SSIS) { int iProgress = 0; foreach (ProjectItem pi in p.ProjectItems) { ApplicationObject.StatusBar.Progress(true, "Scanning project " + p.Name + " package " + pi.Name, iProgress++, p.ProjectItems.Count); string sFileName = pi.Name.ToLower(); if (!sFileName.EndsWith(".dtsx")) { continue; } piCurrent = pi; this.PackagePathPrefix = p.Name + "\\" + pi.Name; PackageProperties props = GetPackageProperties(pi); if (props == null) { continue; } listPackageProperties.Add(props); } } } } } finally { try { ApplicationObject.StatusBar.Animate(false, vsStatusAnimation.vsStatusAnimationGeneral); ApplicationObject.StatusBar.Progress(false, "", 1, 1); } catch { } } } ReportViewerForm frm = new ReportViewerForm(); frm.ReportBindingSource.DataSource = this.listPackageProperties; frm.Report = "SSIS.SortablePackageProperties.rdlc"; Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource1.Name = "BIDSHelper_PackageProperties"; reportDataSource1.Value = frm.ReportBindingSource; frm.ReportViewerControl.LocalReport.DataSources.Add(reportDataSource1); frm.ReportViewerControl.LocalReport.ReportEmbeddedResource = frm.Report; frm.Caption = "Sortable Package Properties Report"; frm.WindowState = FormWindowState.Maximized; frm.Show(); } catch (DtsRuntimeException ex) { if (ex.ErrorCode == -1073659849L) { MessageBox.Show((piCurrent == null ? "This package" : piCurrent.Name) + " has a package password. Please open the package designer, specify the password when the dialog prompts you, then rerun the Sortable Package Properties report.\r\n\r\nDetailed error was:\r\n" + ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Password Not Specified"); } else { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error" + (piCurrent == null ? string.Empty : " scanning " + piCurrent.Name)); } } catch (System.Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error" + (piCurrent == null ? string.Empty : " scanning " + piCurrent.Name)); } }
private void PrintReport(Guid guid) { ReportService rs = ReportService.GetInstance(); Report report = rs.GetReport(guid); if (null == report) { return; } try { ReportInitializer(report); if (report.DisableIfLoanIsPending) { var loan = (Loan)report.GetExtra("loan"); if (loan == null || loan.ContractStatus == OContractStatus.None || loan.ContractStatus == OContractStatus.Pending) { MessageBox.Show( MultiLanguageStrings.GetString(Ressource.PrintButton, "pleaseApproveLoan"), MultiLanguageStrings.GetString(Ressource.PrintButton, "warning"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } List <ReportParamV2> additionalParams = report.Params .Where(p => p.Additional && p.Visible) .ToList(); if (additionalParams.Count != 0) { ReportParamsForm reportParamsForm = new ReportParamsForm(additionalParams, report.Title); if (reportParamsForm.ShowDialog() != DialogResult.OK) { return; } } try { StartProgress(); rs.LoadReport(report); } finally { StopProgress(); } } catch (Exception exception) { new frmShowError( CustomExceptionHandler.ShowExceptionText(exception) ).ShowDialog(); throw; } ReportViewerForm frm = new ReportViewerForm(report); frm.Show(); }