Beispiel #1
0
        void btnReplyReceivedMessage_Click(object sender, EventArgs e)
        {
            string str = "";

            if (string.IsNullOrEmpty(this.txtReplyTitle.Text) || (this.txtReplyTitle.Text.Length > 60))
            {
                str = str + Formatter.FormatErrorMessage("标题不能为空,长度限制在1-60个字符内");
            }
            if (string.IsNullOrEmpty(this.txtReplyContent.Text) || (this.txtReplyContent.Text.Length > 300))
            {
                str = str + Formatter.FormatErrorMessage("内容不能为空,长度限制在1-300个字符内");
            }
            if (!string.IsNullOrEmpty(str))
            {
                this.ShowMessage(str, false);
            }
            else
            {
                SendMessageInfo reply = new SendMessageInfo();
                reply.Addresser        = HiContext.Current.User.Username;
                reply.Addressee        = CommentsHelper.GetReceiveMessage(this.receiveMessageId).Addresser;
                reply.Title            = this.txtReplyTitle.Text;
                reply.PublishContent   = this.txtReplyContent.Text;
                reply.PublishDate      = DateTime.Now;
                reply.ReceiveMessageId = new long?(this.receiveMessageId);
                if (CommentsHelper.ReplyMessage(reply))
                {
                    this.ShowMessage("回复成功", true);
                }
                else
                {
                    this.ShowMessage("回复失败", false);
                }
            }
        }