Exemple #1
0
 private void btnSend_Click(object sender, EventArgs e)
 {
     if (message.richTextBox.Text != "")
     {
         Comment comment = new Comment();
         comment.text = message.richTextBox.Rtf;
         comment.node = node.id;
         comment.author = Global.loggedUser.id;
         comment.InsertWithCurrentTime();
         message.richTextBox.Text = "";
         SetNode(node);
     }
     else
     {
         MessageBox.Show("Сообщение не может быть пустым");
     }
 }
Exemple #2
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtName.Text == "")
                    throw new Exception("Название не задано");

                Node node = new Node();
                node.name = txtName.Text;
                node.type = ENodeType.TASK;
                node.parent = owner.id;
                node.responsible = ((User)cmbResponsible.SelectedItem).id;
                Object checker = cmbChecker.SelectedItem;
                if (checker.GetType() == typeof(User))
                {
                    node.checkertype = ECheckerType.PERSON;
                    node.checker = ((User)checker).id;
                }
                else
                {
                    node.checkertype = (ECheckerType)(TextObject<ECheckerType>)checker;
                }

                node.InsertWithCurrentTime();

                if (rtfEditor.richTextBox.Text != "")
                {
                    Comment comment = new Comment();
                    comment.text = rtfEditor.richTextBox.Rtf;
                    comment.node = node.id;
                    comment.author = Global.loggedUser.id;
                    comment.InsertWithCurrentTime();
                }

                node.interest = true;
                owner.AddNode(node);

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception error)
            {
                Utils.ErrorMessage(error.Message);
            }
        }