public List <CatalogData> GetCatalogData(CatalogRequest catalogRequest) { List <CatalogData> CatalogData = null; if (catalogRequest != null && catalogRequest.Filter != null) { CatalogData = CatalogRepository.GetCatalogData(catalogRequest); } return(CatalogData); }
private string GetCatalogDataQuery(CatalogRequest catalogRequest) { CatalogMetaData catalogDefination = GetCatalogMetaData(catalogRequest.CatalogId); string catalogFilterQuery = CatalogQueryProvider.BuildCatalogQuery(catalogDefination, catalogRequest); if (!catalogRequest.Filter.SearchExact) { catalogRequest.Filter.Term = '%' + catalogRequest.Filter.Term + '%'; } return(catalogFilterQuery); }
public async Task <ActionResult> CreateOrUpdateUserCatalogAsync([FromBody] CatalogRequest newCatReq) { var result = await _catalogRepository.AddAsync(newCatReq); if (!result) { return(BadRequest()); } return(Ok()); }
public List <CatalogData> GetCatalogData(CatalogRequest catalogRequest) { CatalogMetaData catalogDefination = GetCatalogMetaData(catalogRequest.CatalogId); string catalogFilterQuery = BuildCatalogQuery(catalogDefination, catalogRequest); if (!catalogRequest.Filter.SearchExact) { catalogRequest.Filter.Term = '%' + catalogRequest.Filter.Term + '%'; } return(Connection.Query <CatalogData>(catalogFilterQuery, new { FilterValue = catalogRequest.Filter.Term, ShowAll = catalogRequest.Filter.ShowAll }).ToList()); }
public void SampleServerCatalogTest() { string host = "sampleserver1.arcgisonline.com"; string instance = "arcgis"; try { AgsClient agsClient = new AgsClient(host, instance, null, false, null, null); var resp = new CatalogRequest(null).Execute(agsClient); Assert.IsNull(resp.error); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public async Task <bool> AddAsync(CatalogRequest catalogRequest) { //cek di database using (var con = new NpgsqlConnection(_connectionString.ConnString)) { await con.OpenAsync(); var catalog = con.Query <CatalogViewModel>(@"select * from catalog where id_catalog=@idCatalog;", new { catalogRequest.idCatalog }).FirstOrDefault(); if (catalog != null) { } else { } } return(true); }
public override Task <CatalogResponse> GetProducts(CatalogRequest request, ServerCallContext context) { _logger.LogInformation("Calling Catalog"); var products = new List <Product>(); for (var i = 1; i < 5; i++) { products.Add(new Product { Name = $"Product {i}", Description = "Nice description", Image = $"product{i}.jpg", Price = 50 }); } _logger.LogInformation("Called Catalog"); return(Task.FromResult(MapToCatalogResponse(products))); }
public void GeocodeServiceRequestTest() { // http://sampleserver6.arcgisonline.com/arcgis/rest/services/Locators/SanDiego/GeocodeServer string host = "sampleserver6.arcgisonline.com"; string instance = "arcgis"; string folder = "Locators"; string geocodeServiceName = "SanDiego"; try { AgsClient agsClient = new AgsClient(host, instance, null, false, null, null); var folderCatalog = new CatalogRequest(folder).Execute(agsClient); Assert.IsNull(folderCatalog.error); var geocodeService = new GeocodeServiceRequest(geocodeServiceName).Execute(agsClient, folderCatalog); Assert.IsNull(geocodeService.error); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public List <CatalogData> GetCatalogData(CatalogRequest catalogRequest) { return(CatalogComponent.GetCatalogData(catalogRequest)); }
public async Task <IEnumerable <CatalogData> > GetCatalogDataAsync(CatalogRequest catalogRequest) { string catalogFilterQuery = GetCatalogDataQuery(catalogRequest); return(await Connection.QueryAsync <CatalogData>(catalogFilterQuery, new { FilterValue = catalogRequest.Filter.Term, ShowAll = catalogRequest.Filter.ShowAll })); }
public CatalogUpdatedEvent(CatalogRequest catalogRequest) { _catalogRequest = catalogRequest; }
public override async Task TestScenarioSetUp(CategoryTestData testData) { string categoryName = "temporal test category"; CatalogRequest catalogRequest = new CatalogRequest { CreatedBy = "temporal request", PlatformIdentifier = new Guid(ServiceConstants.AllPointsPlatformId), CreatedUtc = DateTime.UtcNow.ToString(), UpdatedUtc = DateTime.UtcNow.ToString(), ExternalIdentifier = testData.CatalogExtId, Identifier = Guid.NewGuid(), Name = "temporal catalog name", }; CategoryRequest categoryRequest = new CategoryRequest { Identifier = testData.ExternalIdentifier, CatalogId = testData.CatalogExtId, CollapseOrder = 1, CreatedBy = "temporal request", IsSubcatalog = false, FullName = categoryName, ShortName = categoryName, UrlSegment = $"{categoryName.Replace(" ", "-")}/", HtmlPage = new HtmlPage { H1 = $"H1 {categoryName}", Meta = $"Meta {categoryName}", Title = $"Title {categoryName}", Url = $"{categoryName.Replace(" ", "-")}/" }, IsMore = false, SortOrder = 1, IsLanding = false, IsTopMenu = false }; //parent category external id was provided if (!string.IsNullOrEmpty(testData.ParentCategoryExtId)) { CategoryRequest parentCategoryRequest = new CategoryRequest { Identifier = testData.ParentCategoryExtId, CatalogId = testData.CatalogExtId, FullName = "parent category name", ShortName = "parent name", CollapseOrder = 1, CreatedBy = "temporal request", HtmlPage = new HtmlPage { Url = "parent/,", H1 = "H1 parent", Meta = "Meta", Title = "Title" }, IsLanding = true, IsSubcatalog = false, SortOrder = 1, UrlSegment = "parent/", IsMore = false, IsTopMenu = false }; await Client.Categories.Create(parentCategoryRequest); categoryRequest.ParentId = testData.ParentCategoryExtId; } await Client.Catalogs.Create(catalogRequest); await Client.Categories.Create(categoryRequest); }
public override async Task TestScenarioSetUp(OfferingTestData testData) { //create catalog CatalogRequest catalogRequest = new CatalogRequest { Name = "Seed catalog name", Identifier = Guid.NewGuid(), CreatedBy = "Seed helper", ExternalIdentifier = testData.CatalogExtId, PlatformIdentifier = new Guid(ServiceConstants.AllPointsPlatformId), CreatedUtc = DateTime.UtcNow.ToString(), UpdatedUtc = DateTime.UtcNow.ToString() }; await Client.Catalogs.Create(catalogRequest); //create a category CategoryRequest categoryRequest = new CategoryRequest { CatalogId = testData.CatalogExtId, Identifier = testData.CategoryExtId, FullName = "sample category name", IsLanding = false, ShortName = "sample name", IsTopMenu = false, UrlSegment = "sample-category-name/", CollapseOrder = 1, HtmlPage = new HtmlPage { H1 = "H1 sample thing", Title = "Title sample thing", Meta = "Meta sample thing", Url = "any-thing/" }, IsSubcatalog = false, IsMore = false, CreatedBy = "temporal test method" }; await Client.Categories.Create(categoryRequest); //create a brand PostBrandRequest brandRequest = new PostBrandRequest { CreatedBy = "temporal test method", CreatedUtc = DateTime.Now.ToString(), UpdatedUtc = DateTime.Now.ToString(), ExternalIdentifier = testData.BrandExtId, Identifier = Guid.NewGuid(), PlatformIdentifier = new Guid(ServiceConstants.AllPointsPlatformId), FullName = "test name", ShortName = "test name short", HtmlPage = new HtmlPage { H1 = "test", Meta = "meta", Title = "test title", Url = "test/" }, Favorability = 2, UrlSegment = "test/" }; await Client.Brands.Create(brandRequest); //create a product ProductRequest productRequest = new ProductRequest { CreatedBy = "temporal product request", Identifier = testData.ProductExtId, Cost = 11, DisplayProductCode = "temporal-sku", IsOcm = false, IsPurchaseable = true, Name = "product test name", ProductCode = "temporal-sku", Prop65Message = new ProductProp65Message { MessageBody = "This product has been created through a test automation tool" }, SearchKeywords = "test,seed", Shipping = new ProductShippingAttributes { FreightClass = 179, IsFreeShip = false, IsFreightOnly = false, IsQuickShip = false, WeightActual = 6.72m, WeightDimensional = 20.62m, Height = 9.61m, Width = 16.48m, Length = 9.60m }, Specs = new List <ProductSpecification> { new ProductSpecification { Name = "name of spec", Value = "value of spec" } }, OemRelationships = new List <ProductOem> { new ProductOem { OemName = "oem name 01", Type = 1, OemSku = "FakeOemSku" } }, ProductLeadType = 1, BrandSku = "fake", PrimaryBrandIdentifier = testData.BrandExtId }; await Client.Products.Create(productRequest); //create a offering string offeringFullName = "temporal frozen Sturkey"; OfferingRequest offeringRequest = new OfferingRequest { CreatedBy = "temporal offering", Identifier = testData.OfferingExtId, CatalogId = testData.CatalogExtId, ProductId = testData.ProductExtId, HomeCategory = testData.CategoryExtId, CategoryIds = new List <string>(), Description = "temporal Description for this offering", FullName = offeringFullName, HtmlPage = new HtmlPage { H1 = $"H1 {offeringFullName}", Title = $"Title {offeringFullName}", Meta = $"Meta {offeringFullName}", Url = $"{offeringFullName.Replace(" ", "-")}" }, IsPublishAble = true, IsPreviewAble = true, Links = new List <OfferingLink>(), }; await Client.Offerings.Create(offeringRequest); }
public async Task POST_Offering_Success() { string offeringFullName = "frozen turkey ready to deploy"; string externalIdentifier = "postOfferingExternal01"; OfferingTestData testData = new OfferingTestData { OfferingExtId = externalIdentifier, CategoryExtId = "offeringCategoryExternal01", CatalogExtId = "offeringCatalogExternal01", ProductExtId = "offeringProductExternal01", BrandExtId = "offeringBrandExternal01" }; //create catalog CatalogRequest catalogRequest = new CatalogRequest { Name = "Seed catalog name", Identifier = Guid.NewGuid(), CreatedBy = "Seed helper", ExternalIdentifier = testData.CatalogExtId, PlatformIdentifier = new Guid(ServiceConstants.AllPointsPlatformId), CreatedUtc = DateTime.UtcNow.ToString(), UpdatedUtc = DateTime.UtcNow.ToString() }; await Client.Catalogs.Create(catalogRequest); //create a category CategoryRequest categoryRequest = new CategoryRequest { CatalogId = testData.CatalogExtId, Identifier = testData.CategoryExtId, FullName = "sample category name", IsLanding = false, ShortName = "sample name", IsTopMenu = false, UrlSegment = "sample-category-name/", CollapseOrder = 1, HtmlPage = new HtmlPage { H1 = "H1 sample thing", Title = "Title sample thing", Meta = "Meta sample thing", Url = "any-thing/" }, IsSubcatalog = false, IsMore = false, CreatedBy = "temporal test method" }; await Client.Categories.Create(categoryRequest); //create a brand PostBrandRequest brandRequest = new PostBrandRequest { CreatedBy = "temporal test method", CreatedUtc = DateTime.Now.ToString(), UpdatedUtc = DateTime.Now.ToString(), ExternalIdentifier = testData.BrandExtId, Identifier = Guid.NewGuid(), PlatformIdentifier = new Guid(ServiceConstants.AllPointsPlatformId), FullName = "test name", ShortName = "test name short", HtmlPage = new HtmlPage { H1 = "test", Meta = "meta", Title = "test title", Url = "test/" }, Favorability = 2, UrlSegment = "test/" }; await Client.Brands.Create(brandRequest); //create a product ProductRequest productRequest = new ProductRequest { CreatedBy = "temporal product request", Identifier = testData.ProductExtId, Cost = 11, DisplayProductCode = "temporal-sku", IsOcm = false, IsPurchaseable = true, Name = "product test name", ProductCode = "temporal-sku", Prop65Message = new ProductProp65Message { MessageBody = "This product has been created through a test automation tool" }, SearchKeywords = "test,seed", Shipping = new ProductShippingAttributes { FreightClass = 179, IsFreeShip = false, IsFreightOnly = false, IsQuickShip = false, WeightActual = 6.72m, WeightDimensional = 20.62m, Height = 9.61m, Width = 16.48m, Length = 9.60m }, Specs = new List <ProductSpecification> { new ProductSpecification { Name = "name of spec", Value = "value of spec" } }, OemRelationships = new List <ProductOem> { new ProductOem { OemName = "oem name 01", Type = 1, OemSku = "FakeOemSku" } }, ProductLeadType = 1, BrandSku = "fake", PrimaryBrandIdentifier = testData.BrandExtId }; await Client.Products.Create(productRequest); OfferingRequest request = new OfferingRequest { Identifier = externalIdentifier, CatalogId = testData.CatalogExtId, ProductId = testData.ProductExtId, HomeCategory = testData.CategoryExtId, CategoryIds = new List <string>(), Description = "Description for this offering p:", FullName = offeringFullName, HtmlPage = new HtmlPage { H1 = $"H1 {offeringFullName}", Title = $"Title {offeringFullName}", Meta = $"Meta {offeringFullName}", Url = $"{offeringFullName.Replace(" ", "-")}" }, IsPublishAble = true, IsPreviewAble = true, Links = new List <OfferingLink>(), CreatedBy = "post offering request" }; HttpResponseExtended <OfferingResponse> response = await Client.Offerings.Create(request); Assert.IsNotNull(response, $"{nameof(response)} cannot be null"); Assert.AreEqual(200, response.StatusCode); Assert.IsTrue(response.Success, $"Response status is not successful"); Assert.IsNotNull(response.Result, $"{nameof(response.Result)} is null"); //test scenario clean up await TestScenarioCleanUp(testData); }
public Task <IEnumerable <CatalogData> > GetCatalogDataAsync(CatalogRequest catalogRequest) { return(CatalogComponent.GetCatalogDataAsync(catalogRequest)); }
public async Task POST_Category_Success() { string categoryName = "temporal category"; //test scenario setup CategoryTestData testData = new CategoryTestData { ExternalIdentifier = "postCategory01", CatalogExtId = "postCategoryCatalog01", ParentCategoryExtId = "postCategoryParent01" }; //create catalog CatalogRequest catalogRequest = new CatalogRequest { ExternalIdentifier = testData.CatalogExtId, PlatformIdentifier = new Guid(ServiceConstants.AllPointsPlatformId), CreatedUtc = DateTime.UtcNow.ToString(), UpdatedUtc = DateTime.UtcNow.ToString(), CreatedBy = "temporal catalog", Identifier = Guid.NewGuid(), Name = "temporal catalog name", }; await Client.Catalogs.Create(catalogRequest); //create parent category CategoryRequest parentCategoryRequest = new CategoryRequest { CatalogId = testData.CatalogExtId, FullName = categoryName, CollapseOrder = 1, CreatedBy = "temporal request", Identifier = testData.ParentCategoryExtId, UrlSegment = "sample-category/", HtmlPage = new HtmlPage { H1 = "H1 sample title", Title = "Title ", Meta = "Meta ", Url = "url/" }, IsLanding = false, IsMore = false, IsSubcatalog = false, SortOrder = 1, ShortName = "parent short name", IsTopMenu = false }; await Client.Categories.Create(parentCategoryRequest); CategoryRequest request = new CategoryRequest { CatalogId = testData.CatalogExtId, CollapseOrder = 1, Identifier = testData.ExternalIdentifier, FullName = categoryName, IsLanding = false, IsTopMenu = false, ParentId = testData.ParentCategoryExtId, HtmlPage = new HtmlPage { H1 = $"H1 {categoryName}", Meta = $"Meta {categoryName}", Title = $"Title {categoryName}", Url = $"{testData.ParentCategoryExtId}/{categoryName.Replace(" ", "-")}/".ToLower() }, ShortName = categoryName, SortOrder = 0, UrlSegment = $"{categoryName.Replace(" ", "-")}/" }; HttpResponseExtended <CategoryResponse> response = await Client.Categories.Create(request); Assert.IsNotNull(response, $"{nameof(response)} should not be null"); Assert.AreEqual(200, response.StatusCode); Assert.IsTrue(response.Success, $"Response status is not successful"); Assert.IsNotNull(response.Result, "Result object should not be null"); //TODO //post specific validations //test scenario clean up await TestScenarioCleanUp(testData); }
public List <CatalogData> GetCatalogData(CatalogRequest catalogRequest) { return(CatalogService.GetCatalogData(catalogRequest)); }
public IEnumerable <CatalogData> GetCatalogData(CatalogRequest catalogRequest) { string catalogFilterQuery = GetCatalogDataQuery(catalogRequest); return(Connection.Query <CatalogData>(catalogFilterQuery, new { FilterValue = catalogRequest.Filter.Term, ShowAll = catalogRequest.Filter.ShowAll }).ToList()); }
public async Task <IEnumerable <CatalogData> > GetCatalogDataAsync(CatalogRequest catalogRequest) { return(await CatalogService.GetCatalogDataAsync(catalogRequest)); }
public override async Task <HttpResponseExtended <CatalogResponse> > Create(CatalogRequest postRequest) { MethodUrl = ""; return(await base.Create(postRequest)); }