Beispiel #1
0
        private void exportButton_Click(object sender, EventArgs e)
        {
            int code = ExportDB.Export(generalVariables.GetVariable("dbBinFolder").ToString(), userNameTextBox.Text, passwordTextBox.Text, dbNameExport.Text, out string exportFile);

            if (code == 0)
            {
                MessageBox.Show("Export complete successful.", "Export complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Please make sure, username, passwrod, database name, and bin folder path is correct.", "Export failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        private void Backup(Schedule schedule)
        {
            //edw 8a ginete to backup

            if (schedule.FullAutomatic)//einai full automatic
            {
                //gia na ektelestei h entolh sto shell, h entolh gia na kanei export thn DB
                int exitCode = ExportDB.Export(
                    schedule.MySqlBinFolderPath,
                    schedule.DBusername,
                    schedule.DBpassword,
                    schedule.DBName,
                    out string exportedFilePath
                    );

                if (exitCode == 0)             //ok
                {
                    string finalFile;          // einai to teliko arxeio, gia na ginei upload ston ftp

                    if (schedule.WithCompress) // tote prepei na ginei compress prin anebei ston ftp
                    {
                        //1. ginete to compress
                        finalFile = CompressFile(exportedFilePath);
                    }
                    else
                    {
                        finalFile = exportedFilePath;
                    }
                    if (schedule.FtpServer.getServerType().ToString().Equals("SFTP"))
                    {
                        UploadFileWithSFTP(finalFile, schedule);
                    }
                    else
                    {
                        UploadFileWithFTP(finalFile, schedule);
                    }
                    File.Delete(finalFile);
                    //UploadFile(finalFile, schedule);
                    scheduleServer.Log.UpdateLogFile(scheduleServer.Log.getId().ToString(), "success", DateTime.Now, "Success backup");//Id,Type,Datetime,Description
                }
                else// NOT ok
                {
                    //TODO: na mpainei log gia oti kati phge straba sto export.
                    scheduleServer.Log.UpdateLogFile(scheduleServer.Log.getId().ToString(), "error", DateTime.Now, "export fail");//Id,Type,Datetime,Description
                }
            }
        }
Beispiel #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     Process.Start(ExportDB.GetExportsFolder());
 }