Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        private void OnReportLoaded(object sender, RunWorkerCompletedEventArgs e)
        {
            ReportWorker rw = sender as ReportWorker;

            if (rw != null && rw.Report != null)
            {
                if (null == _lastSelected)
                    _lastSelected = _SetItemSelected(rw.Report.Guid);
                else
                    SetItemUnselected(rw.Report.Guid);

                StopTimer(rw.Report.Guid.ToString());
            }

            if (e.Error != null)
            {
                FireException(e.Error);
                return;
            }
            if (e.Cancelled) return;

            Report report = e.Result as Report;
            Debug.Assert(report != null, "Report is null");

            try
            {
                report.OpenCount++;
                report.SaveOpenCount();
                UpdateOpenCount(report);
                ReportViewerForm frm = new ReportViewerForm(report);
                frm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }