Beispiel #1
0
        private void buttonUserRight_Click(object sender, EventArgs e)
        {
            int nSelected = this.listViewUserList.SelectedItems.Count;

            if (nSelected > 0)
            {
                foreach (ListViewItem item in this.listViewUserList.SelectedItems)
                {
                    int           nID       = (int)item.Tag;
                    string        user      = item.SubItems[1].Text;
                    FormUserRight userRight = new FormUserRight();
                    userRight.SetData(user, 3);

                    DialogResult dlgResult = userRight.ShowDialog();
                    if (DialogResult.OK == dlgResult)
                    {
                        int nUserRight = userRight.UserRight;
                        int nRet       = userMge.SetUserRight(nID, nUserRight, m_nSession);
                        if (nRet == -5)
                        {
                            MessageBox.Show("Right limited, can not execuate command.");
                            return;
                        }
                    }
                }
                RefreshUserList();
            }
            else
            {
                MessageBox.Show("Please select a user.");
            }
        }
        private void buttonUserRight_Click(object sender, EventArgs e)
        {
            int nSelected = this.listViewUserList.SelectedItems.Count;
            if (nSelected > 0)
            {
                foreach (ListViewItem item in this.listViewUserList.SelectedItems)
                {
                    int nID = (int)item.Tag;
                    string user = item.SubItems[1].Text;
                    FormUserRight userRight = new FormUserRight();
                    userRight.SetData(user, 3);

                    DialogResult dlgResult = userRight.ShowDialog();
                    if (DialogResult.OK == dlgResult)
                    {
                        int nUserRight = userRight.UserRight;
                        int nRet = userMge.SetUserRight(nID, nUserRight, m_nSession);
                        if (nRet == -5)
                        {
                            MessageBox.Show("Right limited, can not execuate command.");
                            return;
                        }
                    }

                }
                RefreshUserList();
            }
            else
            {
                MessageBox.Show("Please select a user.");
            }
        }