コード例 #1
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            RightUI.LoginForm LgFrm = new RightUI.LoginForm();
            if (DialogResult.OK == LgFrm.ShowDialog())
            {
                curUser = LgFrm.User;
                timer_LinkServer.Enabled = true;

                //模块权限判断
                if (!curUser.HavePermission(Permissions.TheaterManage))
                {
                    toolStripButton1.Enabled = false;
                }
                if (!curUser.HavePermission(Permissions.Schedules))
                {
                    toolStripButton2.Enabled = false;
                }
                if (!curUser.HavePermission(Permissions.FilmManage))
                {
                    toolStripButton3.Enabled = false;
                }
                if (!curUser.HavePermission(Permissions.TicketSelling))
                {
                    toolStripButton4.Enabled = false;
                }
                if (!curUser.HavePermission(Permissions.Report))
                {
                    toolStripButton5.Enabled = false;
                }
                if (!curUser.HavePermission(Permissions.VoucherManager))
                {
                    toolStripButton6.Enabled = false;
                }
                if (!curUser.HavePermission(Permissions.TemplateManager))
                {
                    toolStripButton7.Enabled = false;
                }
                if (!curUser.HavePermission(Permissions.EmployeeInformation))
                {
                    toolStripButton8.Enabled = false;
                }
                if (!curUser.HavePermission(Permissions.SeatingChat))
                {
                    toolStripButton9.Enabled = false;
                }
            }
            else
            {
                LgFrm.Close();
                LgFrm.Dispose();
                Close();
                Dispose();
            }
        }
コード例 #2
0
 private void DeleteUser_Click(object sender, EventArgs e)
 {
     if (UserListView.SelectedItems.Count == 0)
     {
         MessageBox.Show("请选择要删除的用户!");
     }
     else
     {
         Flamingo.Right.User user = UserListView.SelectedItems[0].Tag as Flamingo.Right.User;
         RoleObject          o    = RoleListBox.SelectedItem as RoleObject;
         user.DeleteRole(o.Role);
         Users.DefaultUsers.SaveUser(user, false, true);
         Users.DefaultUsers.DeleteUserPermissionByRole(user, o.Role.RoleId);
         InitButton(o.Role);
     }
 }