Пример #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                DDRole role = new DDRole("RoleName", treeRoles.SelectedNode.Text.Trim());

                Query queryDel = new Query(DDPermission.Schema);
                queryDel.AddWhere("RoleID", role.RoleID);
                queryDel.QueryType = QueryType.Delete;
                queryDel.Execute();

                TreeNode tempTreeNode;
                for (int i = 0; i < treeModules.Nodes[0].Nodes.Count; i++)
                {
                    tempTreeNode = treeModules.Nodes[0].Nodes[i];
                    for (int j = 0; j < tempTreeNode.Nodes.Count; j++)
                    {
                        if (tempTreeNode.Nodes[j].Checked == true)
                        {
                            DDModule     module     = new DDModule("ModuleName", tempTreeNode.Nodes[j].Text.Trim());
                            DDPermission permission = new DDPermission();
                            permission.RoleID   = role.RoleID;
                            permission.ModuleID = module.ModuleID;
                            permission.Save();
                        }
                    }
                }
                MessageBox.Show("更新成功!", "提示信息");
            }
            catch
            {
                MessageBox.Show("更新失败,请检查数据库是否连接正确!", "提示信息");
            }
        }
Пример #2
0
        public void Insert(int RoleID, int ModuleID, int?Flag)
        {
            DDPermission item = new DDPermission();

            item.RoleID = RoleID;

            item.ModuleID = ModuleID;

            item.Flag = Flag;


            item.Save(UserName);
        }
Пример #3
0
        public void Update(int RoleID, int ModuleID, int?Flag)
        {
            DDPermission item = new DDPermission();

            item.MarkOld();
            item.IsLoaded = true;

            item.RoleID = RoleID;

            item.ModuleID = ModuleID;

            item.Flag = Flag;

            item.Save(UserName);
        }
Пример #4
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (treeRoles.SelectedNode != null)
            {
                this.RoleNameRecord = treeRoles.SelectedNode.Text.Trim();
            }
            try
            {
                int    AmountLimit = Convert.ToInt32(tbxAmountLimit.Text);
                DDRole role        = new DDRole("RoleName", RoleNameRecord);
                role.AmountLimit = AmountLimit;
                role.RoleName    = tbxRoleName.Text;
                role.Save();

                Query queryDel = new Query(DDPermission.Schema);
                queryDel.AddWhere("RoleID", role.RoleID);
                queryDel.QueryType = QueryType.Delete;
                queryDel.Execute();

                TreeNode tempTreeNode;
                for (int i = 0; i < treeModules.Nodes[0].Nodes.Count; i++)
                {
                    tempTreeNode = treeModules.Nodes[0].Nodes[i];
                    for (int j = 0; j < tempTreeNode.Nodes.Count; j++)
                    {
                        if (tempTreeNode.Nodes[j].Checked == true)
                        {
                            DDModule     module     = new DDModule("ModuleName", tempTreeNode.Nodes[j].Text.Trim());
                            DDPermission permission = new DDPermission();
                            permission.RoleID   = role.RoleID;
                            permission.ModuleID = module.ModuleID;
                            permission.Save();
                        }
                    }
                }
                MessageBox.Show("更新成功!", "提示信息");
            }
            catch
            {
                MessageBox.Show("更新失败,请检查资金限额和数据库连接!", "提示信息");
            }
            InitRoles();
        }