private void InitializeOtherStuff()
        {
            db = new SQLiteDataBase();
            dgvPatientVisit = this.patientFilesGridView;
            dgvRoom = this.roomsGridView;
            dgvSchedule = this.schedulesGridView;
            notesBox = this.notesTextBox;
            illnessBox = this.illnessTextBox;

            this.enterSWB.Enabled = true;
            this.updateSWB.Enabled = true;
            this.deleteSWB.Enabled = true;

            dgvSchedule.Columns["visitID"].ReadOnly = true;//will become editable when double clicked
            dgvSchedule.Columns["patientID"].ReadOnly = true;//do not allow changes to patientID
            dgvSchedule.Columns["doctorID"].ReadOnly = true;//do not allow changes to doctorID
            dgvSchedule.Columns["buildingID"].ReadOnly = true;//do not allow changes
            dgvSchedule.Columns["roomNumber"].ReadOnly = true;//do not allow changes
            dgvSchedule.AutoGenerateColumns = true;

            dayComboBox.MouseClick += new MouseEventHandler(dayBoxText_Click);
            dayComboBox.LostFocus += new EventHandler(dayComboBox_LostFocus);
            timeBox.MouseClick += new MouseEventHandler(timeBox_MouseClick);
            timeBox.LostFocus += new EventHandler(timeBox_LostFocus);

            dgvPatientVisit.SelectionChanged += new EventHandler(patientFilesGridViewSelectionChanged);
            dgvRoom.SelectionChanged += new EventHandler(roomGridViewSelectionChanged);
            dgvSchedule.SelectionChanged += new EventHandler(scheduleGridViewSelectionChanged);
            //counter = db.getMaxID("Schedule", "visitID") + 1; //NO Counter. Because the unique ID of schedule is date
                                                                //date will not be auto generated and is user decided
        }
        private void InitializeOtherStuff()
        {
            db = new SQLiteDataBase();
            dgvPatientVisit = this.patientFilesGridView;
            dgvPatients = this.patientsGridView;
            dgvDoctors = this.doctorsGridView;
            notesBox = this.notesTextBox;
            illnessBox = this.illnessTextBox;
            outcomeBox = this.outcomeTextBox;

            this.enterPFWB.Enabled = true;
            this.updatePFWB.Enabled = true;
            this.deletePFWB.Enabled = true;

            dgvPatientVisit.Columns["visitID"].ReadOnly = true;//will become editable when double clicked
            dgvPatientVisit.Columns["patientIDPV"].ReadOnly = true;//do not allow changes to patientID
            dgvPatientVisit.Columns["doctorIDPV"].ReadOnly = true;//do not allow changes to doctorID
            dgvPatientVisit.AutoGenerateColumns = true;

            dgvPatientVisit.CellDoubleClick += new DataGridViewCellEventHandler(patientFilesGridView_CellDoubleClick);
            dgvPatientVisit.SelectionChanged += new EventHandler(patientFilesGridViewSelectionChanged);
            dgvPatients.SelectionChanged += new EventHandler(patientGridViewSelectionChanged);
            dgvDoctors.SelectionChanged += new EventHandler(doctorGridViewSelectionChanged);
            counter = db.getMaxID("PatientVisit", "visitID") + 1; // set counter to the next id.
        }
        private void InitializeOtherStuff()
        {
            db = new SQLiteDataBase();
            dgvRoom = this.roomsGridView;
            dgvBuilding = this.buildingGridView;

            dgvRoom.Columns["roomNumber"].ReadOnly = false;
            dgvRoom.Columns["buildingIDR"].ReadOnly = true;//do not allow changes to BuildingID
            dgvRoom.Columns["available"].ReadOnly = true;
            dgvRoom.Columns["roomType"].ReadOnly = true;
            dgvRoom.AutoGenerateColumns = true;
            dgvRoom.SelectionChanged += new EventHandler(this.roomsGridViewSelectionChanged);
            dgvBuilding.SelectionChanged += new EventHandler(this.buildingsGridViewSelectionChanged);

            counter = db.getMaxID("Room", "roomNumber"); // set counter to the next id.
        }
        private void FillPatientVisitsTable()
        {
            db = new SQLiteDataBase();
            DataTable dt = new DataTable();
            try
            {
                // System.Windows.Forms.MessageBox.Show("IN get table");
                dt = db.GetDataTable("SELECT * FROM PatientVisit");
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.Message);
            }

            this.patientFilesGridView.DataSource = dt;
        }
        private void FillMedicalProfessionalTable()
        {
            db = new SQLiteDataBase();
            DataTable dt = new DataTable();
            try
            {

                dt = db.GetDataTable("SELECT * FROM MedicalProfessional");

            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.Message);
            }

            this.doctorsGridView.DataSource = dt;
        }
        private void InitializeOtherStuff()
        {
            db = new SQLiteDataBase();
            dgv = this.patientsGridView;
            this.enterPWB.Enabled = false;
            this.updatePWB.Enabled = false;
            this.deletePWB.Enabled = false;
            dgv.Columns["patientID"].ReadOnly = true;
            dgv.AutoGenerateColumns = true;
            dgv.CellDoubleClick += new DataGridViewCellEventHandler(patientsGridView_CellDoubleClick);
            dgv.SelectionChanged += new EventHandler(this.patientGridViewSelectionChanged);

            //this.patientsGridView.CellValueChanged += new DataGridViewCellEventHandler(this.patientsGridViewCellValueChanged);
            //use DataGridView1.CellValueChanged += new DataGridViewCellEventHandler(DataGridView1_CellValueChanged);
            //for updates, and maybe get rid of update button

            counter = db.getMaxID("Patient", "PatientID") + 1; // set counter to the next id.
        }
        //Refreshes the medical professionals table after applying the sort
        private void sortButton_Click(object sender, EventArgs e)
        {
            string select = " SELECT mp.DoctorID, mp.DoctorDepartment, mp.DoctorName, mp.DoctorPhone, mp.DoctorAge, mp.DoctorDateOfBirth, mp.DoctorType, mp.DoctorSalary ";
            string from = " FROM MedicalProfessional AS mp ";
            string where = " WHERE  mp.DoctorID = mp.DoctorID ";

            //where += " mp.DoctorID = s.DoctorID AND mp.DoctorID = t.DoctorID ";

            if (dateBox.Text != "MM/DD/YY")
            {
                from = from + " , Schedule AS s ";
                where = where + " AND mp.DoctorID = s.DoctorID AND " + " s.ScheduleDay = " + "'" + dateBox.Text + "'";
            }
            if (buildingBox.Text != "Building Name")
            {
                 if (dateBox.Text == "MM/DD/YY")
                     from = from + " , Schedule AS s ";

                 from = from + " , Building AS b ";
                 where = where + " AND mp.DoctorID = s.DoctorID AND " + " s.BuildingID = b.BuildingID AND " + " b.BuildingName = " + "'" + buildingBox.Text + "'";
            }
            if (courseBox.Text != "Course Name")
            {
                from = from + " , Training AS t ";
                where = where + " AND mp.DoctorID = t.DoctorID AND " + " t.TrainingCourse = " + "'" + courseBox.Text + "'";
            }
            db = new SQLiteDataBase();
            DataTable dt = new DataTable();

            try
            {

                dt = db.GetDataTable( select + from + where  );

            }
            catch (Exception fail)
            {
                System.Windows.Forms.MessageBox.Show(fail.Message);
            }

            this.medicalProfessionalsGridView.DataSource = dt;
        }
        private void InitializeOtherStuff()
        {
            db = new SQLiteDataBase();
            dgv = this.medicalProfessionalsGridView;
            this.enterMPWB.Enabled = false;
            this.updateMPWB.Enabled = false;
            this.deleteMPWB.Enabled = false;
            dgv.Columns["doctorID"].ReadOnly = true;
            dgv.AutoGenerateColumns = true;
            dgv.CellDoubleClick += new DataGridViewCellEventHandler(medicalProfessionalsGridView_CellDoubleClick);
            dgv.SelectionChanged += new EventHandler(this.medicalProfessionalsGridViewSelectionChanged);
            dateBox.MouseClick += new MouseEventHandler(dateBoxText_Click);
            dateBox.LostFocus += new EventHandler(dateBoxText_LostFocus);
            buildingBox.MouseClick += new MouseEventHandler(buildingNameBox_MouseClick);
            buildingBox.LostFocus += new EventHandler(buildingNameBox_LostFocus);
            courseBox.MouseClick += new MouseEventHandler(courseBox_MouseClick);
            courseBox.LostFocus += new EventHandler(courseBox_LostFocus);

            patientsGridView.Enabled = false;

            counter = db.getMaxID("MedicalProfessional", "DoctorID") + 1; // set counter to the next id.
        }