private void btnReplyReceivedMessage_Click(object sender, System.EventArgs e) { string text = ""; if (string.IsNullOrEmpty(this.txtReplyTitle.Text) || this.txtReplyTitle.Text.Length > 60) { text += Formatter.FormatErrorMessage("标题不能为空,长度限制在1-60个字符内"); } if (string.IsNullOrEmpty(this.txtReplyContent.Text) || this.txtReplyContent.Text.Length > 300) { text += Formatter.FormatErrorMessage("内容不能为空,长度限制在1-300个字符内"); } if (!string.IsNullOrEmpty(text)) { this.ShowMessage(text, false); } else { if (CommentsHelper.SendMessage(new MessageBoxInfo { Sernder = HiContext.Current.User.Username, Accepter = HiContext.Current.SiteSettings.IsDistributorSettings ? Users.GetUser(HiContext.Current.SiteSettings.UserId.Value).Username : "******", Title = this.txtReplyTitle.Text.Trim(), Content = this.txtReplyContent.Text.Trim() })) { this.ShowMessage("回复成功", true); } else { this.ShowMessage("回复失败", false); } } }
void btnRefer_Click(object sender, EventArgs e) { string str = ""; if (string.IsNullOrEmpty(this.txtTitle.Text) || (this.txtTitle.Text.Length > 60)) { str = str + Formatter.FormatErrorMessage("标题不能为空,长度限制在1-60个字符内"); } if (string.IsNullOrEmpty(this.txtContent.Text) || (this.txtContent.Text.Length > 300)) { str = str + Formatter.FormatErrorMessage("内容不能为空,长度限制在1-300个字符内"); } if (!string.IsNullOrEmpty(str)) { this.ShowMessage(str, false); } else { IList <SendMessageInfo> sendMessageList = new List <SendMessageInfo>(); IList <ReceiveMessageInfo> receiveMessageList = new List <ReceiveMessageInfo>(); SendMessageInfo item = new SendMessageInfo(); ReceiveMessageInfo info2 = new ReceiveMessageInfo(); item.Addresser = info2.Addresser = HiContext.Current.User.Username; item.Addressee = info2.Addressee = "admin"; item.Title = info2.Title = this.txtTitle.Text.Replace("~", ""); item.PublishContent = info2.PublishContent = this.txtContent.Text.Replace("~", ""); sendMessageList.Add(item); receiveMessageList.Add(info2); this.txtTitle.Text = string.Empty; this.txtContent.Text = string.Empty; if (CommentsHelper.SendMessage(sendMessageList, receiveMessageList) > 0) { this.ShowMessage("发送信息成功", true); } else { this.ShowMessage("发送信息失败", true); } } }