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); }
/// <summary> /// 添加标签 /// </summary> /// <param name="context"></param> /// <returns></returns> private string AddTag(HttpContext context) { string tagName = context.Request["TagName"], tagType = context.Request["TagType"]; if (string.IsNullOrEmpty(tagName)) { resp.Status = 0; resp.Msg = "请输入标签名称"; return(Common.JSONHelper.ObjectToJson(resp)); } MemberTag tag = new MemberTag(); tag.TagType = string.IsNullOrEmpty(tagType) ? "all" : tagType; tag.TagName = tagName; tag.CreateTime = DateTime.Now; tag.Creator = this.currentUserInfo.UserID; tag.WebsiteOwner = bllTag.WebsiteOwner; if (bllTag.ExistsTag(tag)) { resp.Status = 0; resp.Msg = "标签不能重复添加"; return(Common.JSONHelper.ObjectToJson(resp)); } if (bllTag.AddTag(tag)) { resp.Status = 1; resp.Msg = "添加成功"; } else { resp.Status = 0; resp.Msg = "添加失败"; } return(Common.JSONHelper.ObjectToJson(resp)); }
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); }
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); }