Esempio n. 1
0
        public override TaskExecutionResult Execute()
        {
            TaskExecutionResult result = new TaskExecutionResult()
            {
                Target = this.Target
            };
            string path = String.Empty;

            try
            {
                path = this.BackupDatabase();
                this.UploadBackup(path);
            }
            catch (Exception ex)
            {
                result.Exception = ex;
                result.Success   = false;
            }
            finally
            {
                try
                {
                    if (!String.IsNullOrEmpty(path) && File.Exists(path))
                    {
                        File.Delete(path);
                    }
                }
                catch
                {
                }
            }

            return(result);
        }
Esempio n. 2
0
        public override TaskExecutionResult Execute()
        {
            TaskExecutionResult result = new TaskExecutionResult() { Target = this.Target };
            string path = String.Empty;

            try
            {
                path = this.DownloadBackup();
                this.RestoreDatabase(path);
            }
            catch (Exception ex)
            {
                result.Exception = ex;
                result.Success = false;
            }
            finally
            {
                try
                {
                    if (File.Exists(path))
                    {
                        File.Delete(path);
                    }
                }
                catch
                {
                }
            }

            return result;
        }