void btnRemoveUsers_Click(object sender, EventArgs e) { List <ExtUserRightInfo> usersToRemove = new List <ExtUserRightInfo>(); string userNames = string.Empty; foreach (DataGridViewRow row in dgvUsers.SelectedRows) { ExtUserRightInfo extUserInfo = row.Tag as ExtUserRightInfo; VCAdministrator.AddUnitToMessage(ref userNames, extUserInfo.userInfo.username); if (!extUserInfo.added) { usersToRemove.Add(extUserInfo); //user only needs to be removed via API if it wasn't added during this session of the dialog } } if (UserInfoHandler.GetInfo("Are you sure you want to remove user(s) " + userNames + " from project?", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.Cancel) { return; } _usersToRemove.AddRange(usersToRemove); foreach (DataGridViewRow row in dgvUsers.SelectedRows) { dgvUsers.Rows.Remove(row); } }
bool CheckFieldValidity() { if (cmbReleases.SelectedIndex < 0) { UserInfoHandler.ShowInfo("Please select a release."); return(false); } _downloadActions.Clear(); string undefUnits = string.Empty; int undefUnitsCount = 0, actionUnitsCount = 0, mergeCount = 0; foreach (var ui in _unitInfos) // _downloadActions needs to be in the same order as _unitInfos ... { DataGridViewRow row = null; // ... therefore search for the correct row (users can change order sort-column-actions) foreach (DataGridViewRow r in dgvContent.Rows) { if ((long)r.Tag == ui.UnitId) { row = r; break; } } if (row.Cells[colGetReleaseVersion.Index].ReadOnly) { _downloadActions.Add(DownloadAction.noAction); } else if (EM_Helpers.SaveConvertToBoolean(row.Cells[colKeepUIVersion.Index].Value)) { _downloadActions.Add(DownloadAction.noAction); } else if (EM_Helpers.SaveConvertToBoolean(row.Cells[colGetMergeSupport.Index].Value)) { _downloadActions.Add(DownloadAction.getMergeSupport); ++actionUnitsCount; ++mergeCount; } else if (EM_Helpers.SaveConvertToBoolean(row.Cells[colGetReleaseVersion.Index].Value)) { _downloadActions.Add(DownloadAction.getReleaseVersion); ++actionUnitsCount; } else { VCAdministrator.AddUnitToMessage(ref undefUnits, row.Cells[colUnit.Index].Value.ToString()); ++undefUnitsCount; } } if (undefUnitsCount > 0) { UserInfoHandler.ShowInfo("Please make a choice for each unit, where user-interface-version and Release-version differ." + Environment.NewLine + string.Format("A choice is missing for unit{0} {1}.", undefUnitsCount > 1 ? "s" : string.Empty, undefUnits)); return(false); } if (actionUnitsCount == 0) { UserInfoHandler.ShowInfo("Your choices do not require any download-action." + Environment.NewLine + "Please change your choices or close the dialog with Cancel."); return(false); } if (mergeCount > 0 && txtAlternativeFolder.Text != string.Empty) { UserInfoHandler.ShowInfo("Downloading to an alternative destination is not possible if 'Merge Support' is requested for any unit."); return(false); } if (txtAlternativeFolder.Text != string.Empty && !System.IO.Directory.Exists(txtAlternativeFolder.Text)) { UserInfoHandler.ShowInfo("Please select an existing folder for the alternative destination."); return(false); } return(true); }