private void DoWithInitCheck(int channelId, ConnectorEventType eventType, Func <Entity, ConnectorEvent> thingsToDo) { if (channelId != _config.ChannelId) { return; } var channelEntity = _channelHelper.InitiateChannelConfiguration(channelId); if (channelEntity == null) { ConnectorEventHelper.InitiateEvent(_config, eventType, $"Failed perform {eventType}. Could not find the channel.", -1, true); return; } try { var connectorEvent = thingsToDo(channelEntity); _entityService.FlushCache(); _resourceElementFactory.FlushCache(); var message = $"{eventType} done for channel {channelEntity.Id} ({channelEntity.DisplayName.Data})"; ConnectorEventHelper.UpdateEvent(connectorEvent, message, 100); } catch (Exception ex) { IntegrationLogger.Write(LogLevel.Error, "Exception in ChannelEntityAdded", ex); ConnectorEventHelper.InitiateEvent(_config, eventType, ex.Message, -1, true); _entityService.FlushCache(); _resourceElementFactory.FlushCache(); } }
private void PubilshToEpiserver(ConnectorEvent connectorEvent, XDocument catalogDocument, List <StructureEntity> structureEntitiesToGetResourcesFor, Entity channelEntity) { ConnectorEventHelper.UpdateEvent(connectorEvent, "Done generating catalog.xml. Generating Resource.xml and saving files to disk...", 26); string folderNameTimestampComponent = DateTime.Now.ToString(Constants.PublicationFolderNameTimeComponent); string resourcesBasePath = Path.Combine(_config.ResourcesRootPath, folderNameTimestampComponent); XDocument resourceDocument = _resourceElementFactory.GetResourcesNodeForChannelEntities(structureEntitiesToGetResourcesFor, resourcesBasePath); string resourceDocumentPath = _documentFileHelper.SaveDocument(resourceDocument, resourcesBasePath); string savedCatalogDocument = _documentFileHelper.SaveCatalogDocument(channelEntity, catalogDocument, folderNameTimestampComponent); ConnectorEventHelper.UpdateEvent(connectorEvent, "Done generating/saving Resource.xml, sending Catalog.xml to EPiServer...", 50); _epiApi.ImportCatalog(savedCatalogDocument); ConnectorEventHelper.UpdateEvent(connectorEvent, "Done sending Catalog.xml to EPiServer", 75); _epiApi.NotifyEpiserverPostImport(savedCatalogDocument); ConnectorEventHelper.UpdateEvent(connectorEvent, "Sending Resources to EPiServer...", 76); _epiApi.ImportResources(resourceDocumentPath, resourcesBasePath); ConnectorEventHelper.UpdateEvent(connectorEvent, "Done sending Resources to EPiServer...", 99); _epiApi.NotifyEpiserverPostImport(resourceDocumentPath); string channelName = _mappingHelper.GetNameForEntity(channelEntity, 100); _epiApi.ImportUpdateCompleted(channelName, ImportUpdateCompletedEventType.Publish, true); }
public ConnectorEvent ChannelEntityAdded(Entity channel, int entityId) { ConnectorEvent connectorEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.ChannelEntityAdded, $"Received entity added for entity {entityId} in channel {channel.DisplayName}", 0); var structureEntities = new List <StructureEntity>(); List <StructureEntity> addedStructureEntities = _entityService.GetStructureEntitiesForEntityInChannel(_config.ChannelId, entityId); foreach (StructureEntity addedEntity in addedStructureEntities) { StructureEntity parentEntity = _entityService.GetParentStructureEntity(_config.ChannelId, addedEntity.ParentId, addedEntity.EntityId, addedStructureEntities); structureEntities.Add(parentEntity); } structureEntities.AddRange(addedStructureEntities); string targetEntityPath = _entityService.GetTargetEntityPath(entityId, addedStructureEntities); List <StructureEntity> childLinks = _entityService.GetChildrenEntitiesInChannel(entityId, targetEntityPath); foreach (StructureEntity linkStructureEntity in childLinks) { List <StructureEntity> childLinkedEntities = _entityService.GetChildrenEntitiesInChannel(linkStructureEntity.EntityId, linkStructureEntity.Path); structureEntities.AddRange(childLinkedEntities); } structureEntities.AddRange(childLinks); PublishEntities(channel, connectorEvent, structureEntities); string channelName = _mappingHelper.GetNameForEntity(channel, 100); _epiApi.ImportUpdateCompleted(channelName, ImportUpdateCompletedEventType.EntityAdded, true); return(connectorEvent); }
public async Task <ConnectorEvent> CVLValueUpdatedAsync(Entity channel, string cvlId, string cvlValueKey) { ConnectorEvent connectorEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.CVLValueUpdated, $"CVL value updated, updating values in channel: {channel.DisplayName.Data}", 0); IEnumerable <FieldType> cvlFieldTypes = RemoteManager.ModelService.GetAllFieldTypes().Where(x => x.CVLId == cvlId); List <Criteria> criteria = cvlFieldTypes.Select(cvlFieldType => new Criteria { FieldTypeId = cvlFieldType.Id, Value = cvlValueKey, Operator = Operator.Equal }).ToList(); var query = new Query { Criteria = criteria, Join = Join.Or }; List <Entity> entities = RemoteManager.DataService.Search(query, LoadLevel.DataOnly); IntegrationLogger.Write(LogLevel.Debug, $"Found {entities.Count} entities with the CVL {cvlId} to update. Value-key to update: {cvlValueKey}."); XDocument updateDocument = _catalogDocumentFactory.CreateUpdateDocument(channel, entities); string folderDateTime = DateTime.Now.ToString(Constants.PublicationFolderNameTimeComponent); string savedCatalogDocument = _documentFileHelper.SaveCatalogDocument(channel, updateDocument, folderDateTime); await _epiApi.ImportCatalogAsync(savedCatalogDocument); ConnectorEventHelper.UpdateEvent(connectorEvent, "Done sending Catalog.xml to EPiServer", 75); await _epiApi.NotifyEpiserverPostImportAsync(Path.Combine(_config.PublicationsRootPath, folderDateTime, savedCatalogDocument)); return(connectorEvent); }
public ConnectorEvent ChannelLinkUpdated(Entity channel, int sourceEntityId, int targetEntityId, string linkTypeId, int?linkEntityId) { var connectorEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.ChannelLinkAdded, $"Received link update for sourceEntityId {sourceEntityId} and targetEntityId {targetEntityId} in channel {channel.DisplayName}.", 0); ConnectorEventHelper.UpdateEvent(connectorEvent, "Fetching channel entities...", 1); var targetEntityStructure = _entityService.GetEntityInChannelWithParent(_config.ChannelId, targetEntityId, sourceEntityId); var parentStructureEntity = _entityService.GetParentStructureEntity(_config.ChannelId, sourceEntityId, targetEntityId, targetEntityStructure); if (parentStructureEntity == null) { throw new Exception($"Can't find parent structure entity {sourceEntityId} with target entity id {targetEntityId}"); } var structureEntities = new List <StructureEntity> { parentStructureEntity }; var entities = _entityService.GetChildrenEntitiesInChannel(parentStructureEntity.EntityId, parentStructureEntity.Path); structureEntities.AddRange(entities); ConnectorEventHelper.UpdateEvent(connectorEvent, "Done fetching channel entities", 10); PublishEntities(channel, connectorEvent, structureEntities); var channelName = _mappingHelper.GetNameForEntity(channel, 100); _epiApi.ImportUpdateCompleted(channelName, ImportUpdateCompletedEventType.LinkUpdated, true); return(connectorEvent); }
public async Task <ConnectorEvent> PublishAsync(Entity channel) { ConnectorEvent publishEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.Publish, $"Publish started for channel: {channel.DisplayName.Data}", 0); ConnectorEventHelper.UpdateEvent(publishEvent, "Fetching all channel entities...", 1); List <StructureEntity> channelStructureEntities = _entityService.GetAllStructureEntitiesInChannel(_config.ExportEnabledEntityTypes); ConnectorEventHelper.UpdateEvent(publishEvent, "Fetched all channel entities. Generating catalog.xml...", 10); CatalogElementContainer epiElements = await _catalogDocumentFactory.GetEPiElementsAsync(channelStructureEntities); XElement metaClasses = _catalogElementFactory.GetMetaClassesFromFieldSets(); XElement associationTypes = _catalogDocumentFactory.GetAssociationTypes(); XDocument catalogDocument = _catalogDocumentFactory.CreateImportDocument(channel, metaClasses, associationTypes, epiElements); LogCatalogProperties(epiElements); List <StructureEntity> resourceEntities = RemoteManager.ChannelService.GetAllChannelStructureEntitiesForTypeFromPath(channel.Id.ToString(), "Resource"); await PublishToEpiserverAsync(publishEvent, catalogDocument, resourceEntities, channel); return(publishEvent); }
public new void Start() { ConnectorEvent startEvent = null; try { _config = new Configuration(Id); ConnectorEventHelper.CleanupOngoingEvents(_config); startEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.Start, "Connector is starting", 0); Entity channel = RemoteManager.DataService.GetEntity(_config.ChannelId, LoadLevel.Shallow); if (channel == null || channel.EntityType.Id != "Channel") { _started = false; ConnectorEventHelper.UpdateEvent(startEvent, "Channel id is not valid: Entity with given ID is not a channel, or doesn't exist. Unable to start", -1, true); return; } _pimFieldAdapter = new PimFieldAdapter(_config); _epiMappingHelper = new EpiMappingHelper(_config, _pimFieldAdapter); _entityService = new EntityService(_config, _epiMappingHelper); _catalogCodeGenerator = new CatalogCodeGenerator(_config, _entityService); _epiApi = new EpiApi(_config, _catalogCodeGenerator, _pimFieldAdapter); _catalogElementFactory = new CatalogElementFactory(_config, _epiMappingHelper, _catalogCodeGenerator, _pimFieldAdapter); _channelHelper = new ChannelHelper(_config, _entityService); _catalogDocumentFactory = new CatalogDocumentFactory(_config, _epiApi, _catalogElementFactory, _epiMappingHelper, _channelHelper, _catalogCodeGenerator, _entityService); _resourceElementFactory = new ResourceElementFactory(_catalogElementFactory, _epiMappingHelper, _catalogCodeGenerator, _config, _entityService); _documentFileHelper = new DocumentFileHelper(_config, _channelHelper); _cvlUpdater = new CvlUpdater(_config, _catalogDocumentFactory, _epiApi, _documentFileHelper); _publisher = new ChannelPublisher(_config, _catalogDocumentFactory, _catalogElementFactory, _resourceElementFactory, _epiApi, _epiMappingHelper, _documentFileHelper, _pimFieldAdapter, _entityService, _catalogCodeGenerator); AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainAssemblyResolve; InitConnector(); base.Start(); _started = true; ConnectorEventHelper.UpdateEvent(startEvent, "Connector has started", 100); } catch (Exception ex) { IntegrationLogger.Write(LogLevel.Error, "Error while starting connector", ex); ConnectorEventHelper.UpdateEvent(startEvent, "Issue while starting connector, see log.", 100, true); throw; } }
internal void PublishEntities(Entity channel, ConnectorEvent connectorEvent, List <StructureEntity> structureEntities) { ConnectorEventHelper.UpdateEvent(connectorEvent, "Generating catalog.xml...", 11); CatalogElementContainer epiElements = _catalogDocumentFactory.GetEPiElements(structureEntities); XDocument catalogDocument = _catalogDocumentFactory.CreateImportDocument(channel, null, null, epiElements); LogCatalogProperties(epiElements); PubilshToEpiserver(connectorEvent, catalogDocument, structureEntities, channel); }
public async Task <ConnectorEvent> ChannelEntityUpdatedAsync(Entity channel, int entityId, string data) { ConnectorEvent connectorEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.ChannelEntityUpdated, $"Received entity update for entity {entityId} in channel {channel.DisplayName}", 0); Entity updatedEntity = _entityService.GetEntity(entityId, LoadLevel.DataAndLinks); if (updatedEntity.EntityType.IsLinkEntityType) { return(connectorEvent); } string folderDateTime = DateTime.Now.ToString(Constants.PublicationFolderNameTimeComponent); bool resourceIncluded = false; List <StructureEntity> structureEntities = _entityService.GetStructureEntitiesForEntityInChannel(_config.ChannelId, entityId); if (updatedEntity.EntityType.Id.Equals("Resource")) { resourceIncluded = await HandleResourceUpdateAsync(updatedEntity, folderDateTime); } else { IntegrationLogger.Write(LogLevel.Debug, $"Updated entity found. Type: {updatedEntity.EntityType.Id}, id: {updatedEntity.Id}"); if (updatedEntity.EntityType.Id.Equals("Item") && data != null && data.Split(',').Contains("SKUs")) { resourceIncluded = await HandleSkuUpdateAsync(entityId, channel, connectorEvent, structureEntities); } else if (updatedEntity.EntityType.Id.Equals("ChannelNode")) { await HandleChannelNodeUpdateAsync(channel, structureEntities, connectorEvent); return(connectorEvent); } XDocument doc = _catalogDocumentFactory.CreateUpdateDocument(channel, updatedEntity); string catalogDocumentName = _documentFileHelper.SaveCatalogDocument(channel, doc, folderDateTime); IntegrationLogger.Write(LogLevel.Debug, "Starting automatic import!"); await _epiApi.ImportCatalogAsync(catalogDocumentName); await _epiApi.NotifyEpiserverPostImportAsync(catalogDocumentName); } string channelName = _mappingHelper.GetNameForEntity(channel, 100); await _epiApi.ImportUpdateCompletedAsync(channelName, ImportUpdateCompletedEventType.EntityUpdated, resourceIncluded); return(connectorEvent); }
public void ChannelEntityUpdated(int channelId, int entityId, string data) { DoWithInitCheck(channelId, ConnectorEventType.ChannelEntityUpdated, channel => { if (channel.Id == entityId) { var connectorEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.ChannelEntityUpdated, "Updated Entity is the Channel, no action required", 100); return(connectorEvent); } return(_publisher.ChannelEntityUpdated(channel, entityId, data)); }); }
public ConnectorEvent ChannelEntityDeleted(Entity channel, Entity deletedEntity) { string channelName = _mappingHelper.GetNameForEntity(channel, 100); ConnectorEvent connectorEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.ChannelEntityDeleted, $"Received entity deleted for entity {deletedEntity.Id} in channel {channelName}.", 0); Delete(channel, deletedEntity); _epiApi.DeleteCompleted(channelName, DeleteCompletedEventType.EntitiyDeleted); return(connectorEvent); }
public ConnectorEvent ChannelLinkAdded(Entity channel, int sourceEntityId, int targetEntityId, string linkTypeId, int?linkEntityId) { ConnectorEvent connectorEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.ChannelLinkAdded, $"Received link added for sourceEntityId {sourceEntityId} and targetEntityId {targetEntityId} in channel {channel.DisplayName}", 0); ConnectorEventHelper.UpdateEvent(connectorEvent, "Fetching channel entities...", 1); List <StructureEntity> existingEntitiesInChannel = _entityService.GetStructureEntitiesForEntityInChannel(_config.ChannelId, targetEntityId); var structureEntities = new List <StructureEntity>(); foreach (StructureEntity existingEntity in existingEntitiesInChannel) { List <string> parentIds = existingEntity.Path.Split('/').ToList(); parentIds.Reverse(); parentIds.RemoveAt(0); for (var i = 0; i < parentIds.Count - 1; i++) { int entityId = int.Parse(parentIds[i]); int parentId = int.Parse(parentIds[i + 1]); structureEntities.AddRange(RemoteManager.ChannelService.GetAllStructureEntitiesForEntityWithParentInChannel(channel.Id, entityId, parentId)); } } foreach (StructureEntity existingEntity in existingEntitiesInChannel) { string targetEntityPath = _entityService.GetTargetEntityPath(existingEntity.EntityId, existingEntitiesInChannel, existingEntity.ParentId); structureEntities.AddRange(RemoteManager.ChannelService.GetAllChannelStructureEntitiesFromPath(targetEntityPath)); } // Remove duplicates structureEntities = structureEntities.GroupBy(x => x.EntityId).Select(x => x.First()).ToList(); //Adding existing Entities. If it occurs more than one time in channel. We can not remove duplicates. structureEntities.AddRange(existingEntitiesInChannel); ConnectorEventHelper.UpdateEvent(connectorEvent, "Done fetching channel entities", 10); PublishEntities(channel, connectorEvent, structureEntities); string channelName = _mappingHelper.GetNameForEntity(channel, 100); _epiApi.ImportUpdateCompleted(channelName, ImportUpdateCompletedEventType.LinkAdded, true); return(connectorEvent); }
public async Task <ConnectorEvent> ChannelLinkUpdatedAsync(Entity channel, int sourceEntityId, int targetEntityId, string linkTypeId, int?linkEntityId) { List <StructureEntity> targetEntityStructure = _entityService.GetEntityInChannelWithParent(_config.ChannelId, targetEntityId, sourceEntityId); StructureEntity parentStructureEntity = _entityService.GetParentStructureEntity(_config.ChannelId, sourceEntityId, targetEntityId, targetEntityStructure); string channelName = _mappingHelper.GetNameForEntity(channel, 100); if (parentStructureEntity == null) { ConnectorEvent deleteEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.ChannelLinkDeleted, $"Received link deleted for sourceEntityId {sourceEntityId} and targetEntityId {targetEntityId} in channel {channel.DisplayName.Data}", 0); Entity removalTarget = _entityService.GetEntity(targetEntityId, LoadLevel.DataAndLinks); Entity removalSource = _entityService.GetEntity(sourceEntityId, LoadLevel.DataAndLinks); await DeleteLinkAsync(removalSource, removalTarget, linkTypeId, true); await _epiApi.DeleteCompletedAsync(channelName, DeleteCompletedEventType.LinkDeleted); return(deleteEvent); } ConnectorEvent connectorEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.ChannelLinkAdded, $"Received link update for sourceEntityId {sourceEntityId} and targetEntityId {targetEntityId} in channel {channel.DisplayName}.", 0); ConnectorEventHelper.UpdateEvent(connectorEvent, "Fetching channel entities...", 1); var structureEntities = new List <StructureEntity> { parentStructureEntity }; List <StructureEntity> entities = _entityService.GetChildrenEntitiesInChannel(parentStructureEntity.EntityId, parentStructureEntity.Path); structureEntities.AddRange(entities); ConnectorEventHelper.UpdateEvent(connectorEvent, "Done fetching channel entities", 10); await PublishEntitiesAsync(channel, connectorEvent, structureEntities); await _epiApi.ImportUpdateCompletedAsync(channelName, ImportUpdateCompletedEventType.LinkUpdated, true); return(connectorEvent); }
public new void Stop() { base.Stop(); var connectorEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.Stop, "Connector is stopping", 0); _started = false; _epiApi = null; _catalogElementFactory = null; _catalogDocumentFactory = null; _channelHelper = null; _resourceElementFactory = null; _epiMappingHelper = null; _catalogCodeGenerator = null; _publisher = null; _config = null; _documentFileHelper = null; _entityService = null; _cvlUpdater = null; ConnectorEventHelper.UpdateEvent(connectorEvent, "Connector has stopped.", 100); }
public async Task <ConnectorEvent> ChannelLinkDeletedAsync(Entity channel, int sourceEntityId, int targetEntityId, string linkTypeId, int?linkEntityId) { ConnectorEvent connectorEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.ChannelLinkDeleted, $"Received link deleted for sourceEntityId {sourceEntityId} and targetEntityId {targetEntityId} in channel {channel.DisplayName.Data}", 0); Entity removalTarget = _entityService.GetEntity(targetEntityId, LoadLevel.DataAndLinks); Entity removalSource = _entityService.GetEntity(sourceEntityId, LoadLevel.DataAndLinks); if (removalTarget.EntityType.Id == "Resource") { await DeleteResourceLinkAsync(removalTarget, removalSource); } else { await DeleteLinkAsync(removalSource, removalTarget, linkTypeId); } string channelName = _mappingHelper.GetNameForEntity(channel, 100); await _epiApi.DeleteCompletedAsync(channelName, DeleteCompletedEventType.LinkDeleted); return(connectorEvent); }
internal void Add(Entity channelEntity, ConnectorEvent connectorEvent, out bool resourceIncluded) { resourceIncluded = false; var channelHelper = new ChannelHelper(_context); var epiApi = new EpiApi(_context); var connectorEventHelper = new ConnectorEventHelper(_context); connectorEventHelper.UpdateConnectorEvent(connectorEvent, "Generating catalog.xml...", 11); Dictionary <string, List <XElement> > epiElements = _epiDocument.GetEPiElements(ConnectorConfig); XDocument doc = _epiDocument.CreateImportDocument( channelEntity, null, null, epiElements, ConnectorConfig); string folderDateTime = DateTime.Now.ToString("yyyyMMdd-HHmmss.fff"); if (!DocumentFileHelper.ZipDocumentAndUploadToAzure(XmlDocumentType.Catalog, doc, ConnectorConfig, folderDateTime)) { _context.Log(LogLevel.Information, "Failed to zip and upload the catalog file to azure from add utility Add() method"); } _context.Log(LogLevel.Information, "Catalog saved with the following:"); _context.Log(LogLevel.Information, string.Format("Nodes: {0}", epiElements["Nodes"].Count)); _context.Log(LogLevel.Information, string.Format("Entries: {0}", epiElements["Entries"].Count)); _context.Log(LogLevel.Information, string.Format("Relations: {0}", epiElements["Relations"].Count)); _context.Log(LogLevel.Information, string.Format("Associations: {0}", epiElements["Associations"].Count)); connectorEventHelper.UpdateConnectorEvent(connectorEvent, "Done generating catalog.xml", 25); connectorEventHelper.UpdateConnectorEvent(connectorEvent, "Generating Resource.xml and saving files to disk...", 26); Resources resourceHelper = new Resources(_context); XDocument resourceDocument = resourceHelper.GetResourcesDocument(ConnectorConfig.ChannelStructureEntities, ConnectorConfig); // Add all files included in resource document Dictionary <string, byte[]> files = new Dictionary <string, byte[]>(); IEnumerable <XElement> resourceFileElements = resourceDocument.Document.Element("Resources")?.Element("ResourceFiles")?.Elements("Resource"); if (resourceFileElements != null && resourceFileElements.Any()) { _context.Log(LogLevel.Information, $"Adding {resourceFileElements.Count()} resource files to zip archive."); foreach (XElement resourceFileElement in resourceFileElements) { int resourceEntityId; if (int.TryParse(resourceFileElement.Attribute("id").Value, out resourceEntityId)) { Entity targetEntity = _context.ExtensionManager.DataService.GetEntity(resourceEntityId, LoadLevel.DataOnly); _context.Log(LogLevel.Debug, $"Adding image file {targetEntity.DisplayName}({targetEntity.Id})"); int resourceFileId = resourceHelper.GetResourceFileId(targetEntity); foreach (string displayConfig in resourceHelper.GetDisplayConfigurations(targetEntity, ConnectorConfig)) { string fileName = resourceHelper.GetResourceFileName(targetEntity, resourceFileId, displayConfig, ConnectorConfig); byte[] resourceData = _context.ExtensionManager.UtilityService.GetFile(resourceFileId, displayConfig); if (resourceData != null) { files.Add($"{displayConfig}/{fileName}", resourceData); } } } } } else { string elementCount = resourceFileElements == null ? "null" : resourceFileElements.Count().ToString(); _context.Log(LogLevel.Information, $"No files linked to resource document. Document contains {elementCount} elements"); } DocumentFileHelper.ZipDocumentAndUploadToAzure(XmlDocumentType.Resources, resourceDocument, ConnectorConfig, folderDateTime, files); connectorEventHelper.UpdateConnectorEvent(connectorEvent, "Done generating/saving Resource.xml", 50); if (ConnectorConfig.ActivePublicationMode.Equals(PublicationMode.Automatic)) { _context.Log(LogLevel.Debug, "Starting automatic import!"); connectorEventHelper.UpdateConnectorEvent(connectorEvent, "Sending Catalog.xml to EPiServer...", 51); if (epiApi.StartImportIntoEpiServerCommerce(ConnectorConfig.CatalogPathInCloud, channelHelper.GetChannelGuid(channelEntity, ConnectorConfig), ConnectorConfig)) { connectorEventHelper.UpdateConnectorEvent(connectorEvent, "Done sending Catalog.xml to EPiServer", 75); } else { connectorEventHelper.UpdateConnectorEvent(connectorEvent, "Error while sending Catalog.xml to EPiServer", -1, true); return; } connectorEventHelper.UpdateConnectorEvent(connectorEvent, "Sending Resources to EPiServer...", 76); if (epiApi.StartAssetImportIntoEpiServerCommerce(ConnectorConfig.ResourceNameInCloud, Path.Combine(ConnectorConfig.ResourcesRootPath, folderDateTime), ConnectorConfig)) { connectorEventHelper.UpdateConnectorEvent(connectorEvent, "Done sending Resources to EPiServer...", 99); resourceIncluded = true; } else { connectorEventHelper.UpdateConnectorEvent(connectorEvent, "Error while sending resources to EPiServer", -1, true); } } }