Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");

            int    userId  = Int32.Parse(context.Request["reply.user.id"]);
            int    TopicId = Int32.Parse(context.Request["reply.topic.id"]);
            string content = context.Request["reply.content"];

            Reply reply = new Reply();

            reply.t_u_id      = userId;
            reply.t_t_id      = TopicId;
            reply.content     = content;
            reply.publishtime = DateTime.Now;

            ReplyService replyService = new ReplyService();

            bool b;

            if (replyService.Add(reply) > 0)
            {
                b = true;
            }
            else
            {
                b = false;
            }

            context.Response.Write(b);
            context.Response.End();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 增加一条Reply数据
        /// </summary>
        /// <param name="reply"></param>
        /// <param name="msg"></param>
        /// <returns>是否成功</returns>
        public static bool AddReply(Reply reply, out string msg)
        {
            ReplyService service = new ReplyService();

            try
            {
                if (service.Add(reply))
                {
                    msg = ADD_SUCCESS;
                    return(true);
                }
                else
                {
                    msg = ADD_FAIL;
                    return(false);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("\n异常信息:\n{0}", e.Message);
                msg = ADD_FAIL;
                return(false);
            }
            finally
            {
                service.CloseConnection();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 回复评价信息
        /// </summary>
        private void ReplyComment()
        {
            UserInfo user = Session["user"] as UserInfo;

            if (user == null)
            {
                Response.Write("login");
            }
            else
            {
                int    id           = CRequest.GetInt("id", 0);
                string replyContent = CRequest.GetString("replyContent");
                Reply  item         = new Reply();
                item.commentId = id;
                Comment comItem = CommentService.GetModel(id);
                if (comItem.addUser == user.id)
                {
                    Response.Write("self");
                    return;
                }
                item.replyContent = replyContent;
                item.status       = 0;
                item.remark       = "";
                item.addTime      = DateTime.Now;
                item.addUser      = user.id;
                item.infoType     = 0;

                int           num = ReplyService.Add(item);
                StringBuilder sb  = new StringBuilder();
                if (num > 0)
                {
                    DataSet ds = ReplyService.GetList("commentId = " + id);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            UserInfo replyUser = UserInfoService.GetModel(Convert.ToInt32(dr["addUser"]));
                            if (replyUser != null)
                            {
                                sb.Append(replyUser.username + ":" + dr["replyContent"].ToString() + "<br/>");
                            }
                        }
                    }
                }
                Response.Write(sb.ToString());
            }
        }
Exemplo n.º 4
0
        public async Task Register(Group group, Member member, MessageChain trigger, MessageChain reply)
        {
            _service.Add(group.Identity, member.Identity, trigger, reply);
            var builder = new MessageChainBuilder();

            builder.AddPlain("当:\n");
            foreach (var msg in trigger)
            {
                builder.Add(msg);
            }

            builder.AddPlain("\n则:\n");
            foreach (var msg in reply)
            {
                builder.Add(msg);
            }

            await group.SendAsync(builder.Build());
        }