private void btnAddUser_Click(object sender, EventArgs e) { _allRoles.Clear(); var roleLists = RoleDao.FindAll(); foreach (var VARIABLE in roleLists) { _allRoles.Add(VARIABLE.RoleId, VARIABLE); } using (frmUserEdit f = new frmUserEdit(null, _allRoles)) { f.ShowDialog(); } DisplayUsers(); }
private void btnModifyUser_Click(object sender, EventArgs e) { var id = dgvUserTable.CurrentRow.Cells["id"].Value.ToString(); if (id.Equals("")) { Ui.MessageBoxMuti("没有用户被选中,无法修改"); } else { _allRoles.Clear(); var roleLists = RoleDao.FindAll(); foreach (var VARIABLE in roleLists) { _allRoles.Add(VARIABLE.RoleId, VARIABLE); } User user = UserDao.Find(int.Parse(id))[0]; using (frmUserEdit f = new frmUserEdit(user, _allRoles)) { f.ShowDialog(); } DisplayUsers(); } }