Exemplo n.º 1
0
        public bool DropSelectedIndexes(bool confirm)
        {
            if (grd.SelectedRows.Count == 0)
            {
                return(false);
            }

            if (confirm && !MessageService.AskQuestion("Are you sure you want to drop selected indexes?"))
            {
                return(false);
            }
            IndexWrapper idx = null;

            foreach (DataGridViewRow row in grd.SelectedRows)
            {
                if (!Utils.IsDbValueValid(row.Cells[0]) ||
                    !Utils.IsDbValueValid(row.Cells[1]) ||
                    !Utils.IsDbValueValid(row.Cells[2]) ||
                    !Utils.IsDbValueValid(row.Cells[3]) ||
                    !Utils.IsDbValueValid(row.Cells[4]))
                {
                    continue;
                }


                idx                 = new IndexWrapper(_cp);
                idx.ID              = (short)row.Cells[1].Value;
                idx.OwnerObjectId   = (int)row.Cells[0].Value;
                idx.OwnerObjectName = (string)row.Cells[3].Value;
                idx.Owner           = (string)row.Cells[2].Value;
                idx.Name            = (string)row.Cells[4].Value;
                idx.Drop();
            }

            RefreshIndexes();
            return(true);
        }