Пример #1
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            Report3 rep = new Report3();
            test    ds  = new test();

            accountTableAdapter ct = new accountTableAdapter();

            ct.Fill(ds.account);
            rep.SetDataSource(ds);
            rep.SetParameterValue("value2", comboBox1.SelectedItem.ToString());
            crystalReportViewer1.ReportSource = rep;
        }
Пример #2
0
        public static ReportDataSet GetReportDataset(int pViewid, int pCustomerId, eViewType pViewType, int pAccountId = 0, string pDatabaseConnection = "")
        {
            /**
             * reason for this is that web portal calls does not recognize user session instance.
             * so we needed to override the connection string to accept both web portal and application level.
             */
            if (string.IsNullOrEmpty(pDatabaseConnection))
                pDatabaseConnection = UserSession.ProviderConnection;

            else {
                pDatabaseConnection = pDatabaseConnection.Replace(""", "'");
                pDatabaseConnection = pDatabaseConnection.Replace("metadata=res://*/BrightPlatform.csdl|res://*/BrightPlatform.ssdl|res://*/BrightPlatform.msl;provider=System.Data.SqlClient;provider connection string=", "");
                pDatabaseConnection = pDatabaseConnection.Replace("\"", "");
            }

            ReportDataSet adt = new ReportDataSet();

            accountTableAdapter ata = new accountTableAdapter();
            contactTableAdapter cta = new contactTableAdapter();
            customersTableAdapter _taCustomer = new customersTableAdapter();

            ata.Connection = new System.Data.SqlClient.SqlConnection(pDatabaseConnection);
            cta.Connection = new System.Data.SqlClient.SqlConnection(pDatabaseConnection);
            _taCustomer.Connection = new System.Data.SqlClient.SqlConnection(pDatabaseConnection);

            if (pViewType == eViewType.AccountsContactsWithDialogData) {
                ata.Fill(adt.account, pViewid, pAccountId);
                cta.Fill(adt.contact, pViewid, pAccountId);
            }
            else if (pViewType == eViewType.AccountsContactsWithCallAttempts) {
                ata.FillByGetReportAccountDataWithCallAttempts(adt.account, pViewid, pAccountId);
                cta.FillByGetReportContactDataWithCallAttempts(adt.contact, pViewid, pAccountId);
            }

            _taCustomer.Fill(adt.customers, pCustomerId);
            return adt;
        }