Exemplo n.º 1
0
 private void OnCreateDefaultTasks(string obj)
 {
     DatabaseTaskManager.CreateDefaultScripts();
     this._databaseTasks = null;
     base.RaisePropertyChanged <IEnumerable <DatabaseTask> >(Expression.Lambda <Func <IEnumerable <DatabaseTask> > >(Expression.Property(Expression.Constant(this, typeof(BackupModuleViewModel)), (MethodInfo)MethodBase.GetMethodFromHandle(typeof(BackupModuleViewModel).GetMethod("get_DatabaseTasks").MethodHandle)), new ParameterExpression[0]));
     base.RaisePropertyChanged <bool>(Expression.Lambda <Func <bool> >(Expression.Property(Expression.Constant(this, typeof(BackupModuleViewModel)), (MethodInfo)MethodBase.GetMethodFromHandle(typeof(BackupModuleViewModel).GetMethod("get_IsCreateDefaultTasksButtonVisible").MethodHandle)), new ParameterExpression[0]));
 }
Exemplo n.º 2
0
 public static void CreateDefaultScripts()
 {
     if (!Directory.Exists(DatabaseTaskManager.TaskPath))
     {
         Directory.CreateDirectory(DatabaseTaskManager.TaskPath);
     }
     DatabaseTaskManager.CreateDefaultClearDatabaseScript();
 }
Exemplo n.º 3
0
 public void ExecuteTask(DatabaseTask task, bool skipConfirmation = false)
 {
     if (!skipConfirmation && !DatabaseTaskManager.ConfirmIfRequested(task.Commands, task.NameStr))
     {
         return;
     }
     this.BackupIfRequested(task.Commands);
     this.ExecuteTask(task.TaskType, task.FilePath, task.Arguments);
     this.LogoutIfRequested(task.Commands);
 }
Exemplo n.º 4
0
        public BackupModuleViewModel(IUserService userService, BackupHelper backupHelper, DatabaseTaskManager databaseTaskManager)
        {
            this._userService                = userService;
            this._backupHelper               = backupHelper;
            this._databaseTaskManager        = databaseTaskManager;
            this.SaveSettingsCommand         = new CaptionCommand <string>(Resources.Save, new Action <string>(this.OnSaveSettings));
            this.SelectBackupLocationCommand = new CaptionCommand <string>("...", new Action <string>(this.OnSelectBackupLocation));
            this.ClearBackupLocationCommand  = new CaptionCommand <string>("X", new Action <string>(this.OnClearBackupLocation));
            this.BackupDatabaseCommand       = new CaptionCommand <string>(Resources.BackupDatabase, new Action <string>(this.OnBackupDatabase));
            this.RestoreDatabaseCommand      = new CaptionCommand <string>(Resources.RestoreDatabase, new Action <string>(this.OnRestoreDatabase), new Func <string, bool>(this.CanRestoreDatabase));
            this.DeleteBackupCommand         = new CaptionCommand <string>(Resources.DeleteBackup, new Action <string>(this.OnDeleteBackup), new Func <string, bool>(this.CanDeleteBackup));
            this.OpenBackupLocationCommand   = new CaptionCommand <string>(Resources.DisplayBackupLocation, new Action <string>(this.OnDisplayBackupLocation));
            this.RestoreFromFileCommand      = new CaptionCommand <string>(Resources.RestoreFromZip, new Action <string>(this.OnRestoreFromFile));


            this.ExecuteDatabaseTaskCommand = new CaptionCommand <string>(Resources.ExecuteTask, new Action <string>(this.OnExecuteDatabaseTask), new Func <string, bool>(this.CanExecuteDatabaseTask));
            this.CreateDefaultTasksCommand  = new CaptionCommand <string>(Resources.CreateDefaultTasks, new Action <string>(this.OnCreateDefaultTasks), new Func <string, bool>(this.CanCreateDefaultTasks));
        }
Exemplo n.º 5
0
 private void ExecuteTask(string taskType, string filePath, string arguments)
 {
     filePath = DatabaseTaskManager.FixDirectoryName(filePath);
     if (taskType == "SQL")
     {
         Executor.ExecSqlCommand(filePath, new object[0]);
     }
     if (taskType == "BAT")
     {
         Executor.StartProcess(filePath, arguments);
     }
     if (taskType == "VBS")
     {
         Executor.StartVbsProcess(filePath, arguments);
     }
     if (taskType == "AC")
     {
         this.ExecuteAutomationCommand(filePath);
     }
 }
Exemplo n.º 6
0
 private bool CanCreateDefaultTasks(string arg)
 {
     return(DatabaseTaskManager.CanCreateDefaultScripts());
 }