/// <summary> /// Create and insert a quick tab /// along with all the other needed entities. /// It will have the provided system name, display name, and HTML. /// It will display ONLY for a single product whose ID is given. /// </summary> public async Task InsertQuickTabForSpecificProductAsync( string systemName, string displayName, string html, int productId) { Tab tab = new Tab(); tab.SystemName = systemName; tab.DisplayName = displayName; tab.Description = html; tab.LimitedToStores = false; tab.TabMode = TabMode.Mappings; tab.DisplayOrder = 0; await _tabService.InsertTabAsync(tab); Condition condition = await _conditionService.CreateConditionAsync(); condition.Active = true; await _conditionService.UpdateConditionAsync(condition); EntityCondition entityCondition = new EntityCondition(); entityCondition.ConditionId = condition.Id; entityCondition.EntityType = EntityType.Tab; entityCondition.EntityId = tab.Id; entityCondition.LimitedToStores = false; await _entityConditionService.InsertEntityConditionAsync(entityCondition); ConditionGroup conditionGroup = new ConditionGroup(); await _conditionService.CreateConditionGroupAsync(condition, conditionGroup); ConditionStatement conditionStatement = new ConditionStatement(); await _conditionService.CreateConditionStatementAsync(conditionGroup, conditionStatement); conditionStatement.Value = "Fail"; await _conditionService.UpdateConditionStatementAsync(conditionStatement); EntityMapping entityMapping = new EntityMapping(); entityMapping.EntityType = EntityType.Tab; entityMapping.EntityId = tab.Id; entityMapping.MappedEntityId = productId; entityMapping.DisplayOrder = 0; entityMapping.MappingType = MappingType.Product; await _entityMappingService.InsertEntityMappingAsync(entityMapping); }