/// <summary>
        /// 加载按钮 (返回树Json)
        /// </summary>
        /// <param name="ModuleId">模块ID</param>
        /// <param name="Category">分类:1-工具栏,2:右击栏</param>
        /// <returns></returns>
        public ActionResult ButtonTreeJson(string ModuleId, string Category)
        {
            List <Base_Button>    list     = _baseButtonbll.GetList(ModuleId, Category);
            List <TreeJsonEntity> TreeList = new List <TreeJsonEntity>();

            foreach (Base_Button item in list)
            {
                string             ButtonId    = item.ButtonId;
                bool               hasChildren = false;
                List <Base_Button> childnode   = list.FindAll(t => t.ParentId == ButtonId);
                if (childnode.Count > 0)
                {
                    hasChildren = true;
                }
                TreeJsonEntity tree = new TreeJsonEntity();
                tree.id          = ButtonId;
                tree.text        = item.FullName;
                tree.value       = item.Code;
                tree.isexpand    = true;
                tree.complete    = true;
                tree.hasChildren = hasChildren;
                tree.parentId    = item.ParentId;
                tree.img         = item.Icon != null ? "/Content/Images/Icon16/" + item.Icon : item.Icon;
                TreeList.Add(tree);
            }
            return(Content(TreeList.TreeToJson()));
        }
        /// <summary>
        /// 加载模块 返回树JSON
        /// </summary>
        /// <param name="ObjectId">对象主键</param>
        /// <param name="Category">对象分类:1-部门2-角色3-岗位4-群组</param>
        /// <returns></returns>
        public ActionResult ModuleTree(string ObjectId, string Category)
        {
            DataTable             dt       = base_modulepermissionbll.GetList(ObjectId, Category);
            List <TreeJsonEntity> TreeList = new List <TreeJsonEntity>();

            if (!DataHelper.IsExistRows(dt))
            {
                foreach (DataRow item in dt.Rows)
                {
                    string    ModuleId    = item["moduleid"].ToString();
                    bool      hasChildren = false;
                    DataTable childnode   = DataHelper.GetNewDataTable(dt, "ParentId = '" + ModuleId + "'");
                    if (childnode.Rows.Count > 0)
                    {
                        hasChildren = true;
                    }
                    TreeJsonEntity tree = new TreeJsonEntity();
                    tree.id          = item["moduleid"].ToString();
                    tree.text        = item["fullname"].ToString();
                    tree.value       = item["moduleid"].ToString();
                    tree.checkstate  = item["objectid"].ToString() != "" ? 1 : 0;
                    tree.showcheck   = true;
                    tree.isexpand    = true;
                    tree.complete    = true;
                    tree.hasChildren = hasChildren;
                    tree.parentId    = item["parentid"].ToString();
                    tree.img         = item["icon"].ToString() != null ? "/Content/Images/Icon16/" + item["icon"].ToString() : item["icon"].ToString();
                    TreeList.Add(tree);
                }
            }
            return(Content(TreeList.TreeToJson()));
        }
        /// <summary>
        /// 左边分类列表(返回树JSON)
        /// </summary>
        /// <returns></returns>
        public ActionResult TreeJson()
        {
            List <Base_DataDictionary> list     = DataFactory.Database().FindList <Base_DataDictionary>("ORDER BY SortCode ASC");
            List <TreeJsonEntity>      TreeList = new List <TreeJsonEntity>();

            foreach (Base_DataDictionary item in list)
            {
                string DataDictionaryId = item.DataDictionaryId;
                bool   hasChildren      = false;
                List <Base_DataDictionary> childnode = list.FindAll(t => t.ParentId == DataDictionaryId);
                if (childnode.Count > 0)
                {
                    hasChildren = true;
                }
                TreeJsonEntity tree = new TreeJsonEntity();
                tree.id             = DataDictionaryId;
                tree.text           = item.FullName;
                tree.value          = item.Code;
                tree.Attribute      = "IsTree";
                tree.AttributeValue = item.IsTree.ToString();
                tree.isexpand       = true;
                tree.complete       = true;
                tree.hasChildren    = hasChildren;
                tree.parentId       = item.ParentId;
                TreeList.Add(tree);
            }
            return(Content(TreeList.TreeToJson()));
        }
