Exemple #1
0
        public void Initialize(string reportName, bool landscape, Margins margins)
        {
            List <Control> listRemove = new List <Control>();

            msgr  = new WindowsMessager();
            lgr   = new SQLLogger(msgr, reportName, Environment.UserName);
            cn    = new SqlConnection("SIS", "Sarah", msgr, lgr);
            panel = (Panel)this.Controls["pnlReport"];
            reportViewer.SetPageSettings(new PageSettings()
            {
                Landscape = landscape, Margins = margins
            });

            //if (panel.Controls != null)
            //{
            //    foreach (Control ctrl in panel.Controls)
            //        if (ctrl.Name != "reportViewer") listRemove.Add(ctrl);

            //    foreach (Control ctrl in listRemove)
            //        panel.Controls.Remove(ctrl);
            //}

            reportViewer.Visible = true;

            reportDataSource.Name = "DataSet1";
        }
Exemple #2
0
 public BaseReport(string reportName, bool landscape, Margins margins, Control _parent = null)
 {
     InitializeComponent();
     this.Text = reportName;
     parent    = _parent;
     msgr      = new WindowsMessager();
     lgr       = new SQLLogger(msgr, reportName, Environment.UserName);
     cn        = new SqlConnection("SIS", "Sarah", msgr, lgr);
     reportViewer.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
     reportViewer.LocalReport.DataSources.Add(reportDataSource);
     reportViewer.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     Initialize(reportName, landscape, margins);
     AddControls();
     CreateEventHandlers();
 }