Example #1
0
        internal static void DeleteRowsMenuItemClick()
        {
            System.Collections.ArrayList keyArray = new System.Collections.ArrayList();

            int rowCount = GetDistinctRows();

            if (rowCount < 2)
            {
                ExplorerForm.DeleteSelectedRows(keyArray);
            }
            else
            {
                ConfirmDeleteRows();
            }

            int GetDistinctRows()
            {
                foreach (System.Windows.Forms.DataGridViewRow row in ExplorerForm.GetResultDataGridView().Rows)
                {
                    if (row.IsNewRow)
                    {
                        break;
                    }

                    if ((string)row.Cells[Constants.COLUMN_MATCHTYPE].Value == Constants.MATCH_ASSOCIATE)
                    {
                        int i = (int)row.Cells[Constants.COLUMN_ROW_ID].Value;

                        if (!keyArray.Contains(i))
                        {
                            keyArray.Add(i);
                        }
                    }
                }

                return(keyArray.Count);
            }

            void ConfirmDeleteRows()
            {
                switch (System.Windows.Forms.MessageBox.Show(string.Format(UserHelper.culture, Properties.Resources.NOTIFY_DELETE_ROWSCOUNT, System.Environment.NewLine, rowCount), Properties.Resources.CAPTION_COMPARE, System.Windows.Forms.MessageBoxButtons.YesNoCancel, System.Windows.Forms.MessageBoxIcon.Exclamation, System.Windows.Forms.MessageBoxDefaultButton.Button3))
                {
                case System.Windows.Forms.DialogResult.Yes:

                    ExplorerForm.DeleteSelectedRows(keyArray);
                    break;

                default:

                    break;
                }
            }
        }
Example #2
0
 private static void DeleteSelectedRows(System.Collections.ArrayList keyArray = null)
 {
     ExplorerForm.DeleteSelectedRows(keyArray);
 }