/// <summary>
 /// Build the message and send to the add method in the db
 /// </summary>
 /// <param name="ucRTBMessage">the message</param>
 private void AddMessageDB(UcRichTextBox ucRTBMessage)
 {
     Message = new Message();
     Message.ReplyContent  = ucRTBMessage.RichTextBox.Rtf; //.Text
     Message.Topic.TopicId = ucRTBMessage.TopicId;
     Message.Person        = _personConnected;
     Controller.AddNewTopicReply(Message);
 }
        private void AddMessageDB(UcRichTextBox ucRTBMessage)
        {
            Message = new Message();
            Message.ReplyContent  = ucRTBMessage.RichTextBox.Text;
            Message.Topic.TopicId = ucRTBMessage.TopicId;
            Message.Person        = PersonConnected;
            //message.TypeReply = ucRTBMessage.

            Controller.AddNewTopicReply(Message);
        }
        /// <summary>
        /// Build and send the message in DB
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddMessage_Click(object sender, EventArgs e)
        {
            UcRichTextBox ucRichTextBoxReply = (UcRichTextBox)sender;

            AddMessageDB(ucRichTextBoxReply);
            ucRichTextBoxReply.RichTextBox.Text = "";
            // Reload message after add
            if (MessageAdd != null)
            {
                MessageAdd(this, e);
            }
        }
        public UcRichTextBox CreateRTB(int topicId)
        {
            UcRichTextBox URTB = new UcRichTextBox();

            URTB.Dock             = DockStyle.Fill;
            URTB.ButtonClick     += new EventHandler(AddMessage_Click);
            URTB.TopicId          = topicId;
            URTB.Enabled          = false;
            URTB.RichTextBox.Text = "Veuillez vous autentifiez pour poster des messages";

            RTBList.Add(URTB);
            return(URTB);
        }
        /// <summary>
        /// Build user control RichTextBox
        /// </summary>
        /// <param name="topicId">topic id</param>
        /// <returns>object richTextBox</returns>
        public UcRichTextBox BuildRTB(int topicId)
        {
            UcRichTextBox URTB = new UcRichTextBox();

            URTB.Dock         = DockStyle.Fill;
            URTB.ButtonClick += new EventHandler(AddMessage_Click);
            URTB.TopicId      = topicId;
            if (_connection)
            {
                URTB.RichTextBox.Text = "";
                URTB.Enabled          = true;
            }

            RTBList.Add(URTB);
            return(URTB);
        }
        /// <summary>
        /// Build and send the message in DB
        /// </summary>
        /// <param name="sender">object richTextBox</param>
        /// <param name="e"></param>
        private void AddMessage_Click(object sender, EventArgs e)
        {
            UcRichTextBox ucRichTextBoxReply = (UcRichTextBox)sender;

            if (ucRichTextBoxReply.RichTextBox.Text.Trim() == Properties.Resources.EMPTY)
            {
                MessageBox.Show(Properties.Resources.EMPTYFIELDS, Properties.Resources.CAPTIONEMPTYFIELDS, MessageBoxButtons.OK);
                return;
            }
            AddMessageDB(ucRichTextBoxReply);
            ucRichTextBoxReply.RichTextBox.Text = Properties.Resources.EMPTY;
            // Reload message after add
            if (MessageAdd != null)
            {
                MessageAdd(this, new AddMessageEventArgs {
                    TopicId = ucRichTextBoxReply.TopicId
                });
            }
        }