Beispiel #4
0
        /// <summary>
        /// 【公司管理】返回树JONS
        /// </summary>
        /// <returns></returns>
        public ActionResult TreeJson()
        {
            List <Base_Company>   list     = base_companybll.GetList();
            List <TreeJsonEntity> TreeList = new List <TreeJsonEntity>();

            foreach (Base_Company item in list)
            {
                bool  hasChildren = false;
                IList childnode   = list.FindAll(t => t.ParentId == item.CompanyId);
                if (childnode.Count > 0)
                {
                    hasChildren = true;
                }
                TreeJsonEntity tree = new TreeJsonEntity();
                tree.id             = item.CompanyId;
                tree.text           = item.FullName;
                tree.value          = item.CompanyId;
                tree.Attribute      = "Category";
                tree.AttributeValue = item.Category;
                tree.isexpand       = true;
                tree.complete       = true;
                tree.hasChildren    = hasChildren;
                tree.parentId       = item.ParentId;
                if (item.ParentId == "0")
                {
                    tree.img = "/Content/Images/Icon16/molecule.png";
                }
                else
                {
                    tree.img = "/Content/Images/Icon16/hostname.png";
                }
                TreeList.Add(tree);
            }
            return(Content(TreeList.TreeToJson()));
        }
        /// <summary>
        /// 快捷方式 返回菜单模块树JSON
        /// </summary>
        /// <returns></returns>
        public ActionResult ShortcutsModuleTreeJson()
        {
            BaseShortcutsBll      base_shortcutsbll = new BaseShortcutsBll();
            string                UserId            = ManageProvider.Provider.Current().UserId;
            List <Base_Module>    ShortcutList      = base_shortcutsbll.GetShortcutList(UserId);
            string                ObjectId          = ManageProvider.Provider.Current().ObjectId;
            List <Base_Module>    list     = base_modulepermissionbll.GetModuleList(ObjectId).FindAll(t => t.Enabled == 1);
            List <TreeJsonEntity> TreeList = new List <TreeJsonEntity>();

            foreach (Base_Module item in list)
            {
                TreeJsonEntity tree = new TreeJsonEntity();
                tree.id    = item.ModuleId;
                tree.text  = item.FullName;
                tree.value = item.ModuleId;
                if (item.Category == "页面")
                {
                    tree.checkstate = ShortcutList.FindAll(t => t.ModuleId == item.ModuleId).Count == 0 ? 0 : 1;
                    //tree.checkstate = item["objectid"].ToString() != "" ? 1 : 0;
                    tree.showcheck = true;
                }
                tree.isexpand    = true;
                tree.complete    = true;
                tree.hasChildren = list.FindAll(t => t.ParentId == item.ModuleId).Count > 0 ? true : false;
                tree.parentId    = item.ParentId;
                tree.img         = item.Icon != null ? "/Content/Images/Icon16/" + item.Icon : item.Icon;
                TreeList.Add(tree);
            }
            return(Content(TreeList.TreeToJson()));
        }
        /// <summary>
        /// 【模块管理】返回树JONS
        /// </summary>
        /// <returns></returns>
        public ActionResult TreeJson()
        {
            List <Base_Module>    list     = base_modulebll.GetList();
            List <TreeJsonEntity> TreeList = new List <TreeJsonEntity>();

            foreach (Base_Module item in list)
            {
                TreeJsonEntity     tree        = new TreeJsonEntity();
                bool               hasChildren = false;
                List <Base_Module> childnode   = list.FindAll(t => t.ParentId == item.ModuleId);
                if (childnode.Count > 0)
                {
                    hasChildren = true;
                }
                tree.id          = item.ModuleId;
                tree.text        = item.FullName;
                tree.value       = item.ModuleId;
                tree.isexpand    = item.Isexpand == 1 ? true : false;
                tree.complete    = true;
                tree.hasChildren = hasChildren;
                tree.parentId    = item.ParentId;
                tree.img         = item.Icon != null ? "/Content/Images/Icon16/" + item.Icon : item.Icon;
                TreeList.Add(tree);
            }
            return(Content(TreeList.TreeToJson()));
        }
        /// <summary>
        /// 加载无限树菜单
        /// </summary>
        /// <returns></returns>
        public ActionResult LoadTreeMenu(string ModuleId)
        {
            string                ObjectId = ManageProvider.Provider.Current().ObjectId;
            List <Base_Module>    list     = base_modulepermissionbll.GetModuleList(ObjectId).FindAll(t => t.Enabled == 1);
            List <TreeJsonEntity> TreeList = new List <TreeJsonEntity>();

            foreach (Base_Module item in list)
            {
                TreeJsonEntity     tree        = new TreeJsonEntity();
                bool               hasChildren = false;
                List <Base_Module> childnode   = list.FindAll(t => t.ParentId == item.ModuleId);
                if (childnode.Count > 0)
                {
                    hasChildren = true;
                }
                if (item.Category == "页面")
                {
                    tree.Attribute      = "Location";
                    tree.AttributeValue = item.Location;
                }
                tree.id          = item.ModuleId;
                tree.text        = item.FullName;
                tree.value       = item.ModuleId;
                tree.isexpand    = false;
                tree.complete    = true;
                tree.hasChildren = hasChildren;
                tree.parentId    = item.ParentId;
                tree.img         = item.Icon != null ? "/Content/Images/Icon16/" + item.Icon : item.Icon;
                TreeList.Add(tree);
            }
            return(Content(TreeList.TreeToJson(ModuleId)));
        }
        /// <summary>
        /// 返回 物流方式Json树
        /// </summary>
        /// <returns></returns>
        public ActionResult TreeJson()
        {
            List <ShipTypeEntity> list     = _shipTypeBLL.GetList();
            List <TreeJsonEntity> treeList = new List <TreeJsonEntity>();

            TreeJsonEntity tree = new TreeJsonEntity();

            tree.id          = "1";
            tree.text        = "全部";
            tree.value       = "";
            tree.parentId    = "0";
            tree.isexpand    = true;
            tree.complete    = true;
            tree.hasChildren = true;
            tree.img         = "/Content/Images/Icon16/basket_shopping.png";
            treeList.Add(tree);

            foreach (ShipTypeEntity entity in list)
            {
                TreeJsonEntity node = new TreeJsonEntity();
                node.id          = entity.ShipTypeId;
                node.text        = entity.ShipTypeName;
                node.value       = entity.ShipTypeId;
                node.parentId    = "1";
                node.isexpand    = true;
                node.complete    = true;
                node.hasChildren = false;
                node.img         = "/Content/Images/Icon16/basket_shopping.png";

                treeList.Add(node);
            }

            return(Content(treeList.TreeToJson()));
        }
        /// <summary>
        /// 查看拥有视图权限 返回树JSON
        /// </summary>
        /// <param name="ObjectId">对象主键</param>
        /// <returns></returns>
        public ActionResult LookViewPermission(string ObjectId)
        {
            //如果ObjectId为空。自动获取当前登录用户拥有权限
            if (string.IsNullOrEmpty(ObjectId))
            {
                ObjectId = ManageProvider.Provider.Current().ObjectId;
            }
            DataTable             dt       = base_viewpermissionbll.GetViewPermission(ObjectId);
            List <TreeJsonEntity> TreeList = new List <TreeJsonEntity>();

            if (!DataHelper.IsExistRows(dt))
            {
                foreach (DataRow item in dt.Rows)
                {
                    string    id          = item["id"].ToString();
                    bool      hasChildren = false;
                    DataTable childnode   = DataHelper.GetNewDataTable(dt, "ParentId = '" + id + "'");
                    if (childnode.Rows.Count > 0)
                    {
                        hasChildren = true;
                    }
                    TreeJsonEntity tree = new TreeJsonEntity();
                    tree.id          = item["id"].ToString();
                    tree.text        = item["fullname"].ToString();
                    tree.value       = item["id"].ToString();
                    tree.isexpand    = true;
                    tree.complete    = true;
                    tree.hasChildren = hasChildren;
                    tree.parentId    = item["parentid"].ToString();
                    tree.img         = item["icon"].ToString() != "" ? "/Content/Images/Icon16/" + item["icon"].ToString() : "/Content/Images/Icon16/tag_blue.png";
                    TreeList.Add(tree);
                }
            }
            return(Content(TreeList.TreeToJson()));
        }
        /// <summary>
        /// 加载岗位
        /// <param name="ObjectId">对象主键</param>
        /// <param name="Category">对象分类:1-部门2-角色3-岗位4-群组</param>
        /// </summary>
        /// <returns></returns>
        public ActionResult ScopeUserGroupList(string ObjectId, string Category)
        {
            string                ModuleId = "b863d076-37bb-45aa-8318-37942026921e";
            DataTable             DataList = base_datascopepermissionbll.GetScopeUserGroupList(ModuleId, ObjectId, Category);
            List <TreeJsonEntity> TreeList = new List <TreeJsonEntity>();

            if (!DataHelper.IsExistRows(DataList))
            {
                foreach (DataRow row in DataList.Rows)
                {
                    TreeJsonEntity tree        = new TreeJsonEntity();
                    string         PostId      = row["id"].ToString();
                    bool           hasChildren = false;
                    DataTable      childnode   = DataHelper.GetNewDataTable(DataList, "parentid='" + PostId + "'");
                    if (childnode.Rows.Count > 0)
                    {
                        hasChildren = true;
                    }
                    else
                    {
                        if (row["sort"].ToString() == "Company" || row["sort"].ToString() == "Department")
                        {
                            continue;
                        }
                    }
                    if (row["parentid"].ToString() != "0")
                    {
                        tree.checkstate = row["objectid"].ToString() != "" ? 1 : 0;
                        tree.showcheck  = true;
                    }
                    tree.id          = PostId;
                    tree.text        = row["fullname"].ToString();
                    tree.value       = row["code"].ToString();
                    tree.parentId    = row["parentid"].ToString();
                    tree.isexpand    = true;
                    tree.complete    = true;
                    tree.hasChildren = hasChildren;
                    if (row["parentid"].ToString() == "0")
                    {
                        tree.img = "/Content/Images/Icon16/molecule.png";
                    }
                    else if (row["sort"].ToString() == "Company")
                    {
                        tree.img = "/Content/Images/Icon16/hostname.png";
                    }
                    else if (row["sort"].ToString() == "Department")
                    {
                        tree.img = "/Content/Images/Icon16/chart_organisation.png";
                    }
                    else if (row["sort"].ToString() == "UserGroup")
                    {
                        tree.img = "/Content/Images/Icon16/group_gear.png";
                    }
                    TreeList.Add(tree);
                }
            }
            return(Content(TreeList.TreeToJson()));
        }
