public void CreateBackupSchedule(BackupStorageType storageType, [FromQuery] Dictionary <string, string> storageParams, int backupsStored, [FromBody] BackupAjaxHandler.CronParams cronParams, bool backupMail) { if (CoreBaseSettings.Standalone) { TenantExtra.DemandControlPanelPermission(); } BackupHandler.CreateSchedule(storageType, storageParams, backupsStored, cronParams, backupMail); }
private bool CreateBackupSchedule(BackupSchedule backupSchedule) { if (CoreBaseSettings.Standalone) { TenantExtra.DemandControlPanelPermission(); } var storageType = backupSchedule.StorageType == null ? BackupStorageType.Documents : (BackupStorageType)Int32.Parse(backupSchedule.StorageType); var storageParams = backupSchedule.StorageParams == null ? new Dictionary <string, string>() : backupSchedule.StorageParams.ToDictionary(r => r.Key.ToString(), r => r.Value.ToString()); var backupStored = backupSchedule.BackupsStored == null ? 0 : Int32.Parse(backupSchedule.BackupsStored); var cron = new CronParams() { Period = backupSchedule.CronParams.Period == null ? BackupPeriod.EveryDay : (BackupPeriod)Int32.Parse(backupSchedule.CronParams.Period), Hour = backupSchedule.CronParams.Hour == null ? 0 : Int32.Parse(backupSchedule.CronParams.Hour), Day = backupSchedule.CronParams.Day == null ? 0 : Int32.Parse(backupSchedule.CronParams.Day), }; BackupHandler.CreateSchedule(storageType, storageParams, backupStored, cron, backupSchedule.BackupMail); return(true); }