Example #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            physicianPatientReport rpt = new physicianPatientReport();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void PhysicianPatientForm_Load(object sender, EventArgs e)
        {
            //Declare a report object for the use at runtime
            physicianPatientReport aPhysicianPatientReport;

            //Intantiate the report
            aPhysicianPatientReport = new physicianPatientReport();

            try
            {
                //Instatiate the dataset and table adapters
                physicianPatientDataSet = new MVCHDataDataSet();
                admissionsTableAdapter  = new MVCHDataDataSetTableAdapters.admissionsTableAdapter();
                bedTableAdapter         = new MVCHDataDataSetTableAdapters.bedTableAdapter();
                physicianTableAdapter   = new MVCHDataDataSetTableAdapters.physicianTableAdapter();
                patientTableAdapter     = new MVCHDataDataSetTableAdapters.patientTableAdapter();

                //Fill the dataset using a via these 4 table adapters
                //Fill with admission
                admissionsTableAdapter.Fill(physicianPatientDataSet.admissions);
                //Fill with bed
                bedTableAdapter.Fill(physicianPatientDataSet.bed);
                //Fill with physician
                physicianTableAdapter.Fill(physicianPatientDataSet.physician);
                //Fill with patient
                patientTableAdapter.Fill(physicianPatientDataSet.patient);

                //set up the report viewer object on the form to show the runtime report obect
                aPhysicianPatientReport.SetDataSource(physicianPatientDataSet);
                rptCrystalViewerPhysicianPatient.ReportSource = aPhysicianPatientReport;
            }
            catch (Exception dataException)
            {
                //catch any exception thrown during data object instantiation or report generation
                MessageBox.Show("Data Error Encountered: " + dataException.Message);
            }
        }