private void commentButton_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(commentText.Text)) { activityBLL = new ActivityBLL(); commentDTO = new CommentDTO(_cardId, Global.user.UserId, commentText.Text, DateTime.Now, 1); try { commentBLL.InsertComment(commentDTO); } catch { MessageBox.Show("Mỗi user chỉ comment 1 lần", "Waring!!!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } UserComment userComment = new UserComment(userBLL.GetUser(Global.user.UserId).Name.Substring(0, 1), commentText.Text); cmtPanel.Controls.Add(userComment); activityBLL.InsertActivity(Global.user.UserId, Global.id_Board, Global.user.Name + " Has comment to card " + cardDTO.Title, DateTime.Now); } }
public CardDetail(int id, ListSpace listSpace) { InitializeComponent(); this.StartPosition = FormStartPosition.CenterScreen; _cardId = id; _listSpace = listSpace; cardDTO = cardBLL.GetCard(_cardId); switch (cardDTO.Label) { case 1: this.cardLabel.BackColor = Color.Red; break; case 2: this.cardLabel.BackColor = Color.Yellow; break; case 3: this.cardLabel.BackColor = Color.Green; break; case 4: this.cardLabel.BackColor = Color.Orange; break; case 5: this.cardLabel.BackColor = Color.Blue; break; case 6: this.cardLabel.BackColor = Color.Fuchsia; break; default: this.cardLabel.BackColor = Color.Transparent; break; } this.CardName.Text = cardDTO.Title; this.descriptionText.Text = cardDTO.Description; this.checkDueDate.Text = cardDTO.DueDate.Date.ToString(); AddMember(); this.descriptionText.LostFocus += DescriptionText_LostFocus; this.commentText.LostFocus += CommentText_LostFocus; listDTO = listBLL.GetList(cardDTO.ListId); this.List.Text = listDTO.Title; //_boardId = listDTO.BoardId; commentDTOs = commentBLL.GetAllComments(_cardId); foreach (CommentDTO comment in commentDTOs) { UserComment userComment = new UserComment(userBLL.GetUser(comment.UserId).Name.Substring(0, 1), comment.Content); cmtPanel.Controls.Add(userComment); } activityPanel.Controls.Clear(); }