PC_Spy_Reports_Form
1| /*
2| NTC C# II Programming 152-124
3| Instructor: John Heckendorf
4| Student: Keith Gallistel
5| Lab ID: <35176>
6|
7| Project Name: PC Spy Reports
8|
9|
10| Maintenance Log: | ||
11| By: | Date: | Change: |
12| Keith Gallistel | 10/27/08 | -started project |
13| | -added menu bar | |
14| | -added Crystal Reports Viewer | |
15| | -broke my USB thumb drive losing time | |
16| | (thankfully not work) | |
17| | ||
18| Keith Gallistel | 11/03/08 | -added code to menu events |
19| | -created Crystal Reports | |
20| | -tested till I got it working | |
21| */ |
22|
23|
24| using System;
25| using System.Collections.Generic;
26| using System.ComponentModel;
27| using System.Data;
28| using System.Drawing;
29| using System.Linq;
30| using System.Text;
31| using System.Windows.Forms;
32|
33| //add references
34| using DB_Interface_DLL;
35| using Open_File_Dialog;
36|
37| namespace PC_Spy_Reports
38| {
39| public partial class PC_Spy_Reports_Form : Form
40| {
41| //Declare only
42| DB_Interface_DLL.DB_Interface_DLL_Class oDB;
43|
44| const string DB_Location = "E:\\CS Prog2\\Class_6to8\\PC_Spy_System\\exe\\databases\\dbPC_Spy.mdb";
45|
46| public PC_Spy_Reports_Form()
47| {
48| InitializeComponent();
49| }
50|
51| private void byUserToolStripMenuItem_Click(object sender, EventArgs e)
52| {
53| const string sQuery = "SELECT * FROM tblUser_Information";
54|
55| //Instantiate oDBI object now
56| oDB = new DB_Interface_DLL.DB_Interface_DLL_Class();
57|
58| oDB.OpenDB(DB_Location);
59| oDB.ReQuery(sQuery);
60|
61| if (DB_Interface_DLL_Class.bDBOpenSW)
62| {
63| //Declare and Instantiate an object in the Crystal Report object
64| ByUser oCR = new ByUser();
65|
66| //Pass dataset object to the report
67| oCR.SetDataSource(DB_Interface_DLL_Class.MyDBDataSet);
68|
69| //Set the Crystal Report Viewer’s ReportSource property equal to the Crystal Report object
70| crystalReportViewer1.ReportSource = oCR;
71|
72| oDB.CloseDB();
73| }
74| }
75|
76| private void byDateTimeToolStripMenuItem_Click(object sender, EventArgs e)
77| {
78| const string sQuery = "SELECT * FROM tblUser_Information";
79|
80| //Instantiate oDBI object now
81| oDB = new DB_Interface_DLL.DB_Interface_DLL_Class();
82|
83| oDB.OpenDB(DB_Location);
84| oDB.ReQuery(sQuery);
85|
86| if (DB_Interface_DLL_Class.bDBOpenSW)
87| {
88| //Declare and Instantiate an object in the Crystal Report object
89| ByDateTime oCR = new ByDateTime();
90|
91| //Pass dataset object to the report
92| oCR.SetDataSource(DB_Interface_DLL_Class.MyDBDataSet);
93|
94| //Set the Crystal Report Viewer’s ReportSource property equal to the Crystal Report object
95| crystalReportViewer1.ReportSource = oCR;
96|
97| oDB.CloseDB();
98| }
99| }
100|
101| }
102| }