Example #1
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            App    app      = Application.Current as App;
            string deviceID = app.DivceID;
            string ID       = app.ID;
            int    i        = 0;

            foreach (Chat s in sc.GetAllChat())
            {
                i = s.ChatID;
            }
            Chat addChat = new Chat();

            if (sayBox.Text != "")
            {
                addChat.ChatID  = (i + 1);
                addChat.DID     = int.Parse(deviceID);
                addChat.UID     = int.Parse(ID);
                addChat.Comment = sayBox.Text;
                sc.InsertChatDetails(addChat.ChatID, addChat.DID, addChat.UID, addChat.Comment);
                MessageBox.Show("Thank you for your comment!");
                sayBox.Text = "";
            }
            else
            {
                MessageBox.Show("You must say something!");
            }
        }