Example #1
0
        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);
            }
        }
Example #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);
        }