Example #1
0
        /// <summary>
        /// 编辑权限-编辑过滤页面
        /// </summary>
        public void Admin_url_Edit()
        {
            if (!EX_Admin.Power("admin_url_edit", "编辑过滤页面"))
            {
                AjaxNoPower();
                return;
            }
            int              id    = RequestTool.RequestInt("id", 0);
            int              gid   = RequestTool.RequestInt("gid", 0);
            string           url   = RequestTool.RequestString("Url");
            Lebi_Admin_Group group = B_Lebi_Admin_Group.GetModel(gid);

            if (url == "")
            {
                Response.Write("{\"msg\":\"" + Tag("地址不能为空") + "\"}");
                return;
            }
            if (group == null)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            Lebi_Admin_Power p = B_Lebi_Admin_Power.GetModel(id);

            if (p == null)
            {
                p = B_Lebi_Admin_Power.GetList("Admin_Group_id=" + group.id + " and Url=lbsql{'" + url + "'}", "").FirstOrDefault();
                if (p != null)
                {
                    Response.Write("{\"msg\":\"" + Tag("地址已经存在") + "\"}");
                    return;
                }
                p = new Lebi_Admin_Power();
                p.Admin_Group_id = group.id;
                p.Url            = url;
                B_Lebi_Admin_Power.Add(p);
                string action      = Tag("添加过滤页面");
                string description = url;
                Log.Add(action, "Admin_Power", p.id.ToString(), CurrentAdmin, description);
            }
            else
            {
                p.Url = url;
                B_Lebi_Admin_Power.Update(p);
                string action      = Tag("编辑过滤页面");
                string description = url;
                Log.Add(action, "Admin_Power", p.id.ToString(), CurrentAdmin, description);
            }

            Response.Write("{\"msg\":\"OK\"}");
        }
Example #2
0
        /// <summary>
        /// 保存权限
        /// </summary>
        public void SavePower()
        {
            if (!EX_Admin.Power("admin_limit_edit", "编辑权限"))
            {
                EX_Admin.NoPower();
                return;
            }
            string           ids   = RequestTool.RequestString("id");
            int              gid   = RequestTool.RequestInt("gid", 0);
            Lebi_Admin_Group group = B_Lebi_Admin_Group.GetModel(gid);

            if (group == null)
            {
                Response.Write("{\"msg" + Tag("参数错误") + "\"}");
                return;
            }
            B_Lebi_Admin_Power.Delete("Admin_Group_id=" + group.id + "");
            List <Lebi_Admin_Limit> models = B_Lebi_Admin_Limit.GetList("id in (lbsql{" + ids + "})", "");

            if (models != null)
            {
                Lebi_Admin_Power p = new Lebi_Admin_Power();
                foreach (Lebi_Admin_Limit model in models)
                {
                    p.Admin_Group_id   = group.id;
                    p.Admin_Limit_Code = model.Code;
                    p.Admin_Limit_id   = model.id;
                    B_Lebi_Admin_Power.Add(p);
                }
            }
            string action      = Tag("编辑权限");
            string description = Shop.Bussiness.Language.Content(group.Name, "CN");

            Log.Add(action, "Admin_Power", gid.ToString(), CurrentAdmin, description);
            Response.Write("{\"msg\":\"OK\"}");
        }