コード例 #1
0
        public JsonResult GetAllessages_Reply(string id)
        {
            Messages result = MessagesService.instance().Single(new Guid(id));

            result.ReplyItems.Each(m =>
            {
                if (m.IsChild)
                {
                    m.ChildItem = Messages_ReplyService.instance().GetChild(m.ID);
                }
            });
            return(Json(result.ReplyItems, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public JsonResult Delete(string id)
        {
            Messages_Reply m = Messages_ReplyService.instance().Single(new Guid(id));
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("DR", !m.DR);
            if (Messages_ReplyService.instance().ModifColumn(dic, id))
            {
                return(Json(new { status = 1, id = m.ID, dr = !m.DR }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { status = 0 }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #3
0
        /// <summary>
        /// 发表留言
        /// </summary>
        /// <param name="mes">post留言模板</param>
        public HttpResponseMessage Post([FromBody] _post_Message mes)
        {
            Hashtable hash = new Hashtable();

            try
            {
                //StringBuilder str = new StringBuilder();
                //str.Append("姓名:" + mes.Name + "<br/>");
                //str.Append("邮箱:" + mes.Mail + "<br/>");
                //str.Append("电话:" + mes.Phone + "<br/>");
                //str.Append("留言:" + mes.Content);
                //SendMail sendmail = new SendMail(Company.Email, Company.Email, Company.EmailPass, str.ToString(), mes.Title);
                //sendmail.Send();

                if (string.IsNullOrEmpty(mes.MessageID))
                {
                    //添加到数据库
                    Messages message = new Messages();
                    message.CompanyID  = Company.ID;
                    message.Type       = 0;
                    message.RelationID = Guid.Empty;
                    message.UserID     = Guid.Empty;
                    message.Content    = Util.Utils.UrlDecode(mes.Content);
                    message.Count      = 0;
                    message.Name       = mes.Name;
                    message.Phone      = mes.Phone;
                    message.Email      = mes.Mail;
                    MessagesService.instance().Insert(message);
                }
                else
                {
                    Messages_Reply reply = new Messages_Reply();
                    reply.Content   = Util.Utils.UrlDecode(mes.Content);
                    reply.UserID    = Guid.Empty;
                    reply.MessageID = new Guid(mes.MessageID);
                    reply.ParentID  = new Guid(mes.PID);
                    Messages_ReplyService.instance().Insert(reply);
                }
            }
            catch (Exception ex)
            {
                hash["error"]   = 1;
                hash["message"] = ex.ToString();
            }
            hash["error"]   = 0;
            hash["message"] = "success";
            return(Util.Utils.ConvertToJson(hash));
        }
コード例 #4
0
        public JsonResult MessagesDetail(FormCollection form)
        {
            ResultBase_form result = new ResultBase_form();
            Messages_Reply  m      = new Messages_Reply();

            TryUpdateModel <Messages_Reply>(m, form);
            m.Content = Server.UrlDecode(m.Content);
            if (m.ID == Guid.Empty)
            {
                result.status = Messages_ReplyService.instance().Insert(m);
            }
            else
            {
                result.status = Messages_ReplyService.instance().Update(m);
            }
            result.msg       = result.status == 0 ? "操作失败" : "操作成功";
            result.ResultURL = "/Class/Index";
            return(Json(result, JsonRequestBehavior.AllowGet));
        }