public bool isDisabledAnonymousComment(int articleCommentLimit) { CommentLimit limit = (CommentLimit)Enum.Parse(typeof(CommentLimit), articleCommentLimit + ""); bool hasFlag = ((limit & CommentLimit.禁止匿名用户回复) != 0); return(hasFlag); }
public bool isVerifyComment(int articleCommentLimit) { CommentLimit limit = (CommentLimit)Enum.Parse(typeof(CommentLimit), articleCommentLimit + ""); bool hasFlag = ((limit & CommentLimit.需要审核) != 0); return(hasFlag); }
public bool isDisableComment(int articleCommentLimit) { CommentLimit limit = (CommentLimit)Enum.Parse(typeof(CommentLimit), articleCommentLimit + ""); //bool test = (limit & CommentLimit.禁止回复) == CommentLimit.禁止回复; bool hasFlag = ((limit & CommentLimit.禁止回复) != 0); return(hasFlag); }
public JsonResult Edit(string id, FormCollection collection) { int articleID = Convert.ToInt32(Request["objectID"]); string userID = UserInfo.UserID; ArticleViewModel m = new ArticleViewModel(); ObjectHelper.UpdateModel(m, collection); CommentLimit articleCommentLimit = 0; if (m.IsDisableComment) { articleCommentLimit |= CommentLimit.禁止回复; } if (m.IsVerifyComment) { articleCommentLimit |= CommentLimit.需要审核; } if (m.IsDisabledAnonymouComment) { articleCommentLimit |= CommentLimit.禁止匿名用户回复; } AttachmentLimit attachmentLimit = 0; if (!String.IsNullOrEmpty(Request["chkAttachmentLimit"])) { if (Request["chkAttachmentLimit"].Contains("1")) { attachmentLimit |= AttachmentLimit.禁止未登录用户下载; } if (Request["chkAttachmentLimit"].Contains("2")) { attachmentLimit |= AttachmentLimit.禁止未回复用户下载; } if (Request["chkAttachmentLimit"].Contains("3")) { attachmentLimit |= AttachmentLimit.禁止下载; } } blog_tb_article model = new blog_tb_article(); if (String.IsNullOrEmpty(id) || id == "0") //新增 { //UpdateModel(model); ObjectHelper.UpdateModel(model, collection); model.articleID = articleID; model.ADD_DATE = DateTime.Now; model.UPDATE_DATE = DateTime.Now; Blogs.Entity.blog_tb_article_content contentModel = new blog_tb_article_content(); contentModel.blogID = model.blogID; contentModel.UPDATE_DATE = DateTime.Now; ObjectHelper.UpdateModel(contentModel, collection); contentModel.articleID = articleID; model.articleCommentLimit = (int)articleCommentLimit; model.articleAttachmentLimit = (int)attachmentLimit; model.siteCategoryID = 33927842; model.blogID = Convert.ToInt32(UserInfo.BlogID); Utility.ArticleBll.Insert(model, contentModel); } else { model = Utility.ArticleBll.GetEntity(articleID + ""); ObjectHelper.UpdateModel(model, collection); model.UPDATE_DATE = DateTime.Now; Blogs.Entity.blog_tb_article_content contentModel = Utility.ArticleBll.GetArticleContent(id); contentModel.blogID = model.blogID; ObjectHelper.UpdateModel(contentModel, collection); model.articleCommentLimit = (int)articleCommentLimit; model.articleAttachmentLimit = (int)attachmentLimit; Utility.ArticleBll.Update(model, contentModel); } //处理标签 必须后处理 因为之前还没有插入articleID if (!String.IsNullOrEmpty(Request["txt_tag"])) { Utility.TagBll.UpdateTag(Request["blogID"], articleID + "", Request["txt_tag"].TrimEnd(',')); } return(Json(new { code = 1, message = "操作成功" }, JsonRequestBehavior.AllowGet)); }