Beispiel #11
0
        /// <summary>
        /// 加载角色
        /// <param name="objectId">对象主键</param>
        /// <param name="category">对象分类:1-部门2-角色</param>
        /// </summary>
        /// <returns></returns>
        public ActionResult ScopeRoleList(string objectId, string category)
        {
            string                moduleId = "cef74b80-24a5-4d77-9ede-bbbc75cdb431";
            DataTable             dataList = _baseDatascopepermissionbll.GetScopeRoleList(moduleId, objectId, category);
            List <TreeJsonEntity> treeList = new List <TreeJsonEntity>();

            if (!DataHelper.IsExistRows(dataList))
            {
                foreach (DataRow row in dataList.Rows)
                {
                    TreeJsonEntity tree        = new TreeJsonEntity();
                    string         roleId      = row["roleid"].ToString();
                    bool           hasChildren = false;
                    DataTable      childnode   = DataHelper.GetNewDataTable(dataList, "parentid='" + roleId + "'");
                    if (childnode.Rows.Count > 0)
                    {
                        hasChildren = true;
                    }
                    else
                    {
                        if (row["sort"].ToString() == "Company")
                        {
                            continue;
                        }
                    }
                    if (row["parentid"].ToString() != "0")
                    {
                        tree.checkstate = row["objectid"].ToString() != "" ? 1 : 0;
                        tree.showcheck  = true;
                    }
                    tree.id             = roleId;
                    tree.text           = row["fullname"].ToString();
                    tree.value          = row["code"].ToString();
                    tree.parentId       = row["parentid"].ToString();
                    tree.Attribute      = "Type";
                    tree.AttributeValue = row["sort"].ToString();
                    tree.isexpand       = true;
                    tree.complete       = true;
                    tree.hasChildren    = hasChildren;
                    if (row["parentid"].ToString() == "0")
                    {
                        tree.img = "/Content/Images/Icon16/molecule.png";
                    }
                    else if (row["sort"].ToString() == "Company")
                    {
                        tree.img = "/Content/Images/Icon16/hostname.png";
                    }
                    else if (row["sort"].ToString() == "Roles")
                    {
                        tree.img = "/Content/Images/Icon16/role.png";
                    }
                    treeList.Add(tree);
                }
            }
            return(Content(treeList.TreeToJson()));
        }
Beispiel #12
0
        /// <summary>
        /// 加载部门
        /// <param name="objectId">对象主键</param>
        /// <param name="category">对象分类:1-部门2-角色</param>
        /// </summary>
        /// <returns></returns>
        public ActionResult ScopeWarehouseList(string objectId, string category)
        {
            string                moduleId = "f19b29b4-3edc-4d17-adc9-165c03020fa9";
            DataTable             dataList = _baseDatascopepermissionbll.GetScopeWarehouseList(moduleId, objectId, category);
            List <TreeJsonEntity> treeList = new List <TreeJsonEntity>();

            if (!DataHelper.IsExistRows(dataList))
            {
                foreach (DataRow row in dataList.Rows)
                {
                    TreeJsonEntity tree        = new TreeJsonEntity();
                    string         warehouseId = row["WarehouseId"].ToString();
                    bool           hasChildren = false;
                    DataTable      childnode   = DataHelper.GetNewDataTable(dataList, "parentid='" + warehouseId + "'");
                    if (childnode.Rows.Count > 0)
                    {
                        hasChildren = true;
                    }
                    else
                    {
                        if (row["sort"].ToString() == "Company")
                        {
                            continue;
                        }
                    }
                    if (row["parentid"].ToString() != "0")
                    {
                        tree.checkstate = row["objectid"].ToString() != "" ? 1 : 0;
                        tree.showcheck  = true;
                    }
                    tree.id          = warehouseId;
                    tree.text        = row["fullname"].ToString();
                    tree.value       = row["code"].ToString();
                    tree.parentId    = row["parentid"].ToString();
                    tree.isexpand    = true;
                    tree.complete    = true;
                    tree.hasChildren = hasChildren;
                    if (row["parentid"].ToString() == "0")
                    {
                        tree.img = "/Content/Images/Icon16/molecule.png";
                    }
                    else if (row["sort"].ToString() == "Company")
                    {
                        tree.img = "/Content/Images/Icon16/hostname.png";
                    }
                    else if (row["sort"].ToString() == "Department")
                    {
                        tree.img = "/Content/Images/Icon16/chart_organisation.png";
                    }
                    treeList.Add(tree);
                }
            }
            return(Content(treeList.TreeToJson()));
        }
Beispiel #13
0
        /// <summary>
        /// 返回 树JONS
        /// </summary>
        /// <returns></returns>
        public ActionResult TreeJson(string Number)
        {
            IDatabase database = DataFactory.Database();
            string    sql      = "select Number,Name from Ho_HouseInfo where 1=1";

            if (!StringHelper.IsNullOrEmpty(Number))
            {
                sql += " and Number = '" + Number + "'";
            }
            var houseList = database.FindListBySql <Ho_HouseInfo>(sql);
            List <TreeJsonEntity> TreeList = new List <TreeJsonEntity>();

            foreach (var houseModel in houseList)
            {
                if (houseModel != null)
                {
                    TreeJsonEntity tree = new TreeJsonEntity();
                    tree.id             = houseModel.Number;
                    tree.text           = houseModel.Name;
                    tree.parentId       = "0";
                    tree.Attribute      = "Type";
                    tree.AttributeValue = "House";
                    tree.isexpand       = true;
                    tree.complete       = true;
                    tree.hasChildren    = true;
                    tree.img            = "/Content/Images/Icon16/house_one.png";
                    TreeList.Add(tree);

                    //剩余四个图册
                    var dicList = database.FindList <Base_DataDictionaryDetail>(" and DataDictionaryId = '9ff7250d-bb28-44ac-a721-04bf33325a85'");
                    if (dicList != null)
                    {
                        foreach (var item in dicList)
                        {
                            var treeModel = new TreeJsonEntity()
                            {
                                id             = item.DataDictionaryDetailId,
                                text           = item.FullName,
                                parentId       = houseModel.Number,
                                value          = houseModel.Number,
                                Attribute      = "Type",
                                AttributeValue = "Group",
                                isexpand       = true,
                                complete       = true,
                                hasChildren    = false,
                                img            = "/Content/Images/Icon16/image.png"
                            };
                            TreeList.Add(treeModel);
                        }
                    }
                }
            }
            return(Content(TreeList.TreeToJson()));
        }
