Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ParentID"></param>
        /// <returns></returns>
        public List <JsonFunTree> GetSearchChildNodes(string ParentID)
        {
            List <JsonFunTree> list = new List <JsonFunTree>();
            DataSet            ds   = new BllSysFun().GetTreeList("ParentID='" + ParentID + "'");

            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int b = 0; b < ds.Tables[0].Rows.Count; b++)
                {
                    JsonFunTree model = new JsonFunTree();
                    model.id         = ds.Tables[0].Rows[b]["id"].ToString();
                    model.parentId   = ds.Tables[0].Rows[b]["parentId"].ToString();
                    model.text       = ds.Tables[0].Rows[b]["text"].ToString();
                    model.iconCls    = ds.Tables[0].Rows[b]["iconCls"].ToString();
                    model.pageUrl    = ds.Tables[0].Rows[b]["PageUrl"].ToString();
                    model.className  = ds.Tables[0].Rows[b]["ClassName"].ToString();
                    model.funSort    = Convert.ToInt32(ds.Tables[0].Rows[b]["FunSort"]);
                    model.expanded   = true;
                    model.IsSystem   = Convert.ToBoolean(ds.Tables[0].Rows[b]["IsSystem"]); //是否系统定义
                    model.CreateTime = Convert.ToDateTime(ds.Tables[0].Rows[b]["CreateTime"]);
                    model.leaf       = true;

                    model.children = GetSearchChildNodes(ds.Tables[0].Rows[b]["id"].ToString());

                    if (model.children.Count > 0)
                    {
                        model.leaf = false;
                    }

                    list.Add(model);
                }
            }
            return(list);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 功能权限控制
 /// </summary>
 public void funTree()
 {
     if (CurrentMaster != null)
     {
         string _typeId = Request["TypeID"]; _key = Request["key"];
         string output; DataTable mytab;
         string name = (Request["TreeName"] == null ? "" : Request["TreeName"]); //查询过滤条件
         if (CurrentMaster.Attribute != (int)AdminTypeEnum.普通员工)                 //超级管理员
         {
             string where = "";
             if (name != "")
             {
                 where += " FunName like '%" + name + "%' and TypeID=" + _typeId + " and Status=" + (int)StatusEnum.正常;
             }
             else
             {
                 where += " TypeID=" + _typeId + " and Status=" + (int)StatusEnum.正常;
             }
             mytab = new BllSysFun().GetTreeList(where).Tables[0]; //获取所有树
         }
         else
         {
             BllSysMaster mybase = new BllSysMaster();
             _where += (name == "" ? " and TypeID=" + _typeId + " and Status=" + (int)StatusEnum.正常 : " and TypeID=" + _typeId + "  and Status=" + (int)StatusEnum.正常 + " and FunName like '%" + name + "%'");
             mytab   = mybase.GetAuthByPage(CurrentMaster.RoleIdList, _where).Tables[0];
         }
         GetTreeNode(mytab);//功能权限
     }
     Output = Output.Replace("check", "checked");
     WriteJsonToPage(Output);
 }
Exemplo n.º 3
0
        public void SaveData(ModSysFun t)
        {
            BllSysFun bll = new BllSysFun();
            ModJsonResult json = new ModJsonResult();

            string pageAction = Request["PageAction"];
            string parentId = "0";//树状根节点统一为0

            t.isChild = false;
            if (Request["parentId"] != null && Request["parentId"] != "")
            {
                parentId = Request["parentId"];
                t.isChild = true;
            }
            t.ParentId = parentId;

            t.TypeId = int.Parse(Request["leftType"]);//左边模块选择的树

            if (!string.IsNullOrEmpty(Request["modify"])) //修改
            {
                t.PageUrl=(t.PageUrl == null ? "" : t.PageUrl);
                t.iconCls = (t.iconCls == null ? "" : t.iconCls);
                t.ClassName = (t.ClassName == null ? "" : t.ClassName);
                int result = bll.UpdateData(t);
                if (result <= 0)
                {
                    json.success = false;
                    json.msg = "修改失败,请稍后再操作!";
                }
            }
            else
            {
                t.Id = Guid.NewGuid().ToString();
                t.Status = (int)StatusEnum.正常;
                t.IsSystem = false;
                t.PageUrl = (t.PageUrl == null ? "" : t.PageUrl);
                t.iconCls = (t.iconCls == null ? "" : t.iconCls);
                t.ClassName = (t.ClassName == null ? "" : t.ClassName);

                int result = bll.Insert(t);
                if (result <= 0)
                {
                    json.success = false;
                    json.msg = " 保存失败,请稍后再操作!";
                }
            }

            //删除原有的按钮信息
            BllSysFunLinkBtnValue sysFunLinkBtnValue = new BllSysFunLinkBtnValue();
            sysFunLinkBtnValue.BatchInsert(pageAction, t.Id);

            WriteJsonToPage(json.ToString());
        }
