Example #1
0
        private void onSaveCompleteHandler(List <LocationResultSet> results)
        {
            pbDumpExec.Invoke((MethodInvoker) delegate()
            {
                pbDumpExec.Value = pbDumpExec.Maximum;
            });

            this.UseWaitCursor = false;
            lStatus?.Invoke((MethodInvoker) delegate() {
                lStatus.Text = "Save complete!";
                tableRowCountHandler(-1);
            });
            string errorsToOutput = "";
            bool   koble          = true;
            int    errorcounter   = 0;

            foreach (LocationResultSet result in results)
            {
                if (!result.wasSuccessful)
                {
                    errorcounter++;
                    koble           = false;
                    errorsToOutput += result.errorMessage + "\n";
                }
            }

            bStartDump?.Invoke((MethodInvoker) delegate()
            {
                bStartDump.Enabled = true;
            });
            backuplocations = new List <firedumpdbDataSet.backup_locationsRow>();

            firedumpdbDataSetTableAdapters.logsTableAdapter logAdapter = new firedumpdbDataSetTableAdapters.logsTableAdapter();

            if (koble)
            {
                logAdapter.Insert(0, 1, "Dump was completed successfully." + results.ToString(), DateTime.Now, 0);
                MessageBox.Show("Dump was completed successfully.", "MySQL Dump", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                logAdapter.Insert(0, 1, "Saving to " + errorcounter + " out of " + results.Count + " save location(s) failed:\n" + errorsToOutput, DateTime.Now, 1);
                MessageBox.Show("Saving to " + errorcounter + " out of " + results.Count + " save location(s) failed:\n" + errorsToOutput, "MySQL Dump", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            dataGridView1.Invoke((MethodInvoker) delegate()
            {
                dataGridView1.Rows.Clear();
                dataGridView1.Refresh();
            });
        }
Example #2
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }

            if (e.ColumnIndex == 1)
            {
                int scheduleId = 0;
                if (int.TryParse(dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString(), out scheduleId))
                {
                    if (scheduleId != -1)
                    {
                        DialogResult result = MessageBox.Show("Are you sure you want to delete this Job?", "Delete Schedule-Job", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                        if (result == DialogResult.Yes)
                        {
                            //delete from userinfo, schedule_save_location and logs first
                            //userinfo
                            firedumpdbDataSetTableAdapters.userinfoTableAdapter userAdapter = new firedumpdbDataSetTableAdapters.userinfoTableAdapter();
                            userAdapter.DeleteQueryByScheduleid(scheduleId);

                            //logs
                            firedumpdbDataSetTableAdapters.logsTableAdapter logAdapter = new firedumpdbDataSetTableAdapters.logsTableAdapter();
                            logAdapter.DeleteQueryByScheduleid(scheduleId);

                            //save_locations
                            firedumpdbDataSetTableAdapters.schedule_save_locationsTableAdapter saveLocAdapter = new firedumpdbDataSetTableAdapters.schedule_save_locationsTableAdapter();
                            saveLocAdapter.DeleteQueryByScheduleId(scheduleId);

                            //last delete from schedule
                            schedulesTableAdapter.DeleteQueryById(scheduleId);

                            firedumpdbDataSet.schedulesDataTable scheduleTable = new firedumpdbDataSet.schedulesDataTable();
                            schedulesTableAdapter.FillOrderByDate(scheduleTable);
                            dataGridView1.DataSource = scheduleTable;
                        }
                    }
                }
            }
            else
            {
                int scheduleId = 0;
                if (int.TryParse(dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString(), out scheduleId))
                {
                    if (scheduleId != -1)
                    {
                        firedumpdbDataSetTableAdapters.schedule_save_locationsTableAdapter savelocAdapter = new firedumpdbDataSetTableAdapters.schedule_save_locationsTableAdapter();
                        firedumpdbDataSetTableAdapters.backup_locationsTableAdapter        backAdapter    = new firedumpdbDataSetTableAdapters.backup_locationsTableAdapter();
                        firedumpdbDataSet.schedule_save_locationsDataTable saveloctable = new firedumpdbDataSet.schedule_save_locationsDataTable();
                        savelocAdapter.FillByScheduleId(saveloctable, scheduleId);
                        firedumpdbDataSet.backup_locationsDataTable backuptable = new firedumpdbDataSet.backup_locationsDataTable();
                        if (saveloctable.Count > 0)
                        {
                            backuptable = backAdapter.GetDataByID(saveloctable[0].backup_location_id);
                            dataGridViewlocs.DataSource = backuptable;
                        }
                        //MessageBox.Show(scheduleId+" "+saveloctable.Count.ToString());
                    }
                }
            }
        }