Exemple #1
0
        public void ProcessRequest(HttpContext context)
        {
            bool isData = bllMenupermission.CheckPerRelationByaccount(currentUserInfo.UserID, -1);

            if (isData)
            {
                resp.errcode = (int)APIErrCode.OperateFail;
                resp.errmsg  = "权限不足";
                bllTag.ContextResponse(context, resp);
                return;
            }
            string ids = context.Request["ids"];

            if (string.IsNullOrWhiteSpace(ids))
            {
                resp.errcode = (int)APIErrCode.OperateFail;
                resp.errmsg  = "ids不能为空";
                bllTag.ContextResponse(context, resp);
                return;
            }

            if (bllTag.ExistsTag(ids, bllTag.WebsiteOwner))
            {
                resp.errcode = (int)APIErrCode.OperateFail;
                resp.errmsg  = "存在其他站点标签无权删除";
                bllTag.ContextResponse(context, resp);
                return;
            }
            List <BLLJIMP.Model.MemberTag> tags = bllTag.GetTagListByIds(ids);

            string usingTag = string.Empty;

            if (bllTag.IsUsingTag(tags, bllTag.WebsiteOwner, out usingTag))
            {
                resp.errcode = (int)APIErrCode.OperateFail;
                resp.errmsg  = string.Format("用户已添加'{0}'标签", usingTag);
                bllTag.ContextResponse(context, resp);
                return;
            }
            int count = bllTag.DeleteMultByKey <BLLJIMP.Model.MemberTag>("AutoID", ids);

            if (count >= 0)
            {
                resp.errcode   = (int)APIErrCode.IsSuccess;
                resp.errmsg    = string.Format("成功删除了 {0} 条数据", count);
                resp.isSuccess = true;
            }
            else
            {
                resp.errcode = (int)APIErrCode.OperateFail;
                resp.errmsg  = "删除标签失败";
            }
            bllTag.ContextResponse(context, resp);
        }
Exemple #2
0
        public void ProcessRequest(HttpContext context)
        {
            string autoId      = context.Request["id"],
                   tagName     = context.Request["name"],
                   tagType     = context.Request["type"],
                   accessLevel = context.Request["level"];

            if (string.IsNullOrEmpty(tagName))
            {
                resp.errcode = (int)APIErrCode.PrimaryKeyIncomplete;
                resp.errmsg  = "请输入标签名称";
                bllTag.ContextResponse(context, resp);
                return;
            }

            BLLJIMP.Model.MemberTag tag = bllTag.GetByKey <BLLJIMP.Model.MemberTag>("AutoId", autoId);
            if (tag == null)
            {
                resp.errcode = (int)APIErrCode.IsNotFound;
                resp.errmsg  = "未找到需要更新的标签";
                bllTag.ContextResponse(context, resp);
                return;
            }

            tag.TagName     = tagName;
            tag.AccessLevel = string.IsNullOrWhiteSpace(accessLevel) ? 0 : Convert.ToInt32(accessLevel);
            if (bllTag.ExistsTag(tag))
            {
                resp.errcode = (int)APIErrCode.IsRepeat;
                resp.errmsg  = "标签不能重复添加";
                bllTag.ContextResponse(context, resp);
                return;
            }
            if (bllTag.Update(tag))
            {
                resp.errcode   = (int)APIErrCode.IsSuccess;
                resp.isSuccess = true;
            }
            else
            {
                resp.errcode = (int)APIErrCode.OperateFail;
                resp.errmsg  = "更新失败";
            }

            bllTag.ContextResponse(context, resp);
        }
Exemple #3
0
        public void ProcessRequest(HttpContext context)
        {
            string tagName     = context.Request["name"],
                   tagType     = context.Request["type"],
                   accessLevel = context.Request["level"];

            if (string.IsNullOrEmpty(tagName))
            {
                resp.errcode = (int)APIErrCode.PrimaryKeyIncomplete;
                resp.errmsg  = "请输入标签名称";
                bllTag.ContextResponse(context, resp);
                return;
            }
            ZentCloud.BLLJIMP.Model.MemberTag tag = new ZentCloud.BLLJIMP.Model.MemberTag();
            tag.TagType      = string.IsNullOrWhiteSpace(tagType) ? "all" : tagType;
            tag.TagName      = tagName;
            tag.AccessLevel  = string.IsNullOrWhiteSpace(accessLevel) ? 0 : Convert.ToInt32(accessLevel);
            tag.CreateTime   = DateTime.Now;
            tag.Creator      = currentUserInfo.UserID;
            tag.WebsiteOwner = bllTag.WebsiteOwner;
            if (bllTag.ExistsTag(tag))
            {
                resp.errcode = (int)APIErrCode.IsRepeat;
                resp.errmsg  = "标签不能重复添加";
                bllTag.ContextResponse(context, resp);
                return;
            }

            if (bllTag.AddTag(tag))
            {
                resp.errcode   = (int)APIErrCode.IsSuccess;
                resp.isSuccess = true;
            }
            else
            {
                resp.errcode = (int)APIErrCode.OperateFail;
                resp.errmsg  = "添加失败";
            }

            bllTag.ContextResponse(context, resp);
        }
Exemple #4
0
        public void ProcessRequest(HttpContext context)
        {
            int    pageIndex = Convert.ToInt32(context.Request["page"]);
            int    pageSize = Convert.ToInt32(context.Request["rows"]);
            string tagName = context.Request["name"], tagType = context.Request["type"];
            int    totalCount = 0;
            List <BLLJIMP.Model.MemberTag> data = bllTag.GetTags(bllTag.WebsiteOwner, tagName, pageIndex, pageSize, out totalCount, tagType);


            resp.isSuccess = true;
            resp.returnObj = new
            {
                totalcount = totalCount,
                list       = (from p in data
                              select new {
                    id = p.AutoId,
                    name = p.TagName,
                    type = p.TagType,
                    level = p.AccessLevel
                })
            };
            bllTag.ContextResponse(context, resp);
        }