Beispiel #14
0
        /// <summary>
        /// 加载部门
        /// <param name="ObjectId">对象主键</param>
        /// <param name="Category">对象分类:1-部门2-角色</param>
        /// </summary>
        /// <returns></returns>
        public ActionResult ScopeDepartmentList(string ObjectId, string Category)
        {
            string                ModuleId = "e84c0fca-d912-4f5c-a25e-d5765e33b0d2";
            DataTable             dataList = _baseDatascopepermissionbll.GetScopeDepartmentList(ModuleId, ObjectId, Category);
            List <TreeJsonEntity> treeList = new List <TreeJsonEntity>();

            if (!DataHelper.IsExistRows(dataList))
            {
                foreach (DataRow row in dataList.Rows)
                {
                    TreeJsonEntity tree         = new TreeJsonEntity();
                    string         departmentId = row["departmentid"].ToString();
                    bool           hasChildren  = false;
                    DataTable      childnode    = DataHelper.GetNewDataTable(dataList, "parentid='" + departmentId + "'");
                    if (childnode.Rows.Count > 0)
                    {
                        hasChildren = true;
                    }
                    else
                    {
                        if (row["sort"].ToString() == "Company")
                        {
                            continue;
                        }
                    }
                    if (row["parentid"].ToString() != "0")
                    {
                        tree.checkstate = row["objectid"].ToString() != "" ? 1 : 0;
                        tree.showcheck  = true;
                    }
                    tree.id          = departmentId;
                    tree.text        = row["fullname"].ToString();
                    tree.value       = row["code"].ToString();
                    tree.parentId    = row["parentid"].ToString();
                    tree.isexpand    = true;
                    tree.complete    = true;
                    tree.hasChildren = hasChildren;
                    if (row["parentid"].ToString() == "0")
                    {
                        tree.img = "/Content/Images/Icon16/molecule.png";
                    }
                    else if (row["sort"].ToString() == "Company")
                    {
                        tree.img = "/Content/Images/Icon16/hostname.png";
                    }
                    else if (row["sort"].ToString() == "Department")
                    {
                        tree.img = "/Content/Images/Icon16/chart_organisation.png";
                    }
                    treeList.Add(tree);
                }
            }
            return(Content(treeList.TreeToJson()));
        }
Beispiel #15
0
        /// <summary>
        /// 加载公司
        /// <param name="objectId">对象主键</param>
        /// <param name="category">对象分类:1-部门2-角色</param>
        /// </summary>
        /// <returns></returns>
        public ActionResult ScopeCompanyList(string objectId, string category)
        {
            string                ModuleId = "b29cabd8-ffb6-4d34-9d08-ee1dba2b5b6b";
            DataTable             dataList = _baseDatascopepermissionbll.GetScopeCompanyList(ModuleId, objectId, category);
            List <TreeJsonEntity> treeList = new List <TreeJsonEntity>();

            if (!DataHelper.IsExistRows(dataList))
            {
                foreach (DataRow item in dataList.Rows)
                {
                    bool      hasChildren = false;
                    DataTable childnode   = DataHelper.GetNewDataTable(dataList,
                                                                       "parentid = '" + item["companyid"].ToString() + "'");
                    if (childnode.Rows.Count > 0)
                    {
                        hasChildren = true;
                    }
                    TreeJsonEntity tree = new TreeJsonEntity();
                    tree.id          = item["companyid"].ToString();
                    tree.text        = item["fullname"].ToString();
                    tree.value       = item["code"].ToString();
                    tree.checkstate  = item["objectid"].ToString() != "" ? 1 : 0;
                    tree.showcheck   = true;
                    tree.isexpand    = true;
                    tree.complete    = true;
                    tree.hasChildren = hasChildren;
                    tree.parentId    = item["parentid"].ToString();
                    if (item["parentid"].ToString() == "0")
                    {
                        tree.img = "/Content/Images/Icon16/molecule.png";
                    }
                    else
                    {
                        tree.img = "/Content/Images/Icon16/hostname.png";
                    }
                    treeList.Add(tree);
                }
            }
            else
            {
                TreeJsonEntity tree = new TreeJsonEntity();
                tree.id          = "";
                tree.text        = "<span style='color:red'>没有找到您要的相关数据...</span>";
                tree.value       = "";
                tree.isexpand    = true;
                tree.complete    = true;
                tree.hasChildren = false;
                tree.parentId    = "0";
                tree.img         = "/Content/Images/Icon32/database_red.png";
                treeList.Add(tree);
            }
            return(Content(treeList.TreeToJson()));
        }
Beispiel #16
0
        /// <summary>
        /// 查看拥有按钮权限 返回树JSON
        /// </summary>
        /// <param name="ObjectId">对象主键</param>
        /// <returns></returns>
        public ActionResult LookButtonePermission(string ObjectId)
        {
            //如果ObjectId为空。自动获取当前登录用户拥有权限
            if (string.IsNullOrEmpty(ObjectId))
            {
                ObjectId = ManageProvider.Provider.Current().ObjectId;
            }
            DataTable             dt       = _baseButtonpermissionbll.GetButtonePermission(ObjectId);
            List <TreeJsonEntity> TreeList = new List <TreeJsonEntity>();

            if (!DataHelper.IsExistRows(dt))
            {
                foreach (DataRow item in dt.Rows)
                {
                    string text = "";
                    if (item["Sort"].ToString() == "按钮")
                    {
                        if (item["Category"].ToString() == "1")
                        {
                            text = item["fullname"].ToString() + "(工具栏)";
                        }
                        else if (item["Category"].ToString() == "2")
                        {
                            text = item["fullname"].ToString() + "(右击栏)";
                        }
                    }
                    else
                    {
                        text = item["fullname"].ToString();
                    }
                    string    id          = item["id"].ToString();
                    bool      hasChildren = false;
                    DataTable childnode   = DataHelper.GetNewDataTable(dt, "ParentId = '" + id + "'");
                    if (childnode.Rows.Count > 0)
                    {
                        hasChildren = true;
                    }
                    TreeJsonEntity tree = new TreeJsonEntity();
                    tree.id          = item["id"].ToString();
                    tree.text        = text;
                    tree.value       = item["id"].ToString();
                    tree.isexpand    = true;
                    tree.complete    = true;
                    tree.hasChildren = hasChildren;
                    tree.parentId    = item["parentid"].ToString();
                    tree.img         = item["icon"].ToString() != string.Empty
                        ? "/Content/Images/Icon16/" + item["icon"].ToString()
                        : item["icon"].ToString();
                    TreeList.Add(tree);
                }
            }
            return(Content(TreeList.TreeToJson()));
        }
