Beispiel #1
0
        /// <summary>
        /// 编辑权限
        /// </summary>
        public void limit_Edit()
        {
            if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
            {
                AjaxNoPower();
                return;
            }
            int id = RequestTool.RequestInt("id", 0);
            Lebi_Supplier_Limit model = B_Lebi_Supplier_Limit.GetModel(id);

            if (model == null)
            {
                model = new Lebi_Supplier_Limit();
                model = B_Lebi_Supplier_Limit.BindForm(model);
                B_Lebi_Supplier_Limit.Add(model);
                string action      = Tag("添加权限分组");
                string description = Shop.Bussiness.Language.Content(Language.RequestString("Name"), "CN");
                Log.Add(action, "Supplier_Group", model.id.ToString(), CurrentAdmin, description);
            }
            else
            {
                model = B_Lebi_Supplier_Limit.BindForm(model);
                B_Lebi_Supplier_Limit.Update(model);
                string action      = Tag("编辑权限分组");
                string description = Shop.Bussiness.Language.Content(Language.RequestString("Name"), "CN");
                Log.Add(action, "Supplier_Group", model.id.ToString(), CurrentAdmin, description);
            }
            Response.Write("{\"msg\":\"OK\"}");
        }
Beispiel #2
0
        public List <Lebi_Supplier_Limit> GetLimit(int pid)
        {
            List <Lebi_Supplier_Limit> ls = B_Lebi_Supplier_Limit.GetList("parentid=" + pid + "", "Sort desc");

            if (ls == null)
            {
                ls = new List <Lebi_Supplier_Limit>();
            }
            return(ls);
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
            {
                PageNoPower();
            }
            int id = RequestTool.RequestInt("id", 0);

            model = B_Lebi_Supplier_Limit.GetModel(id);
            if (model == null)
            {
                model = new Lebi_Supplier_Limit();
            }
        }
Beispiel #4
0
        /// <summary>
        /// 删除一个权限代码
        /// </summary>
        public void limit_Del()
        {
            if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
            {
                AjaxNoPower();
                return;
            }
            int id = RequestTool.RequestInt("id", 0);
            Lebi_Supplier_Limit model = B_Lebi_Supplier_Limit.GetModel(id);
            string action             = Tag("删除权限分组");
            string description        = Shop.Bussiness.Language.Content(model.Name, "CN");

            Log.Add(action, "Supplier_Group", id.ToString(), CurrentAdmin, description);
            B_Lebi_Supplier_Limit.Delete(id);
            Response.Write("{\"msg\":\"OK\"}");
        }
Beispiel #5
0
        /// <summary>
        /// 编辑分组权限
        /// </summary>
        public void SavePower()
        {
            if (!Power("supplier_power_edit", "编辑分组权限"))
            {
                AjaxNoPower();
                return;
            }
            int id = RequestTool.RequestInt("gid", 0);
            Lebi_Supplier_UserGroup group = B_Lebi_Supplier_UserGroup.GetModel("Supplier_id=" + CurrentSupplier.id + " and id =" + id);

            if (group == null)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            if (group.Supplier_id != CurrentSupplier.id)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            group.Limit_ids = RequestTool.RequestSafeString("id");
            string codes = "";

            if (group.Limit_ids != "")
            {
                List <Lebi_Supplier_Limit> models = B_Lebi_Supplier_Limit.GetList("id in (" + group.Limit_ids + ")", "");
                foreach (Lebi_Supplier_Limit model in models)
                {
                    if (codes == "")
                    {
                        codes = "'" + model.Code + "'";
                    }
                    else
                    {
                        codes += "," + "'" + model.Code + "'";
                    }
                }
            }
            group.Limit_Codes = codes;
            B_Lebi_Supplier_UserGroup.Update(group);
            Log.Add("编辑分组桌面菜单", "Supplier_User", id.ToString(), CurrentSupplier, "用户:" + CurrentUser.UserName);
            Response.Write("{\"msg\":\"OK\"}");
        }
Beispiel #6
0
        public List <Lebi_Supplier_Limit> GetLimit(int pid, string pcode = "")
        {
            string where = "";
            where        = "parentid=" + pid + "";
            if (pcode != "")
            {
                where = "parentid in (select id from [Lebi_Supplier_Limit] where Code='" + pcode + "')";
            }
            if (pid == 0)
            {
                where += " and Code<>'default'";
            }
            List <Lebi_Supplier_Limit> ls = B_Lebi_Supplier_Limit.GetList(where, "Sort desc");

            if (ls == null)
            {
                ls = new List <Lebi_Supplier_Limit>();
            }
            return(ls);
        }
Beispiel #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Power("supplier_power_edit", "编辑分组权限"))
            {
                AjaxNoPower();
                return;
            }
            models = GetLimit(0);
            int id = RequestTool.RequestInt("id", 0);

            group = B_Lebi_Supplier_UserGroup.GetModel("Supplier_id = " + CurrentSupplier.id + " and id = " + id);
            if (group == null)
            {
                PageError();
            }
            ps            = B_Lebi_Supplier_Power.GetList("Supplier_Group_id=" + group.id + " and Url=''", "");
            defaultparent = B_Lebi_Supplier_Limit.GetModel("Code='default'");
            if (defaultparent != null)
            {
                count = B_Lebi_Supplier_Limit.Counts("parentid = " + defaultparent.id + ""); //未分组
            }
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
            {
                PageReturnMsg = PageNoPowerMsg();
            }

            models = GetLimit(0);
            int id = RequestTool.RequestInt("id", 0);

            group = B_Lebi_Supplier_Group.GetModel(id);
            if (group == null)
            {
                PageError();
            }
            ps            = B_Lebi_Supplier_Power.GetList("Supplier_Group_id=" + group.id + " and Url=''", "");
            purls         = B_Lebi_Supplier_Power.GetList("Supplier_Group_id=" + group.id + " and Url!=''", "");
            defaultparent = B_Lebi_Supplier_Limit.GetModel("Code='default'");
            if (defaultparent != null)
            {
                count = B_Lebi_Supplier_Limit.Counts("parentid = " + defaultparent.id + ""); //未分组
            }
        }
Beispiel #9
0
        /// <summary>
        /// 保存权限
        /// </summary>
        public void SavePower()
        {
            if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
            {
                AjaxNoPower();
                return;
            }
            string ids = RequestTool.RequestString("id");
            int    gid = RequestTool.RequestInt("gid", 0);
            Lebi_Supplier_Group group = B_Lebi_Supplier_Group.GetModel(gid);

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

            if (models != null)
            {
                Lebi_Supplier_Power p = new Lebi_Supplier_Power();
                foreach (Lebi_Supplier_Limit model in models)
                {
                    p.Supplier_Group_id   = group.id;
                    p.Supplier_Limit_Code = model.Code;
                    p.Supplier_Limit_id   = model.id;
                    B_Lebi_Supplier_Power.Add(p);
                }
            }
            string action      = Tag("编辑权限");
            string description = Shop.Bussiness.Language.Content(group.Name, "CN");

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