Esempio n. 1
0
        private void btnDeleteDB_Click(object sender, EventArgs e)
        {
            // Delete the currently selected database and associated archive database.
            ConfirmDBDelete.MainInstruction = "You are about to completely delete " + txtDB.Text + " in " + txtPath.Text;
            if (txtVersions.Text.Length > 0)
            {
                ConfirmDBDelete.MainInstruction = ConfirmDBDelete.MainInstruction + ", as well as the associated archival database";
            }
            ConfirmDBDelete.MainInstruction = ConfirmDBDelete.MainInstruction + ". Do you want to continue?";

            TaskDialogButton button = ConfirmDBDelete.ShowDialog(this);

            if (button == btnDeleteDBNo)
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            int rc = ServiceCallHelper.DeleteDB(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig());

            if (rc == 0)
            {
                MessageBox.Show("Database successfully deleted.", "Success", MessageBoxButtons.OK);
            }
            else
            {
                MessageBox.Show("Failed to delete database. Error code " + rc.ToString(), "ERROR", MessageBoxButtons.OK);
            }

            cmbUser.SelectedIndexChanged -= cmbUser_SelectedIndexChanged;
            ServiceCallHelper.LoadConfig(string.Empty);
            ServiceCallHelper.LoadConfig(AppConfigHelper.LoggedOnUser);
            AppConfigHelper.seqdbConfig.LastDBSelected = string.Empty;
            Initialize();
            cmbUser.SelectedIndexChanged += cmbUser_SelectedIndexChanged;
            Cursor.Current = Cursors.Default;
        }