コード例 #1
0
        private void Edit_usergroup(object sender, EventArgs e)
        {
            if (grd_usergroup.SelectedCells.Count == 0)
            {
                MessageBox.Show("Select a usergroup to edit.");
                return;
            }

            DataGridViewRow grd_row       = grd_usergroup.Rows[grd_usergroup.SelectedCells[0].RowIndex];
            string          str_usergroup = grd_row.Cells["usergroup"].Value.ToString();

            // ADMINISTRATOR usergroup CANNOT be edited and removed
            if (str_usergroup.ToUpper() == "ADMINISTRATOR")
            {
                MessageBox.Show("ADMINISTRATOR usergroup cannot be edited or deleted.", "",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            Form_edit_usergroup form_edit = new Form_edit_usergroup(str_usergroup,
                                                                    grd_row.Cells["usergroup_desc"].Value.ToString());

            if (form_edit.ShowDialog() == DialogResult.OK)
            {
                Setup_grd_usergroup(form_edit.Usergroup);
            }
        }
コード例 #2
0
        private void Add_usergroup(object sender, EventArgs e)
        {
            Form_edit_usergroup form_edit = new Form_edit_usergroup();

            if (form_edit.ShowDialog() == DialogResult.OK)
            {
                Setup_grd_usergroup(form_edit.Usergroup);
            }
        }