private void gvVisitingEmployees_CellContentClick(object sender, DataGridViewCellEventArgs e) { errorLabel.Text = ""; if (e.ColumnIndex == gvVisitingEmployees.Columns[colVisitingDelete.Name].Index || e.ColumnIndex == gvVisitingEmployees.Columns[colVisitingEmployeeNumber.Name].Index) { int iRowIdx = e.RowIndex; string strUserId = Utilities.GetStringValue(gvVisitingEmployees.Rows[iRowIdx].Cells[colVisitingUserId.Name].Value); string strEmpName = Utilities.GetStringValue(gvVisitingEmployees.Rows[iRowIdx].Cells[colVisitingEmpName.Name].Value); string strEmpRole = Utilities.GetStringValue(gvVisitingEmployees.Rows[iRowIdx].Cells[colVisitingEmployeeRole.Name].Value); if (e.ColumnIndex == gvVisitingEmployees.Columns[colVisitingDelete.Name].Index) { if (MessageBox.Show(@"Are you sure you want to delete this employee profile?", "User Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { var sErrorCode = string.Empty; var sErrorText = string.Empty; bool retVal = SecurityProfileProcedures.DeleteEmployeeProfile(strUserId, "", _StoreNumber, _UserVO.UserName, GlobalDataAccessor.Instance.DesktopSession, out sErrorCode, out sErrorText); if (!retVal) { errorLabel.Text = sErrorText; } else { //Delete the employee row DataRow dr = _ShopVisitingEmployees.Rows.Find(strUserId); _ShopVisitingEmployees.Rows.Remove(dr); PopulateVisitingEmployees(); } } else { return; } } else { ROLEHIERARCHYLEVEL roleLevel = _UserVO.UserRole.CheckRoleHierarchy(strEmpRole); if (roleLevel == ROLEHIERARCHYLEVEL.GREATER) { GoToSecurityProfile(_StoreNumber, strEmpName); } else { MessageBox.Show(@"You cannot change the security profile for a user in an equal or higher role"); } } } }
private void gvShopEmployees_CellContentClick(object sender, DataGridViewCellEventArgs e) { errorLabel.Text = ""; if (gvShopEmployees != null) { if (e.ColumnIndex == gvShopEmployees.Columns[colShopEmployeeNumber.Name].Index) { int iRowIdx = e.RowIndex; //int iEmployeeNumber = Utilities.GetIntegerValue(gvShopEmployees.Rows[iRowIdx].Cells[colShopEmployeeNumber.Name].Value); string strEmpName = Utilities.GetStringValue(gvShopEmployees.Rows[iRowIdx].Cells[colShopEmpName.Name].Value); string strEmpRole = Utilities.GetStringValue(gvShopEmployees.Rows[iRowIdx].Cells[colShopEmployeeRole.Name].Value); ROLEHIERARCHYLEVEL roleLevel = _UserVO.UserRole.CheckRoleHierarchy(strEmpRole); if (roleLevel == ROLEHIERARCHYLEVEL.GREATER) { GoToSecurityProfile(_StoreNumber, strEmpName); } else { MessageBox.Show(@"You cannot change the security profile for a user in an equal or higher role"); } } } }