Exemplo n.º 1
0
        /// <summary>
        /// 初始化当前操作的菜单或按钮对象
        /// </summary>
        /// <returns></returns>
        private Class_Permission IniCurrentPermission(int permission_id, int perssioninfo_id)
        {
            Class_Permission temp = new Class_Permission();

            if (perssioninfo_id != 0)
            {
                temp.Id                        = permission_id.ToString();
                temp.Perm_code                 = txtMenuCode.Text;
                temp.Perm_name                 = txtMenuName.Text;
                temp.Perm_kind                 = "1";
                temp.Permission_Info           = new Class_Permission_Info();
                temp.Permission_Info.DllName   = txtDllName.Text;
                temp.Permission_Info.Function  = txtFunctinName.Text;
                temp.Permission_Info.Perm_code = txtMenuCode.Text;
                temp.Permission_Info.Version   = txtVersion.Text;
            }
            else
            {
                temp.Id        = permission_id.ToString();
                temp.Perm_code = txtButtonCode.Text;
                temp.Perm_name = txtButtonName.Text;
                temp.Perm_kind = "2";
            }
            return(temp);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 删除结点
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripMenuItem4_Click(object sender, EventArgs e)
 {
     if (trvMenuOrButton.SelectedNode != null)
     {
         Class_Permission temp = (Class_Permission)trvMenuOrButton.SelectedNode.Tag;
         if (trvMenuOrButton.SelectedNode.Nodes.Count == 0)
         {
             App.ExecuteSQL("delete from t_permission where PERM_CODE='" + temp.Perm_code + "'");
             App.ExecuteSQL("delete from t_permission_fuctions where PERM_CODE='" + temp.Perm_code + "'");
             trvMenuOrButton.Nodes.Remove(trvMenuOrButton.SelectedNode);
         }
         else
         {
             if (App.Ask("该菜单下存在着子项,如果删除子项菜单将会无法使用,是否还要删除?"))
             {
                 App.ExecuteSQL("delete from t_permission where PERM_CODE='" + temp.Perm_code + "'");
                 App.ExecuteSQL("delete from t_permission_fuctions where PERM_CODE='" + temp.Perm_code + "'");
                 trvMenuOrButton.Nodes.Remove(trvMenuOrButton.SelectedNode);
             }
         }
         if (rbtnMenu.Checked)
         {
             RefleshGrid(1);
         }
         else
         {
             RefleshGrid(2);
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 添加主菜单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void 添加主ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CurrentPerssmion = null;
            string code = GenalMenuCode("");

            SYSTEMSET.frmPermissionSet_Info fm = new frmPermissionSet_Info(1, code, null);
            fm.ShowDialog();
            if (CurrentPerssmion != null)
            {
                TreeNode tn = new TreeNode();
                tn.Tag                = CurrentPerssmion;
                tn.Text               = CurrentPerssmion.Perm_name;
                tn.ImageIndex         = 0;
                tn.SelectedImageIndex = 0;
                trvMenuOrButton.Nodes.Add(tn);
                trvMenuOrButton.Refresh();
            }

            if (rbtnMenu.Checked)
            {
                RefleshGrid(1);
            }
            else
            {
                RefleshGrid(2);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 更新菜单树结点
        /// </summary>
        private void UpdateMenuTreeview()
        {
            trvMenuOrButton.Nodes.Clear();
            DataSet ds = App.GetDataSet("select * from t_permission where PERM_KIND='1' order by num asc");

            Class_Permission[] MenuPermissions = new Class_Permission[ds.Tables[0].Rows.Count];
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                //菜单项
                MenuPermissions[i]           = new Class_Permission();
                MenuPermissions[i].Id        = ds.Tables[0].Rows[i]["id"].ToString();
                MenuPermissions[i].Perm_code = ds.Tables[0].Rows[i]["PERM_CODE"].ToString();
                MenuPermissions[i].Perm_name = ds.Tables[0].Rows[i]["PERM_NAME"].ToString();
                MenuPermissions[i].Perm_kind = ds.Tables[0].Rows[i]["PERM_KIND"].ToString();
                MenuPermissions[i].Num       = ds.Tables[0].Rows[i]["NUM"].ToString();

                //菜单项详细信息
                MenuPermissions[i].Permission_Info = new Class_Permission_Info();
                DataSet dsinfo = App.GetDataSet("select * from t_permission_fuctions where PERM_CODE='" + MenuPermissions[i].Perm_code + "'");
                MenuPermissions[i].Permission_Info.Id            = Convert.ToInt32(dsinfo.Tables[0].Rows[0]["ID"]);
                MenuPermissions[i].Permission_Info.Perm_code     = dsinfo.Tables[0].Rows[0]["PERM_CODE"].ToString();
                MenuPermissions[i].Permission_Info.Function      = dsinfo.Tables[0].Rows[0]["FUNCTION"].ToString();
                MenuPermissions[i].Permission_Info.Version       = dsinfo.Tables[0].Rows[0]["VERSION"].ToString();
                MenuPermissions[i].Permission_Info.DllName       = dsinfo.Tables[0].Rows[0]["DLLNAME"].ToString();
                MenuPermissions[i].Permission_Info.Dll           = (byte[])dsinfo.Tables[0].Rows[0]["PERM_DLL"];
                MenuPermissions[i].Permission_Info.FunctionImage = (byte[])dsinfo.Tables[0].Rows[0]["FUNCTIONIMAGE"];
            }

            //刷新树结点
            IniMenuTreeview(MenuPermissions, trvMenuOrButton);
            for (int i = 0; i < trvMenuOrButton.Nodes.Count; i++)
            {
                IniMenuTrvNode(MenuPermissions, trvMenuOrButton.Nodes[i]);
            }
        }
Exemplo n.º 5
0
 public frmPermissionSet_Info(int type, string Code, Class_Permission perssion)
 {
     InitializeComponent();
     Type     = type;
     MenuCode = Code;
     App.ButtonStytle(this);
     CurrentPermission = perssion;
 }
Exemplo n.º 6
0
 private void trvMenuOrButton_MouseClick(object sender, MouseEventArgs e)
 {
     if (trvMenuOrButton.SelectedNode != null)
     {
         CurrentPerssmion = (Class_Permission)trvMenuOrButton.SelectedNode.Tag;
         if (rbtnMenu.Checked)
         {
             RefleshGrid(1);
         }
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// 添加按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripMenuItem2_Click(object sender, EventArgs e)
 {
     CurrentPerssmion = null;
     SYSTEMSET.frmPermissionSet_Info fm = new frmPermissionSet_Info(2, "", null);
     fm.ShowDialog();
     if (CurrentPerssmion != null)
     {
         TreeNode tn = new TreeNode();
         tn.Tag                = CurrentPerssmion;
         tn.Text               = CurrentPerssmion.Perm_name;
         tn.ImageIndex         = 1;
         tn.SelectedImageIndex = 1;
         trvMenuOrButton.Nodes.Add(tn);
     }
     RefleshGrid(2);
 }
Exemplo n.º 8
0
 /// <summary>
 /// 菜单节点的下移动
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void  移ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (trvMenuOrButton.SelectedNode != null)
     {
         Class_Permission Permission1 = (Class_Permission)trvMenuOrButton.SelectedNode.Tag;
         if (trvMenuOrButton.SelectedNode.NextNode != null)
         {
             Class_Permission Permission2 = (Class_Permission)trvMenuOrButton.SelectedNode.NextNode.Tag;
             App.ExecuteSQL("update t_permission set num=" + Permission1.Num + " where id=" + Permission2.Id + "");
             App.ExecuteSQL("update t_permission set num=" + Permission2.Num + " where id=" + Permission1.Id + "");
             string num = Permission1.Num;
             Permission1.Num = Permission2.Num;
             Permission2.Num = num;
             trvMenuOrButton.SelectedNode.Tag          = Permission1;
             trvMenuOrButton.SelectedNode.PrevNode.Tag = Permission2;
             App.TrvNodeMovDown(trvMenuOrButton.SelectedNode, trvMenuOrButton);
         }
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// 初始化菜单树子结点
        /// </summary>
        /// <param name="MenuPermissions">所有菜单项</param>
        /// <param name="tn">菜单树结点</param>
        private void IniMenuTrvNode(Class_Permission[] MenuPermissions, TreeNode tn)
        {
            Class_Permission tempPermission = (Class_Permission)tn.Tag;

            for (int i = 0; i < MenuPermissions.Length; i++)
            {
                if (MenuPermissions[i].Perm_code.Length == tempPermission.Perm_code.Length + 2 &&
                    MenuPermissions[i].Perm_code.Contains(tempPermission.Perm_code))
                {
                    TreeNode tempnode = new TreeNode();
                    tempnode.Tag                = MenuPermissions[i];
                    tempnode.Text               = MenuPermissions[i].Perm_name;
                    tempnode.ImageIndex         = 0;
                    tempnode.SelectedImageIndex = 0;
                    IniMenuTrvNode(MenuPermissions, tempnode);
                    tn.Nodes.Add(tempnode);
                }
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// 对结点进行修改操作
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void trvMenuOrButton_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (trvMenuOrButton.SelectedNode != null)
     {
         CurrentPerssmion = null;
         Class_Permission Temp = (Class_Permission)trvMenuOrButton.SelectedNode.Tag;
         int Type = 1;
         if (rbtnButton.Checked)
         {
             Type = 2;
         }
         frmPermissionSet_Info fm = new frmPermissionSet_Info(Type, "", Temp);
         fm.ShowDialog();
         if (CurrentPerssmion != null)
         {
             trvMenuOrButton.SelectedNode.Tag  = CurrentPerssmion;
             trvMenuOrButton.SelectedNode.Text = CurrentPerssmion.Perm_name;
         }
     }
 }
Exemplo n.º 11
0
 /// <summary>
 /// 添加子菜单
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void 添加子菜单ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (trvMenuOrButton.SelectedNode != null)
     {
         CurrentPerssmion = null;
         Class_Permission temppermission    = (Class_Permission)trvMenuOrButton.SelectedNode.Tag;
         SYSTEMSET.frmPermissionSet_Info fm = new frmPermissionSet_Info(1, GenalMenuCode(temppermission.Perm_code), null);
         fm.ShowDialog();
         if (CurrentPerssmion != null)
         {
             TreeNode tn = new TreeNode();
             tn.Tag                = CurrentPerssmion;
             tn.Text               = CurrentPerssmion.Perm_name;
             tn.ImageIndex         = 0;
             tn.SelectedImageIndex = 0;
             trvMenuOrButton.SelectedNode.Nodes.Add(tn);
         }
         RefleshGrid(1);
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// 更新按钮树结点
        /// </summary>
        private void UpdateButtonTreeview()
        {
            trvMenuOrButton.Nodes.Clear();
            DataSet ds = App.GetDataSet("select * from t_permission where PERM_KIND='2'");

            Class_Permission[] btnPermissions = new Class_Permission[ds.Tables[0].Rows.Count];
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                btnPermissions[i]           = new Class_Permission();
                btnPermissions[i].Id        = ds.Tables[0].Rows[i]["id"].ToString();
                btnPermissions[i].Perm_code = ds.Tables[0].Rows[i]["PERM_CODE"].ToString();
                btnPermissions[i].Perm_name = ds.Tables[0].Rows[i]["PERM_NAME"].ToString();
                btnPermissions[i].Perm_kind = ds.Tables[0].Rows[i]["PERM_KIND"].ToString();
                btnPermissions[i].Num       = ds.Tables[0].Rows[i]["NUM"].ToString();
                TreeNode tn = new TreeNode();
                tn.Tag                = btnPermissions[i];
                tn.Text               = btnPermissions[i].Perm_name;
                tn.ImageIndex         = 1;
                tn.SelectedImageIndex = 1;
                trvMenuOrButton.Nodes.Add(tn);
            }
        }