Beispiel #1
0
        private void btnRoleModify_Click(object sender, EventArgs e)
        {
            var id = dgvRoleTable.CurrentRow.Cells["id"].Value.ToString();

            if (id.Equals(""))
            {
                Ui.MessageBoxMuti("没有角色被选中,无法修改");
            }
            else
            {
                Role role = RoleDao.Find(int.Parse(id))[0];
                using (frmRoleEdit f = new frmRoleEdit(role, _allRights))
                {
                    f.ShowDialog();
                }
                DisplayRoles();
            }
        }
Beispiel #2
0
        private void DisplayRoles()
        {
            DataTable roleDataTable = RoleDao.Find();

            dgvRoleTable.DataSource          = roleDataTable;
            dgvRoleTable.AutoGenerateColumns = true;
            dgvRoleTable.DataSource          = roleDataTable;
            //dgvRoleTable.Columns["RightsID"].Visible = false;
            dgvRoleTable.Columns["CreateID"].Visible       = false;
            dgvRoleTable.AutoSizeColumnsMode               = DataGridViewAutoSizeColumnsMode.Fill;
            dgvRoleTable.Columns["ID"].FillWeight          = 15;
            dgvRoleTable.Columns["Name"].FillWeight        = 25;
            dgvRoleTable.Columns["Description"].FillWeight = 40;
            dgvRoleTable.Columns["Status"].FillWeight      = 25;
            dgvRoleTable.Columns["CreateDate"].FillWeight  = 50;
            BindingSource bs = new BindingSource();

            bs.DataSource             = roleDataTable;
            bNRoleTable.BindingSource = bs;
            dgvRoleTable.DataSource   = bs;
        }