private void _ReportViewer_Load(object sender, EventArgs e)
        {
            if (!_isReportViewerLoaded)
            {
                Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();
                Gargai grg = new Gargai();
                grg.BeginInit();


                reportDataSource1.Name  = "CustomerReciept";
                reportDataSource1.Value = grg.Customer;
                this._reportViewer.LocalReport.DataSources.Add(reportDataSource1);
                this._reportViewer.LocalReport.ReportEmbeddedResource = "AMD.AMDReport.rdlc";

                grg.EndInit();

                GargaiTableAdapters.CustomerTableAdapter customer = new GargaiTableAdapters.CustomerTableAdapter();
                customer.ClearBeforeFill = true;
                customer.FillByCustomerID(grg.Customer, txtCustomerID.Text);

                ReportParameterCollection reportParameter = new ReportParameterCollection();
                reportParameter.Add(new ReportParameter("CustomerName", txtCustomerFullName.Text));
                if (PaymentType.SelectedIndex == 0)
                {
                    reportParameter.Add(new ReportParameter("PaymentType", "Cash"));
                }
                else if (PaymentType.SelectedIndex == 1)
                {
                    reportParameter.Add(new ReportParameter("PaymentType", "Transfer"));
                }
                else if (PaymentType.SelectedIndex == 2)
                {
                    reportParameter.Add(new ReportParameter("PaymentType", "Cash & Transfer"));
                }
                this._reportViewer.LocalReport.SetParameters(reportParameter);

                this._reportViewer.ShowBackButton             = false;
                this._reportViewer.ShowPageNavigationControls = false;
                this._reportViewer.ShowParameterPrompts       = false;
                this._reportViewer.ShowFindControls           = false;
                this._reportViewer.ShowZoomControl            = false;
                this._reportViewer.ShowFindControls           = false;
                this._reportViewer.ShowContextMenu            = false;
                this._reportViewer.ShowCredentialPrompts      = false;
                this._reportViewer.ShowDocumentMapButton      = false;
                this._reportViewer.ShowParameterPrompts       = false;

                var setUp = this._reportViewer.GetPageSettings();
                setUp.Margins = new Margins(0, 0, 0, 0);
                this._reportViewer.SetPageSettings(setUp);
                //PageSettings pageSettings = new PageSettings();
                //pageSettings.Margins = new Margins(0,0,0,0);

                _reportViewer.RefreshReport();
                _isReportViewerLoaded = true;
            }
        }
예제 #2
0
        private void SearchID_Click(object sender, RoutedEventArgs e)
        {
            Gargai grg = new Gargai();

            GargaiTableAdapters.CustomerTableAdapter customer = new GargaiTableAdapters.CustomerTableAdapter();
            customer.ClearBeforeFill = true;
            customer.FillByCustomerID(grg.Customer, txtSearchByID.Text);

            dgvCustomers.ItemsSource = grg.Customer.AsEnumerable();
        }