Beispiel #17
0
        /// <summary>
        /// 加载文件夹目录
        /// </summary>
        /// <param name="FolderId">文件夹Id</param>
        /// <returns></returns>
        public ActionResult TreeJson(string FolderId)
        {
            List <Base_NetworkFolder> list = new List <Base_NetworkFolder>();

            if (!string.IsNullOrEmpty(FolderId))
            {
                //查询所有子文件夹(递归)
                list = base_networkfilebll.GetChildrenNodeList(FolderId);
            }
            else
            {
                list = repositoryfactory.Repository().FindList();
            }
            List <TreeJsonEntity> TreeList = new List <TreeJsonEntity>();
            int ParentId_index             = 0;

            foreach (Base_NetworkFolder item in list)
            {
                TreeJsonEntity            tree        = new TreeJsonEntity();
                bool                      hasChildren = false;
                List <Base_NetworkFolder> childnode   = list.FindAll(t => t.ParentId == item.FolderId);
                if (childnode.Count > 0)
                {
                    hasChildren = true;
                }
                tree.id    = item.FolderId;
                tree.text  = item.FolderName;
                tree.value = item.FolderId;
                if (item.ParentId == "0")
                {
                    if (ParentId_index == 0)
                    {
                        tree.isexpand = true;
                    }
                    else
                    {
                        tree.isexpand = false;
                    }
                    ParentId_index++;
                }
                else
                {
                    tree.isexpand = false;
                }
                tree.complete       = true;
                tree.hasChildren    = hasChildren;
                tree.Attribute      = "IsPublic";
                tree.AttributeValue = item.IsPublic.ToString();
                tree.parentId       = item.ParentId;
                TreeList.Add(tree);
            }
            return(Content(TreeList.TreeToJson()));
        }
Beispiel #18
0
        public ActionResult TreeJson()
        {
            DataTable             dt       = departmentbll.GetTree(DepartmentRe);
            List <TreeJsonEntity> TreeList = new List <TreeJsonEntity>();

            if (!DataHelper.IsExistRows(dt))
            {
                foreach (DataRow row in dt.Rows)
                {
                    string    DepartmentId = row["departmentid"].ToString();
                    bool      hasChildren  = false;
                    DataTable childnode    = DataHelper.GetNewDataTable(dt, "parentid='" + DepartmentId + "'");
                    if (childnode.Rows.Count > 0)
                    {
                        hasChildren = true;
                    }
                    TreeJsonEntity tree = new TreeJsonEntity();
                    tree.id          = DepartmentId;
                    tree.text        = row["DepartmentName"].ToString();
                    tree.value       = row["departmentid"].ToString();
                    tree.parentId    = row["parentid"].ToString();
                    tree.isexpand    = true;
                    tree.complete    = true;
                    tree.hasChildren = hasChildren;
                    if (row["parentid"].ToString() == "0")
                    {
                        //tree.img = "/Content/Images/Icon16/molecule.png";
                        tree.img = "/Scripts/tree/images/icons/hostname.png";
                    }
                    else if (row["parentid"].ToString() == "-1")
                    {
                        tree.img = "/Scripts/tree/images/icons/molecule.png";
                    }
                    else
                    {
                        tree.img = "/Scripts/tree/images/icons/chart_organisation.png";
                    }
                    //else if (row["sort"].ToString() == "Company")
                    //{
                    //    tree.img = "/Content/Images/Icon16/hostname.png";
                    //}
                    //else if (row["sort"].ToString() == "Department")
                    //{
                    //    tree.img = "/Content/Images/Icon16/chart_organisation.png";
                    //}
                    TreeList.Add(tree);
                }
            }
            return(Content(TreeList.TreeToJson()));
        }
Beispiel #19
0
        /// <summary>
        /// 返回 树JONS
        /// </summary>
        /// <returns></returns>
        public ActionResult TreeJson(string Number)
        {
            IDatabase database = DataFactory.Database();
            string    sql      = "select Number,CollectorCode from Am_Collector where 1=1";

            //用户限定
            if (ManageProvider.Provider.Current().DepartmentId == "运营商")
            {
                sql += " and UNumber = '" + ManageProvider.Provider.Current().CompanyId + "'";
            }
            if (!StringHelper.IsNullOrEmpty(Number))
            {
                sql += " and Collector_Number = '" + Number + "'";
            }
            var list = database.FindListBySql <Am_Collector>(sql);
            List <TreeJsonEntity> TreeList = new List <TreeJsonEntity>();
            TreeJsonEntity        tree     = new TreeJsonEntity();

            tree.id             = "";
            tree.text           = "所有采集器";
            tree.parentId       = "0";
            tree.Attribute      = "Type";
            tree.AttributeValue = "Parent";
            tree.isexpand       = true;
            tree.complete       = true;
            tree.hasChildren    = true;
            tree.img            = "/Content/Images/Icon16/folder.png";
            TreeList.Add(tree);
            foreach (var item in list)
            {
                if (item != null)
                {
                    TreeJsonEntity tree1 = new TreeJsonEntity();
                    tree1.id             = item.Number;
                    tree1.text           = item.CollectorCode;
                    tree1.parentId       = "";
                    tree1.Attribute      = "Type";
                    tree1.AttributeValue = "Collector";
                    tree1.isexpand       = true;
                    tree1.complete       = true;
                    tree1.hasChildren    = false;
                    tree1.img            = "/Content/Images/Icon16/report.png";
                    TreeList.Add(tree1);
                }
            }
            return(Content(TreeList.TreeToJson()));
        }
        /// <summary>
        /// 返回 商户、店铺Json树
        /// </summary>
        /// <returns></returns>
        public ActionResult TreeJson()
        {
            DataTable             dt       = _mallBll.GetTree();
            List <TreeJsonEntity> TreeList = new List <TreeJsonEntity>();

            if (!DataHelper.IsExistRows(dt))
            {
                foreach (DataRow row in dt.Rows)
                {
                    string    MallId      = row["MallId"].ToString();
                    bool      hasChildren = false;
                    DataTable childnode   = DataHelper.GetNewDataTable(dt, "MallId='" + MallId + "'");
                    if (childnode.Rows.Count > 0)
                    {
                        hasChildren = true;
                    }
                    TreeJsonEntity tree = new TreeJsonEntity();
                    tree.id              = MallId;
                    tree.text            = row["MallName"].ToString();
                    tree.value           = row["Code"].ToString();
                    tree.parentId        = row["ParentId"].ToString();
                    tree.Attribute       = "Type";
                    tree.AttributeValue  = row["Sort"].ToString();
                    tree.AttributeA      = "MerchantId";
                    tree.AttributeValueA = row["MerchantId"].ToString();
                    tree.isexpand        = true;
                    tree.complete        = true;
                    tree.hasChildren     = hasChildren;
                    if (row["ParentId"].ToString() == "0")
                    {
                        tree.img = "/Content/Images/Icon16/basket_shopping.png";
                    }
                    else if (row["sort"].ToString() == "Merchant")
                    {
                        tree.img = "/Content/Images/Icon16/basket_shopping.png";
                    }
                    else if (row["sort"].ToString() == "Mall")
                    {
                        tree.img = "/Content/Images/Icon16/chart_organisation.png";
                    }
                    TreeList.Add(tree);
                }
            }
            return(Content(TreeList.TreeToJson()));
        }
        /// <summary>
        /// 返回 商户、分类Json树
        /// </summary>
        /// <returns></returns>
        public ActionResult TreeJson()
        {
            DataTable             dt       = _productCategoryBLL.GetTree();
            List <TreeJsonEntity> treeList = new List <TreeJsonEntity>();

            TreeJsonEntity rootNode = new TreeJsonEntity();

            rootNode.id          = "0";
            rootNode.text        = "全部";
            rootNode.value       = "0";
            rootNode.parentId    = "-1";
            rootNode.isexpand    = true;
            rootNode.complete    = true;
            rootNode.hasChildren = true;
            rootNode.img         = "/Content/Images/Icon16/chart_organisation.png";

            treeList.Add(rootNode);

            if (!DataHelper.IsExistRows(dt))
            {
                foreach (DataRow row in dt.Rows)
                {
                    string    categoryId  = row["CategoryId"].ToString();
                    bool      hasChildren = false;
                    DataTable childnode   = DataHelper.GetNewDataTable(dt, "ParentId='" + categoryId + "'");
                    if (childnode.Rows.Count > 0)
                    {
                        hasChildren = true;
                    }
                    TreeJsonEntity tree = new TreeJsonEntity();
                    tree.id          = categoryId;
                    tree.text        = row["CategoryName"].ToString();
                    tree.value       = row["Code"].ToString();
                    tree.parentId    = row["ParentId"].ToString();
                    tree.isexpand    = true;
                    tree.complete    = true;
                    tree.hasChildren = hasChildren;
                    tree.img         = "/Content/Images/Icon16/chart_organisation.png";

                    treeList.Add(tree);
                }
            }
            return(Content(treeList.TreeToJson("-1")));
        }
        /// <summary>
        /// 根据分类Id》获取数据字典明显列表(返回树JSON)
        /// </summary>
        /// <param name="DataDictionaryId">分类主键</param>
        /// <returns></returns>
        public ActionResult DataDictionaryDetailJson(string DataDictionaryId)
        {
            List <Base_DataDictionaryDetail> list     = base_datadictionarybll.GetDataDictionaryDetailList(DataDictionaryId);
            List <TreeJsonEntity>            TreeList = new List <TreeJsonEntity>();

            foreach (Base_DataDictionaryDetail item in list)
            {
                TreeJsonEntity tree = new TreeJsonEntity();
                tree.id          = item.DataDictionaryDetailId;
                tree.text        = item.FullName;
                tree.value       = item.Code;
                tree.isexpand    = true;
                tree.complete    = true;
                tree.hasChildren = false;
                tree.parentId    = item.ParentId;
                TreeList.Add(tree);
            }
            return(Content(TreeList.TreeToJson()));
        }
Beispiel #23
0
        /// <summary>
        /// 返回 树JONS
        /// </summary>
        /// <returns></returns>
        public ActionResult TreeJson(string Number)
        {
            IDatabase database = DataFactory.Database();
            string    sql      = "select Number,Name,ClassPic,ParenNumber,ParenName,ClassOrder,ClassUrl,StatusStr,Status,Remark from Fx_NewsClass where 1=1";

            if (!StringHelper.IsNullOrEmpty(Number))
            {
                sql += " and ParenNumber = '" + Number + "'";
            }
            var list = database.FindListBySql <Fx_NewsClass>(sql);
            List <TreeJsonEntity> TreeList = new List <TreeJsonEntity>();
            TreeJsonEntity        tree     = new TreeJsonEntity();

            tree.id             = "x999";
            tree.text           = "根栏目";
            tree.parentId       = "0";
            tree.Attribute      = "Type";
            tree.AttributeValue = "Parent";
            tree.isexpand       = true;
            tree.complete       = true;
            tree.hasChildren    = true;
            tree.img            = "/Content/Images/Icon16/folder.png";
            TreeList.Add(tree);
            foreach (var item in list)
            {
                if (item != null)
                {
                    TreeJsonEntity tree1 = new TreeJsonEntity();
                    tree1.id             = item.Number;
                    tree1.text           = item.Name;
                    tree1.parentId       = item.ParenNumber == "0"? "x999" : item.ParenNumber;
                    tree1.Attribute      = "Type";
                    tree1.AttributeValue = "NewsClass";
                    tree1.isexpand       = true;
                    tree1.complete       = true;
                    tree1.hasChildren    = item.IsHasChild == 0 ? false : true; //0为没有,其他则有
                    tree1.img            = "/Content/Images/Icon16/report.png";
                    TreeList.Add(tree1);
                }
            }
            return(Content(TreeList.TreeToJson()));
        }
        /// <summary>
        /// 加载模块目录
        /// </summary>
        /// <returns></returns>
        public ActionResult TreeJson()
        {
            List <Base_Module>    list     = _baseModulebll.GetList();
            List <TreeJsonEntity> TreeList = new List <TreeJsonEntity>();

            foreach (Base_Module item in list)
            {
                string             ModuleId    = item.ModuleId;
                bool               hasChildren = false;
                List <Base_Module> childnode   = list.FindAll(t => t.ParentId == ModuleId);
                if (childnode.Count > 0)
                {
                    hasChildren = true;
                }
                else
                {
                    if (item.Category == "目录")
                    {
                        continue;
                    }
                }
                if (item.Category == "页面")
                {
                    if (item.AllowButton != 1)
                    {
                        continue;
                    }
                }
                TreeJsonEntity tree = new TreeJsonEntity();
                tree.id          = ModuleId;
                tree.text        = item.FullName;
                tree.value       = ModuleId;
                tree.isexpand    = true;
                tree.complete    = true;
                tree.hasChildren = hasChildren;
                tree.parentId    = item.ParentId;
                tree.img         = item.Icon != null ? "/Content/Images/Icon16/" + item.Icon : item.Icon;
                TreeList.Add(tree);
            }
            return(Content(TreeList.TreeToJson()));
        }
Beispiel #25
0
        /// <summary>
        /// 配送商管理返回树Json
        /// </summary>
        /// <returns></returns>
        public ActionResult TreeJson()
        {
            List <ShipVendorEntity> list     = _shipVendorBll.GetList();
            List <TreeJsonEntity>   treeList = new List <TreeJsonEntity>();

            foreach (ShipVendorEntity item in list)
            {
                TreeJsonEntity tree = new TreeJsonEntity();
                tree.id             = item.ShipVendorId;
                tree.text           = item.FullName;
                tree.value          = item.ShipVendorId;
                tree.Attribute      = "Code";
                tree.AttributeValue = item.Code;
                tree.isexpand       = true;
                tree.complete       = true;
                tree.hasChildren    = false;
                tree.parentId       = "0";
                tree.img            = "/Content/Images/Icon16/account_balances.png";
                treeList.Add(tree);
            }
            return(Content(treeList.TreeToJson()));
        }
