private void btnNew_Click(object sender, EventArgs e) { CreateRole frmNewRole = new CreateRole(); frmNewRole.ShowDialog(); if (frmNewRole.success) { roleList = SelectRole(); FillDataGridView(dgvRoleView, roleList); } }
private void MIupdate_Click(object sender, EventArgs e) { if (dgvRoleView.SelectedRows.Count > 0) { int thisId = Convert.ToInt32(dgvRoleView.SelectedRows[0].Cells["Id"].Value.ToString()); Role thisRole = roleList.Where(i => i.Id == thisId).First(); CreateRole frmCreateRole = new CreateRole(thisRole); frmCreateRole.Text = "Edit Role"; frmCreateRole.ShowDialog(); if (frmCreateRole.success) { roleList[roleList.FindIndex(w => w.Id == thisId)] = frmCreateRole.newRoleRecord; FillDataGridView(dgvRoleView, roleList); } } }
private void createRoleToolStripMenuItem_Click(object sender, EventArgs e) { CreateRole frmNewRole = new CreateRole(); frmNewRole.ShowDialog(); }