Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        public static IProgressItem GetStatus(EntityType entityType)
        {
            var result = _importQueue.GetStatus(String.Format("{0}_{1}", TenantProvider.CurrentTenantID, (int)entityType));

            if (result == null)
            {
                return(ImportDataCache.Get(entityType));
            }

            return(result);
        }
Esempio n. 3
0
 public static IProgressItem GetStatus()
 {
     return(_exportQueue.GetStatus(TenantProvider.CurrentTenantID));
 }
Esempio n. 4
0
 public static PdfProgressItem GetTaskStatus(int tenantId, int invoiceId)
 {
     var id = GetTaskId(tenantId, invoiceId);
     return Queue.GetStatus(id) as PdfProgressItem;
 }
Esempio n. 5
0
 public static IProgressItem GetStatus(EntityType entityType)
 {
     return(_importQueue.GetStatus(String.Format("{0}_{1}", TenantProvider.CurrentTenantID, (int)entityType)));
 }
        public static IProgressItem GetProgressItemStatus(int tenantId, Guid userId, Type progressItemType)
        {
            var id = GetProgressItemId(tenantId, userId, progressItemType);

            return(Queue.GetStatus(id));
        }