Exemplo n.º 4
0
        public void Comboboxtree()
        {
            try
            {
                string LeftId = Request["LeftId"];//左边菜单选择
                BllSysFun mybase = new BllSysFun();
                _where += " and Status=" + (int)StatusEnum.正常 + "and TypeID=" + LeftId;
                _mySet = mybase.GetTreeList(_where);

                Output = JsonHelper.ToJson(new FunTreeCommon().GetFunTreeNodes(_mySet));
            }
            catch
            {
                Output = "{{'msg':'','success':false}}";
            }
            WriteJsonToPage(Output);
        }
Exemplo n.º 5
0
 public void InitMain()
 {
     try
     {
         string typeId = (Request["id"] == null ? "0" : Request["id"]);//左边树形类型
         BllSysFun mybase = new BllSysFun();
         _where += " and Status!="+(int)StatusEnum.删除+" and TypeID=" + typeId;
         _mySet = mybase.GetTreeList(_where);
         List<JsonFunTree> list = new FunTreeCommon().GetFunTreeNodes(_mySet);
         Output =JsonHelper.ToJson(list);
     }
     catch
     {
         Output ="";
     }
     WriteJsonToPage(Output);
 }
Exemplo n.º 6
0
        /// <summary>
        /// 启用状态
        /// </summary>
        public void EnableUse()
        {
            var msg = new ModJsonResult();

            string key = Request["id"];
            int result = new BllSysFun().UpdateIsStatus(1, key);
            if (result > 0)
            {
                msg.success = true;
            }
            else
            {
                msg.success = false;
                msg.msg = "操作失败";
            }

            WriteJsonToPage(msg.ToString());
        }
Exemplo n.º 7
0
        /// <summary>
        ///菜单树,没有权限的菜单
        /// </summary>
        /// <param name="childId"></param>
        /// <param name="master">登录用户对象</param>
        public void InitAdminTree(string childId, ModSysMaster master)
        {
            string output = "";
            string _where = "1=1";

            childId = (childId == "-1" ? "0" : childId);
            //获取
            try
            {
                //获取菜单访问权限
                int att = master.Attribute;
                _where += " and TypeID=" + att;

                BllSysFun mybase = new BllSysFun();

                string name = (Request["FunName"] == null ? "" : Request["FunName"]).Trim(); //查询过滤条件

                _where += (name == "" ? " and Status=" + (int)StatusEnum.正常 : " and Status=" + (int)StatusEnum.正常 + " and FunName like '%" + name.Trim() + "%'");

                DataSet _mySet = mybase.GetTreeList(_where);

                if (name == "")
                {
                    output = JsonHelper.ToJson(new FunTreeCommon().GetFunTreeNodes(_mySet));
                }
                else
                {
                    output = JsonHelper.ToJson(new FunTreeCommon().GetSearchTreeNodes(_mySet));
                }
            }
            catch
            {
                var json = new ModJsonResult();
                json.success   = false;
                json.errorCode = (int)SystemError.正常错误;
                json.msg       = "菜单树异常,无法进行操作";
                output         = JsonHelper.ToJson(json);
            }
            Response.Write(output);
            Response.End();
        }
Exemplo n.º 8
0
 /// <summary>
 /// 删除
 /// </summary>
 public void DeleteData(string id)
 {
     var msg = new ModJsonResult();
     try
     {
         int result = new BllSysFun().DeleteDate(id);
         if (result > 0)
         {
             msg.success = true;
         }
         else
         {
             msg.success = false;
             msg.msg = "操作失败";
         }
     }
     catch (Exception ex)
     {
         msg.msg = "操作失败:" + ex.Message;
     }
     WriteJsonToPage(msg.ToString());
 }
Exemplo n.º 9
0
        /// <summary>
        /// 查看他人权限设置
        /// </summary>
        public void GetOtherfunTree()
        {
            if (CurrentMaster != null)
            {
                string       _typeId = Request["TypeID"]; _key = Request["key"];
                string       output; DataTable mytab = null;
                BllSysMaster mybase = new BllSysMaster();

                //查询角色创建人
                BllSysRole role     = new BllSysRole();
                var        roleInfo = role.LoadData(_key);
                var        other    = mybase.LoadData(roleInfo.CreaterId); //角色用户
                if (other.Attribute != (int)AdminTypeEnum.普通员工)            //超级管理员,不用控权
                {
                    _where += " and TypeID=" + _typeId + " and Status=" + (int)StatusEnum.正常;
                    mytab   = new BllSysFun().GetTreeList(_where).Tables[0]; //获取所有树
                }
                else
                {
                    string roleIdList = new BllSysMasterRole().GetMasterRole(other.Id);
                    if (!String.IsNullOrEmpty(roleIdList))
                    {
                        _where += " and TypeID=" + _typeId + "and Status=" + (int)StatusEnum.正常;
                        mytab   = mybase.GetAuthByPage(roleIdList, _where).Tables[0];
                    }
                    else
                    {
                        WriteJsonToPage(Output);
                        return;
                    }
                }
                GetTreeNode(mytab);//功能权限
            }
            Output = Output.Replace("check", "checked");
            WriteJsonToPage(Output);
        }