示例#1
0
        protected virtual void showDelete()
        {
            Debug.Assert(!(_grid.Selected.Rows.Count == 0), "Attempt to delete snapshots with no selections");

            if (m_serverInstance != null && Sql.RegisteredServer.IsServerRegistered(m_serverInstance.ConnectionName))
            {
                Snapshot.SnapshotList deleteList = new Snapshot.SnapshotList();
                _grid.ActiveRow.Selected = true;
                foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in _grid.Selected.Rows)
                {
                    if (row.Cells[colStatus].Text == Utility.Snapshot.StatusInProgress)
                    {
                        deleteList.Clear();
                        Utility.MsgBox.ShowError(Utility.ErrorMsgs.DeleteSnapshotCaption, Utility.ErrorMsgs.DeleteSnapshotInProgressMsg);
                        Cursor = Cursors.Default;
                        return;
                    }
                    else
                    {
                        deleteList.Add((Snapshot)row.Cells[colSnapshot].Value);
                    }
                }

                if (deleteList.Count > 0)
                {
                    if (DialogResult.OK == Forms.Form_DeleteSnapshot.Process(deleteList))
                    {
                        // set the cursor back to wait because the form cleared it
                        Cursor = Cursors.WaitCursor;

                        loadDataSource();
                    }
                }
                else
                {
                    Utility.MsgBox.ShowError(Utility.ErrorMsgs.DeleteSnapshotCaption, Utility.ErrorMsgs.DeleteSnapshotNoSelectionMsg);
                }

                Program.gController.RefreshServerInTree(m_serverInstance.ConnectionName);
            }
            else
            {
                Utility.MsgBox.ShowError(Utility.ErrorMsgs.DeleteSnapshotCaption, Utility.ErrorMsgs.ServerNotRegistered);
                Program.gController.SignalRefreshServersEvent(false, null);
            }
        }
示例#2
0
        protected override void showDelete()
        {
            Debug.Assert(!(_grid.Selected.Rows.Count == 0), "Attempt to delete snapshots with no selections");

            Cursor = Cursors.WaitCursor;
            Snapshot.SnapshotList deleteList = new Snapshot.SnapshotList();
            foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in _grid.Selected.Rows)
            {
                if (row.Cells["Status"].Text == "I")
                {
                    deleteList.Clear();
                    Utility.MsgBox.ShowError(Utility.ErrorMsgs.DeleteSnapshotCaption, Utility.ErrorMsgs.DeleteSnapshotInProgressMsg);
                    Cursor = Cursors.Default;
                    return;
                }
                else
                {
                    deleteList.Add(new Snapshot(Convert.ToInt32(row.Cells[colId].Text),
                                                (DateTime)row.Cells[colStartTime].Value,
                                                //((DateTime)row.Cells[colStartDate].Value).Add((TimeSpan)row.Cells[colStartTime].Value),
                                                row.Cells[colBaseline].Text)
                                   );
                }
            }

            if (deleteList.Count > 0)
            {
                Forms.Form_DeleteSnapshot.Process(deleteList);

                Cursor = Cursors.WaitCursor;

                loadDataSource();
            }
            else
            {
                Utility.MsgBox.ShowError(Utility.ErrorMsgs.DeleteSnapshotCaption, Utility.ErrorMsgs.DeleteSnapshotNoSelectionMsg);
            }

            Cursor = Cursors.Default;
        }