private void GetGroupRoles(int groupID) { ADGroupRoleCollection _aDGroupRoleCollection = _aDGroupRoleWrapper.SelectByGroupID(groupID); foreach (ADGroupRole _aDGroupRole in _aDGroupRoleCollection) { for (int i = 0; i < dgrid_Roles.Rows.Count; i++) { CheckBox check = new CheckBox(); dgrid_Roles.Rows[i].Cells["Check"].Value = true; dgrid_Roles.RefreshEdit(); } //foreach (DataGridViewRow row in dgrid_Roles.Rows) //{ // if (Convert.ToInt32(row.Cells["RoleID"].Value) == _aDGroupRole.RoleID) // { // //(DataGridViewCheckBoxCell)row.Cells["Check"].EditedFormattedValue = true; // //(DataGridViewCheckBoxCell)row.Cells["Check"].EditingCellFormattedValue = true; // //ck.EditingCellFormattedValue = true; // //row.Cells["Check"].Selected = false; // //chk.TrueValue = true; // //chk.Value = 1; // } //} } }
private void GetGroupRoles(int groupID) { try { ADGroupRoleCollection _aDGroupRoleCollection = _aDGroupRoleWrapper.SelectByGroupID(groupID); if (_aDGroupRoleCollection.Count == 0) { return; } foreach (ADGroupRole _aDGroupRole in _aDGroupRoleCollection) { foreach (DataGridViewRow row in dgrid_Roles.Rows) { if (Convert.ToInt32(row.Cells["RoleID"].Value) == _aDGroupRole.RoleID) { row.Cells["Check"].Value = true; } } } } catch (Exception ex) { MessageBox.Show("حدث خطأ برجاء تكرار العمليه مره اخرى واذا تكرر الخطا برجاءالاتصال بالشخص المصمم للبرنامج وارسال رسالة الخطا التى ستظهر بعد قليل له"); MessageBox.Show(ex.Message); } }
private void GetGroupRoles(int groupID) { try { ADGroupRoleCollection _aDGroupRoleCollection = _aDGroupRoleWrapper.SelectByGroupID(groupID); foreach (ADGroupRole _aDGroupRole in _aDGroupRoleCollection) { foreach (DataGridViewRow row in dgrid_Roles.Rows) { if (Convert.ToInt32(row.Cells["RoleID"].Value) == _aDGroupRole.RoleID) { row.Cells["Check"].Value = true; } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }