Esempio n. 1
0
        private void PrintReport(bool isPrint, ExportFormatType exportFormat = ExportFormatType.NoFormat)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                if (gvResult.CurrentRow.Index >= 0)
                {
                    sp_RPT001_GetWorkPlaceLight_Result row = gvResult.Rows[gvResult.CurrentRow.Index].DataBoundItem as sp_RPT001_GetWorkPlaceLight_Result;
                    using (RPT001_Process rpt = new RPT001_Process(row.ID))
                    {
                        if (isPrint)
                        {
                            rpt.PrintReport();
                        }
                        else if (!isPrint && exportFormat == ExportFormatType.NoFormat)
                        {
                            rpt.PreviewDialog();
                        }
                        else if (exportFormat == ExportFormatType.Excel)
                        {
                            rpt.ExportExcelSpecial();
                        }
                        else if (!isPrint)
                        {
                            rpt.Export(exportFormat);
                        }
                        else
                        {
                            rpt.PrintReport();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                rMessageBox.ShowException(this, ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
        private void PrintReport(bool isPrint, ExportFormatType exportFormat = ExportFormatType.NoFormat)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                using (RPT001_Process rpt = new RPT001_Process(this.wplResult.ID))
                {
                    if (isPrint)
                    {
                        rpt.PrintReport();
                    }
                    else if (!isPrint && exportFormat == ExportFormatType.NoFormat)
                    {
                        rpt.PreviewDialog();
                    }
                    else if (exportFormat == ExportFormatType.Excel)
                    {
                        rpt.ExportExcelSpecial();
                    }
                    else if (!isPrint)
                    {
                        rpt.Export(exportFormat);
                    }
                    else
                    {
                        rpt.PrintReport();
                    }
                }
            }
            catch (Exception ex)
            {
                rMessageBox.ShowException(this, ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }