Пример #1
0
        public List <TreeMode> GetMenuTreeByRoleId(string RoleId)
        {
            ISqlMapper NewMap = SqlMapper.Instance();

            NewMap.BeginTransaction();
            List <TreeMode> mTreeNode = new List <TreeMode>();

            try
            {
                Hashtable ht = new Hashtable();
                ht.Add("MenuType", "0");
                ht.Add("RoleId", RoleId);
                ht.Add("MenuParent", "");

                IList <MenuInfo> lmi = ExecuteQueryForListTrans <MenuInfo>("MenuInfo.SelectMenuInfoByRoleId", ht, NewMap);
                if (lmi != null && lmi.Count > 0)
                {
                    for (int i = 0; i < lmi.Count; i++)
                    {
                        TreeMode treeNode = new TreeMode("");
                        treeNode.id       = lmi[i].MenuId;
                        treeNode.text     = lmi[i].MenuName;
                        treeNode.icon     = lmi[i].MenuIcon;
                        treeNode.url      = lmi[i].MenuUrl;
                        treeNode.children = new List <TreeMode>();
                        mTreeNode.Add(treeNode);
                    }
                    for (int n = 0; n < mTreeNode.Count; n++)
                    {
                        ht["MenuType"]   = "1";
                        ht["MenuParent"] = mTreeNode[n].id;
                        IList <MenuInfo> lmic = ExecuteQueryForListTrans <MenuInfo>("MenuInfo.SelectMenuChildByRoleId", ht, NewMap);
                        if (lmic != null && lmic.Count > 0)
                        {
                            for (int m = 0; m < lmic.Count; m++)
                            {
                                TreeMode treeNode = new TreeMode("");
                                treeNode.id   = lmic[m].MenuId;
                                treeNode.text = lmic[m].MenuName;
                                treeNode.icon = lmic[m].MenuIcon;
                                treeNode.url  = lmic[m].MenuUrl;
                                mTreeNode[n].children.Add(treeNode);
                            }
                        }
                    }
                    NewMap.CommitTransaction();
                    return(mTreeNode);
                }
                else
                {
                    NewMap.RollBackTransaction();
                    return(mTreeNode);
                }
            }
            catch (Exception e)
            {
                NewMap.RollBackTransaction();
                return(mTreeNode);
            }
        }
Пример #2
0
        private TreeMode CreateTreeNode(System.Data.DataTable dt, System.Data.DataRow dr)
        {
            TreeMode p_node = new TreeMode("");

            p_node.id   = dr["id"].ToString();
            p_node.text = dr["name"].ToString();
            p_node.icon = dr["icon"].ToString();
            p_node.url  = dr["url"].ToString();
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (System.Data.DataRow r in dt.Rows)
                {
                    if (r["pid"].ToString() == dr["id"].ToString())
                    {
                        TreeMode _p_node = new TreeMode("");

                        _p_node.id   = r["id"].ToString();
                        _p_node.text = r["name"].ToString();
                        _p_node.icon = r["icon"].ToString();
                        _p_node.url  = r["url"].ToString();

                        if (p_node.children == null)
                        {
                            p_node.children = new List <TreeMode>();
                        }

                        p_node.children.Add(_p_node);
                    }
                }
            }

            return(p_node);
        }
Пример #3
0
        public ActionResult GetNotSelMenu(string RoleId)
        {
            UserInfo user = new UserInfo();

            user = (UserInfo)Session["LoginUser"];
            List <TreeMode> TreeNode = new List <TreeMode>();

            List <MenuInfo> dep = new List <MenuInfo>();

            if (user != null)
            {
                dep = notSelMenuViewBll.GetMenuViewListByUser(user);
            }
            if (dep != null)
            {
                foreach (MenuInfo DepartmentObj in dep)
                {
                    TreeNode.Add(TreeMode.CreateMenu(DepartmentObj));
                }
            }
            return(Json(TreeNode, JsonRequestBehavior.AllowGet));
        }
Пример #4
0
 public MultiTreeView()
 {
     InitializeComponent();
     cbxtv.ItemsSource = TreeMode.CreateModels();
 }
 public static Func <ViewModelBase, bool> ModeFilter(TreeMode treeMode)
 {
     return(t => true);
 }
Пример #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="response"></param>
 /// <returns></returns>
 public virtual IActionResult ResponseOk(TreeMode <T> .Response response)
 {
     return(Ok(response));
 }
Пример #7
0
 /// <summary>
 /// Get TreeView
 /// </summary>
 /// <remarks>
 /// Retrieves a folder list structure tailored for TreeView navigation - used by clients
 /// to create folder trees for specific operations.
 /// This operation will enforce a specific $select and $expand operators. You can provide
 /// additional $expand, for example Children, which is not added by default. The $select
 /// operator will apply to the expanded objects as well. You can also specify additional
 /// $select elements.
 /// </remarks>
 /// <param name="url"></param>
 /// <param name="treeMode"></param>
 /// <param name="sourceId"></param>
 /// <param name="canCreateRootFolder"></param>
 /// <param name="fileBox"></param>
 /// <returns>
 /// A tree root element.
 /// </returns>
 public IQuery<Item> Get(Uri url, TreeMode treeMode, string sourceId, bool canCreateRootFolder = false, bool fileBox = false)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Item>(Client);
     sfApiQuery.Uri(url);
     sfApiQuery.QueryString("treeMode", treeMode);
     sfApiQuery.QueryString("sourceId", sourceId);
     sfApiQuery.QueryString("canCreateRootFolder", canCreateRootFolder);
     sfApiQuery.QueryString("fileBox", fileBox);
     sfApiQuery.HttpMethod = "GET";
     return sfApiQuery;
 }