private void btn_Save_Click(object sender, EventArgs e) { try { //ma nhom,ma man hinh, quyen for (int i = 0; i < dGV_GrandRole.Rows.Count; i++) { string role = dGV_GrandRole.Rows[i].Cells[2].Value.ToString(); //Quyền string idScreen = dGV_GrandRole.Rows[i].Cells[0].Value.ToString(); //Mã màn hình string idGroupUser = dGV_GroupUser.CurrentRow.Cells[0].Value.ToString(); // //kiểm tra nếu quyền đã được cấp mà đã thu hồi thì Cập nhật lại quyền, ngược lại thì thêm vào. if (usr.CheckGrandRight(idGroupUser, idScreen) != 0) { if (role == string.Empty) { role = "0"; usr.UpdateRole(idGroupUser, idScreen, role); } else { usr.UpdateRole(idGroupUser, idScreen, role); } } else { usr.InsertRole(idGroupUser, idScreen, role); } // //Lúc này chỉ có 2 TH : T/F } XtraMessageBox.Show("Đã Lưu !"); } catch { XtraMessageBox.Show("Lưu Thất Bại!"); } }