public static ReassignProgressItem StartReassign(HttpContext context, int tenantId, Guid fromUserId, Guid toUserId, Guid currentUserId, bool deleteProfile) { lock (Queue.SynchRoot) { var task = GetProgressItemStatus(tenantId, fromUserId, typeof(ReassignProgressItem)) as ReassignProgressItem; if (task != null && task.IsCompleted) { Queue.Remove(task); task = null; } if (task == null) { task = new ReassignProgressItem(context, tenantId, fromUserId, toUserId, currentUserId, deleteProfile); Queue.Add(task); } if (!Queue.IsStarted) { Queue.Start(x => x.RunJob()); } return(task); } }
public static IProgressItem Start(EntityType entityType, String CSVFileURI, String importSettingsJSON) { lock (_syncObj) { var operation = GetStatus(entityType); if (operation == null) { var fromCache = ImportDataCache.Get(entityType); if (fromCache != null) { return(fromCache); } } if (operation == null) { operation = new ImportDataOperation(entityType, CSVFileURI, importSettingsJSON); _importQueue.Add(operation); } if (!_importQueue.IsStarted) { _importQueue.Start(x => x.RunJob()); } return(operation); } }
public static PdfProgressItem StartTask(HttpContext context, int tenantId, Guid userId, int invoiceId) { lock (Queue.SynchRoot) { var task = GetTaskStatus(tenantId, invoiceId); if (task != null && task.IsCompleted) { Queue.Remove(task); task = null; } if (task == null) { task = new PdfProgressItem(context, tenantId, userId, invoiceId); Queue.Add(task); } if (!Queue.IsStarted) { Queue.Start(x => x.RunJob()); } return(task); } }
public static IProgressItem Start(List <int> fileID, List <int> contactID, String subject, String bodyTemplate, bool storeInHistory) { lock (_syncObj) { var operation = _mailQueue.GetStatus(TenantProvider.CurrentTenantID); if (operation == null) { if (fileID == null) { fileID = new List <int>(); } if (contactID == null || contactID.Count == 0 || String.IsNullOrEmpty(subject) || String.IsNullOrEmpty(bodyTemplate)) { return(null); } if (contactID.Count > GetQuotas()) { contactID = contactID.Take(GetQuotas()).ToList(); } operation = new SendBatchEmailsOperation(fileID, contactID, subject, bodyTemplate, storeInHistory); _mailQueue.Add(operation); } if (!_mailQueue.IsStarted) { _mailQueue.Start(x => x.RunJob()); } return(operation); } }
public static IProgressItem Start() { lock (_syncObj) { var operation = _exportQueue.GetStatus(TenantProvider.CurrentTenantID); if (operation == null) { operation = new ExportDataOperation(); _exportQueue.Add(operation); } if (!_exportQueue.IsStarted) _exportQueue.Start(x => x.RunJob()); return operation; } }