Example #1
0
        /// <summary>
        /// 显示用户功能树
        /// </summary>
        public void ShowFunctionTree()
        {
            m_FunctionTree.Cursor = Cursors.WaitCursor;
            try
            {
                m_FunctionTree.Nodes.Clear();
                DataSet   ds       = SysTools.basicService.GetUserFunction();  //获取所有菜单
                DataRow[] RootRows = ds.Tables[0].Select("PARENTMENUNAME=''"); //获取所有根菜单

                foreach (DataRow row in RootRows)
                {
                    UserRoleItme rNode = new UserRoleItme(row);
                    rNode.MenuTreeRowInfo = row;
                    //rNode.Text = row["FunctionID"].ToString();
                    rNode.Text               = row["MENUNAME"].ToString();//菜单名
                    rNode.ImageIndex         = 0;
                    rNode.SelectedImageIndex = 1;
                    m_FunctionTree.Nodes.Add(rNode);
                    //rNode.Expand();
                    ShowChildMenu(rNode.Text, ds, rNode);    //显示子菜单
                }
            }
            catch (Exception e)
            {
                UserMessages.ShowErrorBox(e.Message);
            }
            finally
            {
                m_FunctionTree.Cursor = Cursors.Default;
            }
        }
Example #2
0
 private void IsSubNodeChecks(UserRoleItme SubNode, string strFunctionID)
 {
     foreach (UserRoleItme node in SubNode.Nodes)
     {
         string functionid = node.MENUID;
         if (functionid == strFunctionID)
         {
             node.Checked = true;
         }
         else
         {
         }
         IsSubNodeChecks(node, strFunctionID);
     }
 }
Example #3
0
 /// <summary>
 /// 显示子用户功能树
 /// </summary>
 /// <param name="p_strParentMenuName">父用户功能名称</param>
 /// <param name="p_ds">数据集</param>
 /// <param name="p_MenuNode">父用户功能</param>
 private void ShowChildMenu(string p_strParentMenuName, DataSet p_ds, TreeNode p_MenuNode)
 {
     DataRow[] rows = p_ds.Tables[0].Select("PARENTMENUNAME='" + p_strParentMenuName + "'");//获取指定父菜单下一级子菜单
     foreach (DataRow row in rows)
     {
         UserRoleItme cNode = new UserRoleItme(row);
         cNode.MenuTreeRowInfo = row;
         //cNode.Text = row["FunctionID"].ToString();
         cNode.Text               = row["MENUNAME"].ToString();
         cNode.ImageIndex         = 0;
         cNode.SelectedImageIndex = 1;
         p_MenuNode.Nodes.Add(cNode);
         cNode.Expand();
         ShowChildMenu(cNode.Text, p_ds, cNode);
     }
 }
Example #4
0
        private void AddHaveSubNodeChack(UserRoleItme SubNode, String strRoleID)
        {
            foreach (UserRoleItme node in SubNode.Nodes)
            {
                if (node.Checked)
                {
                    DataRow rv = dstUserRole.Tables["TCOM_ROLESMENU"].NewRow();
                    rv.BeginEdit();
                    rv["ROLEID"] = strRoleID;
                    rv["MENUID"] = node.MENUID;

                    rv.EndEdit();
                    dstUserRole.Tables["TCOM_ROLESMENU"].Rows.Add(rv);
                }
                else
                {
                }
                AddHaveSubNodeChack(node, strRoleID);
            }
        }