Ejemplo n.º 1
0
        private string SaveArticle(string input)
        {
            if (string.IsNullOrEmpty(input))
            {
                return(new MyHttpResult(false, "入参不符合要求").ToString());
            }

            ArticleModel artM = JsonExtensions.FromJson <ArticleModel>(input);

            MyHttpResult myRtn;

            if (artM.id == 0)
            {
                var user = (UserModel)Public.User_Info;
                artM.createby    = user.id;
                artM.create_user = user.nickname;
                artM.create_date = DateTime.Now;
                myRtn            = new MyHttpResult(artM.Insert() > 0 ? true : false, "");
            }
            else
            {
                ArticleModel artM_old = (new ArticleBLL()).GetModel(artM.id);
                artM_old.title       = artM.title;
                artM_old.art_type    = artM.art_type;
                artM_old.content     = artM.content;
                artM_old.ispublish   = artM.ispublish;
                artM_old.description = (string.IsNullOrEmpty(artM.description) ? artM_old.description : artM.description);

                myRtn = new MyHttpResult((new ArticleBLL()).Update(artM_old) > 0 ? true : false, "");
            }
            return(myRtn.ToString());
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string fileGuidList = context.Request.Form["fileids"];

            bool delSucessed = (new AttachmentsBLL()).DeleteByIDs(fileGuidList) > 0 ? true : false;

            if (delSucessed)
            {
                var result = new MyHttpResult(true, "删除成功!");
                context.Response.Write(result.ToString());
            }
            else
            {
                var result = new MyHttpResult(false, "删除文件失败,请联系管理员!");
                context.Response.Write(result.ToString());
            }
        }
Ejemplo n.º 3
0
    public void UpdateRequestCache(string key, MyHttpResult result)
    {
        if (key == null)
        {
            return;
        }

        if (CanUpdate(key))
        {
            if (requestCacheList.ContainsKey(key))
            {
                requestCacheList[key] = result;
                UpdateTimeList[key]   = ToolUtil.currentTimeMillis;
            }
            else
            {
                requestCacheList.Add(key, result);
                UpdateTimeList[key] = ToolUtil.currentTimeMillis;
            }
        }
    }