Esempio n. 1
0
        private static void Clear()
        {
            var contentService          = new ContentApiService(Global.ConnectionString, 1);
            var baseContentExists       = contentService.Exists(BaseContentId);
            var dictionaryContentExists = contentService.Exists(DictionaryContentId);
            var fieldService            = new FieldApiService(Global.ConnectionString, 1);

            if (dictionaryContentExists)
            {
                InitDictionaryContentFields();
                var dictionaryIds = Global.GetIds(DbConnector, DictionaryContentId);
                ArticleService.Delete(DictionaryContentId, dictionaryIds);
            }

            if (baseContentExists)
            {
                InitBaseContentFields();
                InitExtensions();

                var baseIds = Global.GetIds(DbConnector, BaseContentId);
                ArticleService.Delete(BaseContentId, baseIds);
                contentService.Delete(Ex11ContentId);
                contentService.Delete(Ex12ContentId);
                contentService.Delete(Ex21ContentId);
                contentService.Delete(Ex22ContentId);
            }

            if (dictionaryContentExists)
            {
                fieldService.Delete(DictionaryFieldMtMBackwardId);
                fieldService.Delete(DictionaryFieldMtOBackwardId);
            }

            if (baseContentExists)
            {
                fieldService.Delete(BaseFieldMtMId);
                fieldService.Delete(BaseFieldOtMId);
            }

            if (dictionaryContentExists)
            {
                contentService.Delete(DictionaryContentId);
            }

            if (baseContentExists)
            {
                contentService.Delete(BaseContentId);
            }
        }
Esempio n. 2
0
        private static void Clear()
        {
            var srv = new ContentApiService(Global.ConnectionString, 1);

            RegionContentId  = Global.GetContentId(DbConnector, RegionContentName);
            ProductContentId = Global.GetContentId(DbConnector, ProductContentName);

            if (srv.Exists(ProductContentId))
            {
                srv.Delete(ProductContentId);
            }

            if (srv.Exists(RegionContentId))
            {
                srv.Delete(RegionContentId);
            }
        }
Esempio n. 3
0
        public static void TearDown()
        {
            using (new QPConnectionScope(Global.ConnectionInfo))
            {
                var srv = new ContentApiService(Global.ConnectionInfo, 1);
                RegionContentId  = Global.GetContentId(DbConnector, RegionContentName);
                ProductContentId = Global.GetContentId(DbConnector, ProductContentName);

                if (srv.Exists(ProductContentId))
                {
                    srv.Delete(ProductContentId);
                }

                if (srv.Exists(RegionContentId))
                {
                    srv.Delete(RegionContentId);
                }
            }
        }
Esempio n. 4
0
        public JsonProductService(
            IConnectionProvider connectionProvider,
            ILogger logger,
            ContentService contentService,
            FieldService fieldService,
            VirtualFieldContextService virtualFieldContextService,
            IRegionTagReplaceService regionTagReplaceService,
            IOptions<LoaderProperties> loaderProperties,
            IHttpClientFactory factory            
            )
        {
            _logger = logger;
            _contentService = contentService;
            _fieldService = fieldService;

            var customer = connectionProvider.GetCustomer();
            _dbConnector = new DBConnector(customer.ConnectionString, customer.DatabaseType);

            _virtualFieldContextService = virtualFieldContextService;
            _regionTagReplaceService = regionTagReplaceService;
            _loaderProperties = loaderProperties.Value;
            _factory = factory;
        }