protected void btn_makeappointment_Click(object sender, EventArgs e)
        {
            if (lbox_getquestion.SelectedItem != null)
            {
                Question question = (Question)Session["Question"];
                Client currentuser = (Client)Session["currentUser"];
                Volunteer volun = volunteerhandler.GetVolunteer(Convert.ToInt32(lbox_getquestion.SelectedItem.Value));
                if (tb_location.Text != "")
                {
                    DateTime testdate = CalenderTest.SelectedDate;
                    Meeting meeting = new Meeting(currentuser, volun, testdate, tb_location.Text);
                    meetinghandler.addmeeting(meeting);
                    tb_location.Text = "";
                    locationdiv.Visible = false;
                    lbox_getquestion.ClearSelection();
                    errormsgmeeting.ForeColor = System.Drawing.Color.Green;
                    errormsgmeeting.Text = "Afspraak aangemaakt";
                    errormsgmeeting.Visible = true;
                }
                else
                {
                    errormsgmeeting.ForeColor = System.Drawing.Color.Red;
                    errormsgmeeting.Text = "Geen geldige locatie ingevuld";
                    errormsgmeeting.Visible = true;
                }

            }
        }
        public void addmeeting(Meeting meeting)
        {
            try
            {
                dbm.AddMeeting(meeting);
            }
            catch
            {

            }
        }
        public bool AddAppointment(Meeting meeting)
        {
            try
            {
                Connect();
                cmd = new OracleCommand();
                cmd.Connection = con;
                cmd.CommandText =
                    "Insert into TAFSPRAAK(CLIENT, VOLUNTEER, DATUMTIJD, LOCATIE) VALUES (:NewCLIENT, :NewVOLUNTEER, :NewDATUMTIJD, :NewLOCATIE)";

                cmd.Parameters.Add("NewCLIENT", OracleDbType.Int32).Value = meeting.Client.UserID;
                cmd.Parameters.Add("NewVOLUNTEER", OracleDbType.Int32).Value = meeting.Volunteer.UserID;
                cmd.Parameters.Add("NewDATUMTIJD", OracleDbType.Varchar2).Value = meeting.Date;
                cmd.Parameters.Add("NewLOCATIE", OracleDbType.Varchar2).Value = meeting.Location;

                cmd.ExecuteNonQuery();
                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return false;
            }
            finally
            {
                Disconnect();
            }
        }
        public bool AddMeeting(Meeting meeting)
        {
            try
            {
                Connect();
                cmd = new OracleCommand();
                cmd.Connection = con;
                cmd.CommandText =
                    "Insert into TAFSPRAAK(hulpbehoevendeid, vrijwilligerid, datum, locatie) VALUES (:Newhulpbehoevendeid, :Newvrijwilligerid, :Newdatum, :Newlocatie)";

                cmd.Parameters.Add("Newhulpbehoevendeid", OracleDbType.Int32).Value = meeting.Client.ClientID;
                cmd.Parameters.Add("Newvrijwilligerid", OracleDbType.Int32).Value = meeting.Volunteer.VolunteerID;
                cmd.Parameters.Add("Newdatum", OracleDbType.Date).Value = meeting.Date;
                cmd.Parameters.Add("Newlocatie", OracleDbType.Varchar2).Value = meeting.Location;

                cmd.ExecuteNonQuery();
                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return false;
            }
            finally
            {
                Disconnect();
            }
        }
        /// <summary>
        /// Gets the meetings of the given user.
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public List<Meeting> GetMeetings(User user)
        {
            try
            {
                List<Meeting> meetings = new List<Meeting>();
                Connect();
                if (user is Client)
                {
                    Client actualuser = user as Client;
                    using (cmd = new OracleCommand())
                    {
                        cmd.Connection = con;
                        cmd.CommandType = CommandType.Text;
                        cmd.CommandText = "select * from tafspraak a left join tvrijwilliger v on a.VRIJWILLIGERID = v.ID left join tgebruiker g on v.GEBRUIKERID = g.id left join taccount acc on g.ACCOUNTID = acc.ID where hulpbehoevendeid = :clientid";
                        cmd.Parameters.Add("clientid", actualuser.ClientID);
                        dr = cmd.ExecuteReader();
                        while (dr.Read())
                        {
                            var meetingid = SafeReadInt(dr, 0);
                            var clientid = SafeReadInt(dr, 1);
                            var volunteerid = SafeReadInt(dr, 2);
                            var date = SafeReadDateTime(dr, 3);
                            var location = SafeReadString(dr, 4);
                            var trash = SafeReadInt(dr, 5);
                            var dateofbirth = SafeReadDateTime(dr, 6);
                            var profilephoto = SafeReadString(dr, 7);
                            var vogpath = SafeReadString(dr, 8);
                            var userid = SafeReadInt(dr, 9);
                            var trash2 = SafeReadInt(dr, 10);
                            var givenname = SafeReadString(dr, 11);
                            var address = SafeReadString(dr, 12);
                            var city = SafeReadString(dr, 13);
                            var phonenumber = SafeReadString(dr, 14);
                            var haslicense = SafeReadString(dr, 15);
                            var hascar = SafeReadString(dr, 16);
                            var unsubscribedate = SafeReadDateTime(dr, 17);
                            var accountid = SafeReadInt(dr, 18);
                            var thrash3 = SafeReadInt(dr, 19);
                            var username = SafeReadString(dr, 20);
                            var password = SafeReadString(dr, 21);
                            var email = SafeReadString(dr, 22);

                            Volunteer helper = new Volunteer(accountid, username, password, email, userid, givenname, address, city, phonenumber, haslicense, hascar, unsubscribedate, volunteerid, dateofbirth, profilephoto, vogpath);
                            Meeting toadd = new Meeting(meetingid, actualuser, helper, date , location);
                            meetings.Add(toadd);
                        }
                        return meetings;
                    }
                }
                else
                {
                    Volunteer actualuser = user as Volunteer;
                    using (cmd = new OracleCommand())
                    {
                        cmd.Connection = con;
                        cmd.CommandType = CommandType.Text;
                        cmd.CommandText = "select * from tafspraak a left join thulpbehoevende h on a.HULPBEHOEVENDEID = h.ID left join tgebruiker g on h.GEBRUIKERID = g.id left join taccount acc on g.ACCOUNTID = acc.ID where a.hulpbehoevendeid = :volunteerid";
                        cmd.Parameters.Add("volunteerid", actualuser.VolunteerID);
                        dr = cmd.ExecuteReader();
                        while (dr.Read())
                        {
                            var meetingid = SafeReadInt(dr, 0);
                            var clientid = SafeReadInt(dr, 1);
                            var volunteerid = SafeReadInt(dr, 2);
                            var date = SafeReadDateTime(dr, 3);
                            var location = SafeReadString(dr, 4);
                            var trash = SafeReadInt(dr, 5);
                            var ovpossible = SafeReadString(dr, 6);
                            var userid = SafeReadInt(dr, 7);
                            var trash2 = SafeReadInt(dr, 8);
                            var givenname = SafeReadString(dr, 9);
                            var address = SafeReadString(dr, 10);
                            var city = SafeReadString(dr, 11);
                            var phonenumber = SafeReadString(dr, 12);
                            var haslicense = SafeReadString(dr, 13);
                            var hascar = SafeReadString(dr, 14);
                            var unsubscribedate = SafeReadDateTime(dr, 15);
                            var accountid = SafeReadInt(dr, 16);
                            var thrash3 = SafeReadInt(dr, 17);
                            var username = SafeReadString(dr, 18);
                            var password = SafeReadString(dr, 19);
                            var email = SafeReadString(dr, 20);

                            Client helper = new Client(accountid, username, password, email, userid, givenname, address, city, phonenumber, haslicense, hascar, clientid, ovpossible, unsubscribedate);
                            Meeting toadd = new Meeting(meetingid, helper, actualuser, date, location);
                            meetings.Add(toadd);
                        }
                        return meetings;
                    }
                }

            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                return null;
            }
            finally
            {
                Disconnect();
            }
        }