コード例 #1
0
        private void btnReplyReceivedMessage_Click(object sender, 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, "", 1);
            }
            else
            {
                MessageBoxInfo messageBoxInfo = new MessageBoxInfo();
                messageBoxInfo.Sernder  = HiContext.Current.User.UserName;
                messageBoxInfo.Accepter = "admin";
                messageBoxInfo.Title    = this.txtReplyTitle.Text.Trim();
                string format = "\n\n时间:{0}\t发件人:{1}\n标题:{2}\n内容:{3}\n";
                string str    = string.Format(format, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), messageBoxInfo.Sernder, messageBoxInfo.Title, this.txtReplyContent.Text.Trim());
                messageBoxInfo.Content = str + this.txtReplyRecord.Value;
                if (CommentBrowser.SendMessage(messageBoxInfo))
                {
                    this.ShowMessage("回复成功", true, "", 1);
                }
                else
                {
                    this.ShowMessage("回复失败", false, "", 1);
                }
            }
        }
コード例 #2
0
        private void btnRefer_Click(object sender, EventArgs e)
        {
            string text = "";

            if (string.IsNullOrEmpty(this.txtTitle.Text) || this.txtTitle.Text.Length > 60)
            {
                text += Formatter.FormatErrorMessage("标题不能为空,长度限制在1-60个字符内");
            }
            if (string.IsNullOrEmpty(this.txtContent.Text) || this.txtContent.Text.Length > 300)
            {
                text += Formatter.FormatErrorMessage("内容不能为空,长度限制在1-300个字符内");
            }
            if (!string.IsNullOrEmpty(text))
            {
                this.ShowMessage(text, false, "", 1);
            }
            else
            {
                MessageBoxInfo messageBoxInfo = new MessageBoxInfo();
                messageBoxInfo.Sernder  = HiContext.Current.User.UserName;
                messageBoxInfo.Accepter = "admin";
                messageBoxInfo.Title    = Globals.HtmlEncode(this.txtTitle.Text.Replace("~", ""));
                string text3 = messageBoxInfo.Content = Globals.HtmlEncode(this.txtContent.Text.Replace("~", ""));
                this.txtTitle.Text   = string.Empty;
                this.txtContent.Text = string.Empty;
                if (CommentBrowser.SendMessage(messageBoxInfo))
                {
                    this.ShowMessage("发送信息成功", true, "", 1);
                }
                else
                {
                    this.ShowMessage("发送信息失败", true, "", 1);
                }
            }
        }
コード例 #3
0
        private void btnRefer_Click(object sender, System.EventArgs e)
        {
            string text = "";

            if (string.IsNullOrEmpty(this.txtTitle.Text) || this.txtTitle.Text.Length > 60)
            {
                text += Formatter.FormatErrorMessage("标题不能为空,长度限制在1-60个字符内");
            }
            if (string.IsNullOrEmpty(this.txtContent.Text) || this.txtContent.Text.Length > 300)
            {
                text += Formatter.FormatErrorMessage("内容不能为空,长度限制在1-300个字符内");
            }
            if (!string.IsNullOrEmpty(text))
            {
                this.ShowMessage(text, false);
                return;
            }
            MessageBoxInfo messageBoxInfo = new MessageBoxInfo();

            messageBoxInfo.Sernder  = HiContext.Current.User.Username;
            messageBoxInfo.Accepter = "admin";
            messageBoxInfo.Title    = Globals.HtmlEncode(this.txtTitle.Text.Replace("~", ""));
            string format  = "\n\n时间:{0}\t发件人:{1}\n标题:{2}\n内容:{3}\n";
            string content = string.Format(format, new object[]
            {
                System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"),
                messageBoxInfo.Sernder,
                messageBoxInfo.Title,
                Globals.HtmlEncode(this.txtContent.Text.Replace("~", ""))
            });

            messageBoxInfo.Content = content;
            this.txtTitle.Text     = string.Empty;
            this.txtContent.Text   = string.Empty;
            if (CommentBrowser.SendMessage(messageBoxInfo))
            {
                this.ShowMessage("发送信息成功", true);
                return;
            }
            this.ShowMessage("发送信息失败", true);
        }
コード例 #4
0
        public IHttpActionResult SendMessage(JObject request)
        {
            Logger.WriterLogger("Common.SendMessage, Params: " + request.ToString(), LoggerType.Info);

            ParamSendMessage param = new ParamSendMessage();

            try
            {
                param = request.ToObject <ParamSendMessage>();
            }
            catch
            {
                // 参数无效
                return(base.JsonFaultResult(new CommonException(40100).GetMessage(), request.ToString()));
            }

            string accessToken = param.accessToken;

            // 验证令牌
            int accessTookenCode = VerifyAccessToken(accessToken);

            if (accessTookenCode > 0)
            {
                return(base.JsonFaultResult(new CommonException(accessTookenCode).GetMessage(), request.ToString()));
            }

            // 验证参数
            //ThrowParamException(skuId);
            int    channel  = param.channel;
            int    platform = param.platform;
            string ver      = param.ver;
            string userId   = param.UserId;
            Member member   = GetMember(userId.ToSeesionId());

            if (string.IsNullOrWhiteSpace(param.Title))
            {
                StandardResult <string> result = new StandardResult <string>()
                {
                    code = 1,
                    msg  = "标题不能为空",
                    data = ""
                };

                return(base.JsonActionResult(result));
            }

            if (string.IsNullOrWhiteSpace(param.Content))
            {
                StandardResult <string> result = new StandardResult <string>()
                {
                    code = 1,
                    msg  = "内容不能为空",
                    data = ""
                };

                return(base.JsonActionResult(result));
            }

            if (member != null)
            {
                MessageBoxInfo messageBoxInfo = new MessageBoxInfo();
                messageBoxInfo.Sernder  = member.Username;
                messageBoxInfo.Accepter = "admin";
                messageBoxInfo.Title    = param.Title;

                messageBoxInfo.Content = param.Content;
                if (CommentBrowser.SendMessage(messageBoxInfo))
                {
                    StandardResult <string> result = new StandardResult <string>()
                    {
                        code = 0,
                        msg  = "成功",
                        data = ""
                    };

                    return(base.JsonActionResult(result));
                }

                else
                {
                    StandardResult <string> result = new StandardResult <string>()
                    {
                        code = 1,
                        msg  = "失败",
                        data = ""
                    };

                    return(base.JsonActionResult(result));
                }
            }


            else
            {
                return(base.JsonFaultResult(new CommonException(40201).GetMessage(), request.ToString()));
            }
        }