Exemplo n.º 1
0
        public static void TerminateTask(int tenantId, int invoiceId)
        {
            var item = GetTaskStatus(tenantId, invoiceId);

            if (item != null)
                Queue.Remove(item);
        }
Exemplo n.º 2
0
        public static void Terminate(int tenantId, Guid userId, Type progressItemType)
        {
            var item = GetProgressItemStatus(tenantId, userId, progressItemType);

            if (item != null)
            {
                Queue.Remove(item);
            }
        }
Exemplo n.º 3
0
 private static T FindOrAddItem <T>(int tenantId, Func <T> itemFactory) where T : BackupProgressItemBase
 {
     lock (tasks.SynchRoot)
     {
         var item = FindItem <T>(tenantId);
         if (item != null && item.IsCompleted)
         {
             tasks.Remove(item);
             item = null;
         }
         if (item == null)
         {
             item = itemFactory();
             tasks.Add(item);
         }
         return(item);
     }
 }
Exemplo n.º 4
0
        public static void Cancel()
        {
            lock (_syncObj)
            {
                var findedItem = _exportQueue.GetItems().Where(elem => (int) elem.Id == TenantProvider.CurrentTenantID);

                if (findedItem.Any())
                    _exportQueue.Remove(findedItem.ElementAt(0));
            }
        }
Exemplo n.º 5
0
 public void StartScheduledBackup(BackupSchedule schedule)
 {
     lock (ProgressQueue.SynchRoot)
     {
         var item = ProgressQueue.GetItems().OfType <BackupProgressItem>().FirstOrDefault(t => t.TenantId == schedule.TenantId);
         if (item != null && item.IsCompleted)
         {
             ProgressQueue.Remove(item);
             item = null;
         }
         if (item == null)
         {
             item = FactoryProgressItem.CreateBackupProgressItem(schedule, false, TempFolder, Limit, CurrentRegion, ConfigPaths);
             ProgressQueue.Add(item);
         }
     }
 }
Exemplo n.º 6
0
        public static void Cancel()
        {
            lock (_syncObj)
            {
                var findedItem = _mailQueue.GetItems().Where(elem => (int)elem.Id == TenantProvider.CurrentTenantID);

                if (findedItem.Any())
                {
                    _mailQueue.Remove(findedItem.ElementAt(0));

                    MailSenderDataCache.ResetAll();
                }
                else
                {
                    MailSenderDataCache.SetCancelFlag();
                }
            }
        }
Exemplo n.º 7
0
 public BackupProgress StartRestore(StartRestoreRequest request)
 {
     lock (ProgressQueue.SynchRoot)
     {
         var item = ProgressQueue.GetItems().OfType <RestoreProgressItem>().FirstOrDefault(t => t.TenantId == request.TenantId);
         if (item != null && item.IsCompleted)
         {
             ProgressQueue.Remove(item);
             item = null;
         }
         if (item == null)
         {
             item = FactoryProgressItem.CreateRestoreProgressItem(request, TempFolder, UpgradesPath, CurrentRegion, ConfigPaths);
             ProgressQueue.Add(item);
         }
         return(ToBackupProgress(item));
     }
 }
Exemplo n.º 8
0
        public BackupProgress StartTransfer(int tenantId, string targetRegion, bool transferMail, bool notify)
        {
            lock (ProgressQueue.SynchRoot)
            {
                var item = ProgressQueue.GetItems().OfType <TransferProgressItem>().FirstOrDefault(t => t.TenantId == tenantId);
                if (item != null && item.IsCompleted)
                {
                    ProgressQueue.Remove(item);
                    item = null;
                }

                if (item == null)
                {
                    item = FactoryProgressItem.CreateTransferProgressItem(targetRegion, transferMail, tenantId, TempFolder, Limit, notify, CurrentRegion, ConfigPaths);
                    ProgressQueue.Add(item);
                }

                return(ToBackupProgress(item));
            }
        }
Exemplo n.º 9
0
        public BackupProgress StartBackup(StartBackupRequest request)
        {
            lock (ProgressQueue.SynchRoot)
            {
                var item = ProgressQueue.GetItems().OfType <BackupProgressItem>().FirstOrDefault(t => t.TenantId == request.TenantId);
                if (item != null && item.IsCompleted)
                {
                    ProgressQueue.Remove(item);
                    item = null;
                }
                if (item == null)
                {
                    item = FactoryProgressItem.CreateBackupProgressItem(request, false, TempFolder, Limit, CurrentRegion, ConfigPaths);
                    ProgressQueue.Add(item);
                }

                var progress = ToBackupProgress(item);

                PublishProgress(progress);

                return(progress);
            }
        }