//G public static void searchPatientName(string[] name, bool main) { //create sql statement DBConnection connection = DBConnection.getDBConnectionInstance(); if (name[2].Contains('/')) { string sqlQuery = @"SELECT * FROM Patients WHERE Patient_name = @Name AND Patient_surname = @Surname AND Patient_date_of_birth = @DobOrAddress;"; DataSet patientData = connection.searchPatientByName(sqlQuery, name[0], name[1], name[2]); //checks that the query returned exactly one result int count = patientData.Tables[0].Rows.Count; if (count == 1) { individual_patient patient = new individual_patient(patientData.Tables[0].Rows[0].Field <int>("Patient_Id").ToString(), patientData); patient.Show(); } else { MessageBox.Show("No patient found."); if (main) { main_screen frm = new main_screen(); frm.Show(); } else { Patients frm = new Patients(); frm.Show(); } } } else { string query = @"SELECT * FROM Patients WHERE Patient_name = @Name AND Patient_surname = @Surname AND Patient_postcode = @DobOrAddress;"; DataSet patientDataPostcode = connection.searchPatientByName(query, name[0], name[1], name[2]); //checks that the query returned exactly one result int count = patientDataPostcode.Tables[0].Rows.Count; if (count == 1) { individual_patient patient = new individual_patient(patientDataPostcode.Tables[0].Rows[0].Field <int>("Patient_Id").ToString(), patientDataPostcode); patient.Show(); } else { MessageBox.Show("No patient found."); if (main) { main_screen frm = new main_screen(); frm.Show(); } else { Patients frm = new Patients(); frm.Show(); } } } }
//G public static void searchPatient(string id, bool main) { //creates the SQL query string query = @"SELECT * FROM Patients WHERE Patient_Id = @ID;"; DBConnection connection = DBConnection.getDBConnectionInstance(); DataSet patientData = connection.getDataById(query, id); //checks that the query returned exactly one result int count = patientData.Tables[0].Rows.Count; if (count == 1) { individual_patient patient = new individual_patient(id, patientData); patient.Show(); } else { MessageBox.Show("No patient found."); if (main) { main_screen frm = new main_screen(); frm.Show(); } else { Patients frm = new Patients(); frm.Show(); } } }
public static void searchPatient(string id) { //creates the SQL query string query = @"SELECT * FROM Patients WHERE Patient_Id = '" + id + "';"; DBConnection connection = DBConnection.getDBConnectionInstance(); DataSet patientData = connection.getDataSet(query); //checks that the query returned exactly one result int count = patientData.Tables[0].Rows.Count; if (count == 1) { individual_patient patient = new individual_patient(id, patientData); patient.Show(); } else { MessageBox.Show("No patient found."); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.individual_screen = ((WpfApp2.individual_patient)(target)); return; case 2: this.bt_patient_record = ((System.Windows.Controls.Button)(target)); #line 10 "..\..\individual patient.xaml" this.bt_patient_record.Click += new System.Windows.RoutedEventHandler(this.bt_patient_record_Click); #line default #line hidden return; case 3: this.booking = ((System.Windows.Controls.Label)(target)); return; case 4: this.dataGrid = ((System.Windows.Controls.DataGrid)(target)); return; case 5: this.tb_name = ((System.Windows.Controls.TextBlock)(target)); return; case 6: this.bt_prescriptions = ((System.Windows.Controls.Button)(target)); #line 14 "..\..\individual patient.xaml" this.bt_prescriptions.Click += new System.Windows.RoutedEventHandler(this.bt_prescriptions_Click); #line default #line hidden return; } this._contentLoaded = true; }
public static void searchPatientName(string[] name) { //create sql statement DBConnection connection = DBConnection.getDBConnectionInstance(); if (name[2].Contains('/')) { string sqlQuery = @"SELECT * FROM Patients WHERE Patient_name = '" + name[0] + "' AND Patient_surname = '" + name[1] + "' AND Patient_date_of_birth = '" + name[2] + "';"; DataSet patientData = connection.getDataSet(sqlQuery); //checks that the query returned exactly one result int count = patientData.Tables[0].Rows.Count; if (count == 1) { individual_patient patient = new individual_patient(patientData.Tables[0].Rows[0].Field <int>("Patient_Id").ToString(), patientData); patient.Show(); } else { MessageBox.Show("No patient found."); } } else { string query = @"SELECT * FROM Patients WHERE Patient_name = '" + name[0] + "' AND Patient_surname = '" + name[1] + "' AND Patient_postcode = '" + name[2] + "';"; DataSet patientDataPostcode = connection.getDataSet(query); //checks that the query returned exactly one result int count = patientDataPostcode.Tables[0].Rows.Count; if (count == 1) { individual_patient patient = new individual_patient(patientDataPostcode.Tables[0].Rows[0].Field <int>("Patient_Id").ToString(), patientDataPostcode); patient.Show(); } else { MessageBox.Show("No patient found."); } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.individual_screen = ((WpfApp2.individual_patient)(target)); return; case 2: this.bt_home = ((System.Windows.Controls.Button)(target)); #line 10 "..\..\individual patient.xaml" this.bt_home.Click += new System.Windows.RoutedEventHandler(this.bt_home_Click); #line default #line hidden return; case 3: this.bt_booking = ((System.Windows.Controls.Button)(target)); #line 11 "..\..\individual patient.xaml" this.bt_booking.Click += new System.Windows.RoutedEventHandler(this.bt_booking_Click); #line default #line hidden return; case 4: this.bt_staff = ((System.Windows.Controls.Button)(target)); #line 12 "..\..\individual patient.xaml" this.bt_staff.Click += new System.Windows.RoutedEventHandler(this.bt_staff_Click); #line default #line hidden return; case 5: this.bt_test = ((System.Windows.Controls.Button)(target)); return; case 6: this.bt_patient_record = ((System.Windows.Controls.Button)(target)); #line 14 "..\..\individual patient.xaml" this.bt_patient_record.Click += new System.Windows.RoutedEventHandler(this.bt_patient_record_Click); #line default #line hidden return; case 7: this.prescriptions_list = ((System.Windows.Controls.ListView)(target)); return; case 8: this.prescription_scroll_bar = ((System.Windows.Controls.Primitives.ScrollBar)(target)); return; case 9: this.prescriptions = ((System.Windows.Controls.Label)(target)); return; case 10: this.edit = ((System.Windows.Controls.Image)(target)); return; case 11: this.back_page = ((System.Windows.Controls.Image)(target)); return; case 12: #line 34 "..\..\individual patient.xaml" ((System.Windows.Controls.ListBoxItem)(target)).Selected += new System.Windows.RoutedEventHandler(this.ListBoxItem_Selected); #line default #line hidden return; case 13: this.booking_scroll_bar = ((System.Windows.Controls.Primitives.ScrollBar)(target)); return; case 14: this.booking = ((System.Windows.Controls.Label)(target)); return; } this._contentLoaded = true; }