Ejemplo n.º 1
0
        private void SearchExamRecord()
        {
            string query = ConstructSearchQuery();

            MainViewModel.OpenDbConnection(true);

            try
            {
                SQLiteDataAdapter adapt = new SQLiteDataAdapter(query, DatabaseInfo.SqliteCon);
                DataTable         table = new DataTable();
                adapt.Fill(table);
                ObservableCollection <Patient> patients = new ObservableCollection <Patient>();

                foreach (DataRow row in table.Rows)
                {
                    string accNumber = ((long)row[accountNumberCol]).ToString();
                    string fName     = (string)row[firstNameCol];
                    string lName     = (string)row[lastNameCol];
                    string examDate  = (string)row[examDateCol];

                    Patient pt = new Patient(accNumber, fName, lName, examDate, false);
                    patients.Add(pt);
                }

                PatientRecords = patients;
                DatabaseInfo.CloseDbConnection();
            }
            catch (Exception)
            {
                DatabaseInfo.CloseDbConnection();
                throw;
            }
        }
Ejemplo n.º 2
0
 public static void CloseDbConnection()
 {
     DatabaseInfo.CloseDbConnection();
 }