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 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; }
//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; }