Beispiel #26
0
        /// <summary>
        /// 加载模块 返回树JSON
        /// </summary>
        /// <param name="objectId">对象主键</param>
        /// <param name="category">对象分类:1-部门2-角色</param>
        /// <returns></returns>
        public ActionResult ModuleTree(string objectId, string category)
        {
            DataTable             dt       = _baseModulepermissionbll.GetList(objectId, category);
            List <TreeJsonEntity> treeList = new List <TreeJsonEntity>();

            if (!DataHelper.IsExistRows(dt))
            {
                foreach (DataRow item in dt.Rows)
                {
                    string    moduleId    = item["moduleid"].ToString();
                    bool      hasChildren = false;
                    DataTable childnode   = DataHelper.GetNewDataTable(dt, "ParentId = '" + moduleId + "'");
                    if (childnode.Rows.Count > 0)
                    {
                        hasChildren = true;
                    }
                    var tree = new TreeJsonEntity
                    {
                        id          = item["moduleid"].ToString(),
                        text        = item["fullname"].ToString(),
                        value       = item["moduleid"].ToString(),
                        checkstate  = item["objectid"].ToString() != "" ? 1 : 0,
                        showcheck   = true,
                        isexpand    = true,
                        complete    = true,
                        hasChildren = hasChildren,
                        parentId    = item["parentid"].ToString(),
                        img         =
                            item["icon"].ToString() != string.Empty
                                ? "/Content/Images/Icon16/" + item["icon"].ToString()
                                : item["icon"].ToString()
                    };
                    treeList.Add(tree);
                }
            }
            return(Content(treeList.TreeToJson()));
        }
        /// <summary>
        /// 返回仓库列表树
        /// </summary>
        /// <returns></returns>
        public ActionResult TreeJson()
        {
            var list     = _warehouseBLL.GetList();
            var treeList = new List <TreeJsonEntity>();

            var tree = new TreeJsonEntity();

            tree.id          = "1";
            tree.text        = "全部";
            tree.value       = "";
            tree.parentId    = "0";
            tree.isexpand    = true;
            tree.complete    = true;
            tree.hasChildren = true;
            tree.img         = "/Content/Images/Icon16/basket_shopping.png";
            treeList.Add(tree);

            foreach (WarehouseEntity entity in list)
            {
                var node = new TreeJsonEntity
                {
                    id          = entity.WarehouseId,
                    text        = entity.WarehouseName,
                    value       = entity.WarehouseId,
                    parentId    = "1",
                    isexpand    = true,
                    complete    = true,
                    hasChildren = false,
                    img         = "/Content/Images/Icon16/basket_shopping.png"
                };

                treeList.Add(node);
            }

            return(Content(treeList.TreeToJson()));
        }
        /// <summary>
        /// 单据打印项
        /// </summary>
        /// <returns></returns>
        public ActionResult PrintItemTree(string templateId)
        {
            var senderItems = new Dictionary <string, string>
            {
                { "$SenderName", "发件人姓名" },
                { "$SenderPhone", "发件人电话" },
                { "$SenderCellPhone", "发件人手机号" },
                { "$MallName", "店铺名称" },
                { "$SenderProvince", "发件人-省" },
                { "$SenderCity", "发件人-市" },
                { "$SenderContry", "发件人-区" },
                { "$SenderAddress", "发件人地址" },
                { "$SenderZipCode", "发件人邮编" }
            };

            var receiverItems = new Dictionary <string, string>
            {
                { "$ReceiverName", "收件人姓名" },
                { "$ReceiverPhone", "收件人电话" },
                { "$ReceiverCellPhone", "收件人手机号" },
                { "$ReceiverProvince", "收件人-省" },
                { "$ReceiverCity", "收件人-市" },
                { "$ReceiverContry", "收件人-区" },
                { "$ReceiverAddress", "收件人地址" },
                { "$ReceiverZipCode", "收件人邮编" }
            };

            var orderItems = new Dictionary <string, string>
            {
                { "$OrderNo", "订单编号" },
                { "$OrderItmes", "物品数量" },
                { "$Remark", "派件备注" },
                { "$Select", "√" },
                { "$CustomContent", "自定义内容" }
            };

            List <TreeJsonEntity> treeList = new List <TreeJsonEntity>();

            TreeJsonEntity senderNode = new TreeJsonEntity
            {
                id          = "Sender",
                text        = "发件人信息",
                value       = "",
                parentId    = "0",
                isexpand    = true,
                complete    = true,
                hasChildren = true,
                showcheck   = false,
                img         = "/Content/Images/Icon16/basket_shopping.png"
            };

            treeList.Add(senderNode);

            treeList.AddRange(senderItems.Select(entity => new TreeJsonEntity
            {
                id          = entity.Key,
                text        = entity.Value,
                value       = entity.Value,
                parentId    = "Sender",
                isexpand    = true,
                showcheck   = true,
                complete    = true,
                hasChildren = false,
                img         = "/Content/Images/Icon16/basket_shopping.png"
            }));

            TreeJsonEntity receiverNode = new TreeJsonEntity
            {
                id          = "Receiver",
                text        = "收件人信息",
                value       = "",
                parentId    = "0",
                isexpand    = true,
                complete    = true,
                hasChildren = true,
                showcheck   = false,
                img         = "/Content/Images/Icon16/basket_shopping.png"
            };

            treeList.Add(receiverNode);

            treeList.AddRange(receiverItems.Select(entity => new TreeJsonEntity
            {
                id          = entity.Key,
                text        = entity.Value,
                value       = entity.Value,
                parentId    = "Receiver",
                isexpand    = true,
                showcheck   = true,
                complete    = true,
                hasChildren = false,
                img         = "/Content/Images/Icon16/basket_shopping.png"
            }));

            var orderNode = new TreeJsonEntity
            {
                id          = "Order",
                text        = "订单信息",
                value       = "",
                parentId    = "0",
                isexpand    = true,
                complete    = true,
                hasChildren = true,
                showcheck   = false,
                img         = "/Content/Images/Icon16/basket_shopping.png"
            };

            treeList.Add(orderNode);

            treeList.AddRange(orderItems.Select(entity => new TreeJsonEntity
            {
                id          = entity.Key,
                text        = entity.Value,
                value       = entity.Value,
                parentId    = "Order",
                isexpand    = true,
                showcheck   = true,
                complete    = true,
                hasChildren = false,
                img         = "/Content/Images/Icon16/basket_shopping.png"
            }));

            ShipTypeTemplateEntity template = _templateBLL.GetTemplate(templateId);

            if (template != null)
            {
                foreach (TreeJsonEntity treeJsonEntity in treeList)
                {
                    if (template.TemplateContent.IndexOf(treeJsonEntity.id, StringComparison.InvariantCultureIgnoreCase) != -1)
                    {
                        treeJsonEntity.checkstate = 1;
                    }
                }
            }
            return(Content(treeList.TreeToJson()));
        }
    public void LoadAction()
    {
        Response.Buffer = true;
        Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
        Response.Expires = 0;
        Response.CacheControl = "no-cache";
        Response.AddHeader("Pragma", "No-Cache");

        string active = HttpContext.Current.Request["action"];                                          //提交类型
        string ModuleId = HttpContext.Current.Request["ModuleId"];
        MenuModel model = new MenuDal();
        string strWhere = "";
        switch (active)
        {
            case "LoadAccordionMenu":   //加载手风琴菜单
                StringBuilder sb_html = new StringBuilder();
                try
                {
                    if (this.Session["User"] != null)
                    {
                        string power = ((UserModel)this.Session["User"]).Power;
                        if (power != "")
                        {
                            if (((UserModel)this.Session["User"]).UserName != "admin")
                            {
                                strWhere = "patindex('%|'||rtrim(PowerCode)||'|%','|" + power + "|')>0 or ISCHECKPOWER='0'";
                            }
                        }
                    }
                    this.dbo = new DB_OPT();
                    this.dbo.Open();
                    DataTable dt = model.GetList(strWhere, dbo).Tables[0];
                    DataRow[] rows = dt.Select("Grade='0' and IsShow='1'");
                    foreach (DataRow dr in rows)
                    {

                        sb_html.Append("<li title=" + dr["MENUNAME"] + ">");
                        sb_html.Append("<div class=\"link\">");
                        sb_html.Append("<img src=" + dr["IMGURL"] + ">&nbsp;&nbsp;<span>" + dr["MENUNAME"] + "</span><i class=\"chevron-down\"></i>");
                        sb_html.Append("</div>");
                        sb_html.Append("<div id=\"" + dr["MEMUPK"].ToString().Trim() + "\" class=\"submenu bottomline\"></div>");
                        sb_html.Append("</li>");
                    }
                }
                catch (Exception exception)
                {
                    this.el = new ExceptionLog.ExceptionLog();
                    this.el.ErrClassName = base.GetType().ToString();
                    this.el.ErrMessage = exception.Message.ToString();
                    this.el.ErrMethod = "Page_Load()";
                    this.el.WriteExceptionLog(true);
                    PageShowText.OpenErrorPage("获取数据失败,请联系管理员!", this.Page);
                }
                finally
                {
                    if (this.dbo != null)
                    {
                        this.dbo.Close();
                    }
                }
                Response.Write(sb_html.ToString());
                Response.End();
                break;
            case "LoadTreeMenu":        //加载子树菜单
                if (this.Session["User"] != null)
                {
                    string power = ((UserModel)this.Session["User"]).Power;
                    if (power != "")
                    {
                        if (((UserModel)this.Session["User"]).UserName != "admin")
                        {
                            strWhere = "patindex('%|'||rtrim(PowerCode)||'|%','|" + power + "|')>0 or ISCHECKPOWER='0'";
                        }
                    }
                }
                this.dbo = new DB_OPT();
                this.dbo.Open();
                DataTable submenu_dt = model.GetList(strWhere, dbo).Tables[0];
                DataRow[] submenu_rows = submenu_dt.Select("IsShow='1'");
                List<TreeJsonEntity> TreeList = new List<TreeJsonEntity>();
                foreach (DataRow dr in submenu_rows)
                {
                    TreeJsonEntity tree = new TreeJsonEntity();
                    bool hasChildren = false;
                    DataRow[] childnode = submenu_dt.Select("FatherPK='" + dr["MEMUPK"].ToString() + "'");
                    if (childnode.Length > 0)
                    {
                        hasChildren = true;
                    }
                    tree.id = dr["MEMUPK"].ToString().Trim();
                    tree.text = dr["MENUNAME"].ToString();
                    tree.value = dr["MEMUPK"].ToString().Trim();
                    tree.title = dr["PAGEURL"].ToString().Trim();
                    tree.img = dr["IMGURL"].ToString().Trim();
                    tree.isexpand = false;
                    tree.complete = true;
                    tree.hasChildren = hasChildren;
                    tree.parentId = dr["FATHERPK"].ToString();
                    TreeList.Add(tree);
                }
                string str = TreeList.TreeToJson(ModuleId).Trim();
                Response.Write(TreeList.TreeToJson(ModuleId).Trim());
                Response.End();
                break;
            default:
                break;
        }
    }
