public bool AddChat(Chat chat)
 {
     try
     {
         db.AddChatmessage(chat);
         return true;
     }
     catch
     {
         return false;
     }
 }
 protected void btn_SendMessage_Click(object sender, EventArgs e)
 {
     if (tbox_Bericht.Text != string.Empty)
     {
         if (lbox_Volunteers.SelectedItem != null)
         {
             Client currentuser = (Client)Session["currentUser"];
             Volunteer volun = volunteerhandler.GetVolunteer(Convert.ToInt32(lbox_Volunteers.SelectedValue));
             Chat chat = new Chat(tbox_Bericht.Text, DateTime.Now, currentuser, volun, 1);
             chats.AddChat(chat);
             tbox_Bericht.Text = "";
             RefreshMessages(currentuser, volun);
         }
     }
 }
 protected void btn_SendMessage_Click(object sender, EventArgs e)
 {
     if (tbox_Message.Text != string.Empty)
     {
         if (lbox_Clients.SelectedItem != null)
         {
             Volunteer currentuser = (Volunteer)Session["currentUser"];
             Client client = volunteerhandler.GetClient(Convert.ToInt32(lbox_Clients.SelectedValue));
             Chat chat = new Chat(tbox_Message.Text, DateTime.Now, client, currentuser, 0);
             chats.AddChat(chat);
             tbox_Message.Text = "";
             RefreshMessages(client, currentuser);
         }
     }
 }
        public bool AddChatmessage(Chat message)
        {
            try
            {
                Connect();
                cmd = new OracleCommand();
                cmd.Connection = con;
                cmd.CommandText =
                    "Insert into TCHAT(TIJDSTIP, BERICHT, HULPBEHOEVENDEID, VRIJWILLIGERID,VANHULPBEHOEVENDE) VALUES (:NewTIJDSTIP, :NewBERICHT, :NewHULPBEHOEVENDEID, :NewVRIJWILLIGERID,:NewVANHULPBEHOEVENDE)";

                cmd.Parameters.Add("NewTIJDSTIP", OracleDbType.Date).Value = DateTime.Now;
                cmd.Parameters.Add("NewBERICHT", OracleDbType.Varchar2).Value = message.Message;
                cmd.Parameters.Add("NewHULPBEHOEVENDEID", OracleDbType.Int32).Value = message.Client.ClientID;
                cmd.Parameters.Add("NewVRIJWILLIGERID", OracleDbType.Int32).Value = message.Volunteer.VolunteerID;
                cmd.Parameters.Add("NewVANHULPBEHOEVENDE", OracleDbType.Int32).Value = message.Sender;
                cmd.ExecuteNonQuery();
                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return false;
            }
            finally
            {
                Disconnect();
            }
        }
 public bool SendMessage(Chat message)
 {
     throw new NotImplementedException();
 }