コード例 #1
0
        /// <summary>
        /// 添加/修改类型
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string EditStatuses(HttpContext context)
        {
            string type         = "Community";
            int    autoId       = int.Parse(context.Request["AutoID"]);
            string categoryName = context.Request["CategoryName"];
            string summary      = context.Request["Summary"];
            int    preId        = int.Parse(context.Request["preId"]);
            string imgSrc       = context.Request["ImgSrc"];
            string createTime   = context.Request["CreateTime"];
            int    sort         = int.Parse(context.Request["Sort"]);


            ZentCloud.BLLJIMP.Enums.ArticleCategoryType ntype = new ZentCloud.BLLJIMP.Enums.ArticleCategoryType();
            if (!Enum.TryParse(type, out ntype))
            {
                resp.Status = (int)APIErrCode.OperateFail;
                resp.Msg    = "类型错误";
                return(Common.JSONHelper.ObjectToJson(resp));
            }

            ArticleCategory cate = new ArticleCategory();

            cate.AutoID       = autoId;
            cate.CategoryType = type;
            cate.PreID        = preId;
            cate.CategoryName = categoryName;
            cate.Summary      = summary;
            cate.SysType      = 0;
            cate.ImgSrc       = imgSrc;
            cate.CreateTime   = DateTime.Parse(createTime);
            cate.Sort         = sort;
            cate.WebsiteOwner = bllArticleCategory.WebsiteOwner;
            if (bllArticleCategory.PutArticleCategory(cate))
            {
                resp.Status = 1;
                resp.Msg    = "提交成功";
            }
            else
            {
                resp.Status = -1;
                resp.Msg    = "提交失败";
            }
            return(Common.JSONHelper.ObjectToJson(resp));
        }
コード例 #2
0
ファイル: OpenHandler.ashx.cs プロジェクト: uvbs/mmp
        /// <summary>
        /// 添加/修改类型
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string addCate(HttpContext context)
        {
            int    autoId = int.Parse(context.Request["autoId"]);
            string type   = "OpenClass";
            int    preId  = int.Parse(context.Request["preId"]);
            string name   = context.Request["name"];
            int    sort   = int.Parse(context.Request["sort"]);


            ZentCloud.BLLJIMP.Enums.ArticleCategoryType ntype = new ZentCloud.BLLJIMP.Enums.ArticleCategoryType();
            if (!Enum.TryParse(type, out ntype))
            {
                resp.Status = (int)APIErrCode.OperateFail;
                resp.Msg    = "类型错误";
                return(Common.JSONHelper.ObjectToJson(resp));
            }

            ArticleCategory cate = new ArticleCategory();

            cate.AutoID       = autoId;
            cate.CategoryType = type;
            cate.PreID        = preId;
            cate.CategoryName = name;
            cate.Sort         = sort;
            cate.WebsiteOwner = bllArticleCategory.WebsiteOwner;
            if (bllArticleCategory.PutArticleCategory(cate))
            {
                resp.Status = 1;
                resp.Msg    = "提交成功";
            }
            else
            {
                resp.Status = -1;
                resp.Msg    = "提交失败";
            }
            return(Common.JSONHelper.ObjectToJson(resp));
        }