Beispiel #30
0
        /// <summary>
        /// 加载岗位
        /// <param name="ObjectId">对象主键</param>
        /// <param name="Category">对象分类:1-部门2-角色</param>
        /// </summary>
        /// <returns></returns>
        public ActionResult ScopeUserList(string ObjectId, string Category)
        {
            string                moduleId = "58e86c4c-8022-4d30-95d5-b3d0eedcc878";
            DataTable             dataList = _baseDatascopepermissionbll.GetScopeUserList(moduleId, ObjectId, Category);
            List <TreeJsonEntity> treeList = new List <TreeJsonEntity>();

            if (!DataHelper.IsExistRows(dataList))
            {
                foreach (DataRow row in dataList.Rows)
                {
                    TreeJsonEntity tree        = new TreeJsonEntity();
                    string         postId      = row["id"].ToString();
                    bool           hasChildren = false;
                    DataTable      childnode   = DataHelper.GetNewDataTable(dataList, "parentid='" + postId + "'");
                    if (childnode.Rows.Count > 0)
                    {
                        hasChildren = true;
                    }
                    else
                    {
                        if (row["sort"].ToString() == "Company" || row["sort"].ToString() == "Department")
                        {
                            continue;
                        }
                    }
                    if (row["parentid"].ToString() != "0")
                    {
                        tree.checkstate = row["objectid"].ToString() != "" ? 1 : 0;
                        tree.showcheck  = true;
                    }
                    tree.id          = postId;
                    tree.text        = row["fullname"].ToString();
                    tree.value       = row["code"].ToString();
                    tree.parentId    = row["parentid"].ToString();
                    tree.isexpand    = true;
                    tree.complete    = true;
                    tree.hasChildren = hasChildren;
                    if (row["parentid"].ToString() == "0")
                    {
                        tree.img = "/Content/Images/Icon16/molecule.png";
                    }
                    else if (row["sort"].ToString() == "Company")
                    {
                        tree.img = "/Content/Images/Icon16/hostname.png";
                    }
                    else if (row["sort"].ToString() == "Department")
                    {
                        tree.img = "/Content/Images/Icon16/chart_organisation.png";
                    }
                    else if (row["sort"].ToString() == "User")
                    {
                        if (row["gender"].ToString() == "男")
                        {
                            tree.img = "/Content/Images/Icon16/user_green.png";
                        }
                        else if (row["gender"].ToString() == "女")
                        {
                            tree.img = "/Content/Images/Icon16/user_female.png";
                        }
                    }
                    treeList.Add(tree);
                }
            }
            return(Content(treeList.TreeToJson()));
        }