Esempio n. 1
0
        private void SetDataSource(ReportDocument Report)
        {
            ContactGroupCategory enumContactGroupCategory = (ContactGroupCategory)Enum.Parse(typeof(ContactGroupCategory), cboContactGroupCategory.SelectedValue);

            ReportDataset rptds = new ReportDataset();

            Contacts clsContact = new Contacts();

            System.Data.DataTable dt = clsContact.AdvanceSearchDataTable(enumContactGroupCategory, cboContactCode.SelectedItem.Value, cboContactName.SelectedItem.Value, Convert.ToInt16(cboDeleted.SelectedItem.Value), Convert.ToInt32(cboGroup.SelectedItem.Value), false, "ContactID", SortOption.Ascending);
            clsContact.CommitAndDispose();

            foreach (DataRow dr in dt.Rows)
            {
                DataRow drNew = rptds.Contacts.NewRow();

                foreach (DataColumn dc in rptds.Contacts.Columns)
                {
                    drNew[dc] = dr[dc.ColumnName];
                }

                rptds.Contacts.Rows.Add(drNew);
            }

            Report.SetDataSource(rptds);
            SetParameters(Report);
        }