public void getPatientByID(int id)
        {
             MySqlDataReader rdr = null;

                string stm = @"SELECT 
                                `ID`, 
                                `FirstName`, 
                                `LastName`, 
                                `Date`, 
                                `CheckInOneTime`, 
                                `CheckInTwoTime`, 
                                `CheckInThreeTime`, 
                                `CheckInFourTime` 
                            FROM 
                            (
                                SELECT
                                    `p`.`ID`, 
                                    `p`.`FirstName`, 
                                    `p`.`LastName`, 
                                    `s`.`Date`, 
                                    `s`.`CheckInOneTime`, 
                                    `s`.`CheckInTwoTime`, 
                                    `s`.`CheckInThreeTime`, 
                                    `s`.`CheckInFourTime` 
                                FROM
                                    `patients` p, 
                                    `sessions` s 
                                WHERE 
                                    `p`.`ID` = @ID 
                                AND 
                                    `p`.`ID` = `s`.`patientID` 
                                ORDER BY 
                                    `s`.`Date` DESC
                            ) s
                            LIMIT 1";

            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection = this.conn;
                cmd.CommandText = stm;
                cmd.Prepare();

                cmd.Parameters.AddWithValue("@ID", id);
                rdr = cmd.ExecuteReader();

                Patient p = null;

                if (rdr.Read())
                {
                    p = new Patient(rdr.GetInt32(0), rdr.GetString(1), rdr.GetString(2));
                }

                // Close the reader
                rdr.Close();

                if(p != null)
                {
                    p.LastSession = this.getLastSession(id);                

                    this.currentPatient = p;
                    this.savingPatient = p;
                }
            }
            catch (MySqlException ex)
            {
                Console.WriteLine("Error: {0}", ex.ToString());
                rdr.Close();
                //return null;
            }
        }
        public bool UpdatePatient()
        {
            try
            {
                MySqlDataReader rdr = null;

                string stm = @"INSERT INTO
                                    `sessions` s 
                                (
                                    `patientID`,
                                    `CheckInOneTime`,
                                    `CheckInTwoTime`,
                                    `CheckInThreeTime`,
                                    `CheckInFourTime`
                                )
                                VALUES
                                (
                                    @pid,
                                    @checkinone,
                                    @checkintwo,
                                    @checkinthree,
                                    @checkinfour
                                )";

                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection = this.conn;
                cmd.CommandText = stm;
                cmd.Prepare();

                cmd.Parameters.AddWithValue("@pid", savingPatient.ID);
                cmd.Parameters.AddWithValue("@checkinone", savingPatient.LastSession.Time1);
                cmd.Parameters.AddWithValue("@checkintwo", savingPatient.LastSession.Time2);
                cmd.Parameters.AddWithValue("@checkinthree", savingPatient.LastSession.Time3);
                cmd.Parameters.AddWithValue("@checkinfour", savingPatient.LastSession.Time4);
                rdr = cmd.ExecuteReader();

                // Make the system load the newest test
                this.currentPatient = this.savingPatient;

                // Close the reader
                rdr.Close();

                //rdr.Read();
                //cmd.LastInsertedId;

                return true;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }