private void button1_Click_1(object sender, EventArgs e) { var authentication1 = new com.n11.api.Authentication(); authentication1.appKey = apiAnahtari1; //api anahtarınız authentication1.appSecret = apiSifresi1; //api şifeniz ProductServicePortService prodServ = new ProductServicePortService(); SaveProductRequest saveRequest = new SaveProductRequest(); //marka, tarih aralığı saveRequest.auth = authentication1; saveRequest.product = new ProductRequest(); saveRequest.product.productSellerCode = txtMagazaKodu.Text; saveRequest.product.title = txtUrunBasligi.Text; saveRequest.product.subtitle = txtaltBaslik.Text; saveRequest.product.description = richTextBox1.Text; saveRequest.product.category = new CategoryRequest(); saveRequest.product.category.id = Convert.ToInt32(txtUrunKategoriNo.Text); saveRequest.product.price = Convert.ToDecimal(txtFiyati.Text); saveRequest.product.currencyType = comboBox1.Text; ProductImage prImg = new ProductImage(); ProductImage[] pr = new ProductImage[1]; pr[0] = prImg; string resimUrl = urunResimlericmbBox.Text.Replace("https", "http"); prImg.url = resimUrl; prImg.order = "1"; saveRequest.product.images = pr; saveRequest.product.productCondition = txtUrunDurumu.Text; saveRequest.product.preparingDay = txtprodPrepDay.Text; saveRequest.product.shipmentTemplate = txtKargoSablonu.Text; ProductSkuRequest prStock = new ProductSkuRequest(); prStock.quantity = txtStokMiktari.Text; prStock.optionPrice = Convert.ToDecimal(txtFiyati.Text); ProductSkuRequest[] prStockList = new ProductSkuRequest[1]; prStockList[0] = prStock; saveRequest.product.stockItems = prStockList; SaveProductResponse saveResponse = prodServ.SaveProduct(saveRequest); if (saveResponse.result.errorCode == null) { MessageBox.Show("ürün kaydedildi"); } else { MessageBox.Show("ürün kaydedilmedi"); MessageBox.Show(saveResponse.result.errorMessage); } }
private void btnGuncelle_Click(object sender, EventArgs e) { var authentication1 = new com.n11.api.Authentication(); authentication1.appKey = apiAnahtari1; //api anahtarınız authentication1.appSecret = apiSifresi1; //api şifeniz ProductServicePortService prodServ = new ProductServicePortService(); }
} //Ürün stok miktarı public void TemelOzellikleriGuncelle() { String strAppKey = "***"; String strAppSecret = "***"; String strProdSellerCode = ""; String strDiscountStartDate = ""; String strDiscountEndDate = ""; String strSellerStockCode = ""; double priceDec = 125.00; long productIdVal = 258491025; int discountTypeVal = 2; int discountValueVal = 25; int stockQuantityVal = 0; int stockIdVal = 0; double stockOptionPriceVal = 0; Authentication authentication = new Authentication(); authentication.appKey = strAppKey; authentication.appSecret = strAppSecret; SellerProductDiscount sellerProductDiscount = new SellerProductDiscount(); sellerProductDiscount.discountType = discountTypeVal.ToString(); sellerProductDiscount.discountValue = discountValueVal; sellerProductDiscount.discountStartDate = strDiscountStartDate; sellerProductDiscount.discountEndDate = strDiscountEndDate; ProductUpdateSkuBasicRequest productUpdateSkuBasicRequest = new ProductUpdateSkuBasicRequest(); productUpdateSkuBasicRequest.sellerStockCode = strSellerStockCode; productUpdateSkuBasicRequest.optionPrice = (decimal)stockOptionPriceVal; productUpdateSkuBasicRequest.id = stockIdVal; List <ProductUpdateSkuBasicRequest> productUpdateSkuBasicRequestItemList = new List <ProductUpdateSkuBasicRequest>(); productUpdateSkuBasicRequestItemList.Add(productUpdateSkuBasicRequest); UpdateProductBasicRequest request = new UpdateProductBasicRequest(); request.productSellerCode = strProdSellerCode; request.price = (decimal)priceDec; request.auth = authentication; request.productId = productIdVal; request.productDiscount = sellerProductDiscount; request.stockItems = productUpdateSkuBasicRequestItemList.ToArray(); ProductServicePortService port = new ProductServicePortService(); UpdateProductBasicResponse response = port.UpdateProductBasic(request); //System.out.println(response.getProduct().getId() + " Display price:" // + response.getProduct().getDisplayPrice() + " Price:" + response.getProduct().getPrice()); }
public UpdateProductBasicResponse UpdateProductBasic(Urun urun) { string siteUrl = string.Format("{0}://{1}{2}{3}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port == 80 ? string.Empty : ":" + HttpContext.Current.Request.Url.Port, HttpContext.Current.Request.ApplicationPath); #if DEBUG siteUrl = "https://aysemtuhafiye.com"; #endif Product product = GetProductBySellerCode(urun.urunID); com.n11Product.api.Authentication authentication = new com.n11Product.api.Authentication { appKey = apiKey, appSecret = apiSecret }; ProductImage[] productImages = new ProductImage[urun.urunResimleri.Count]; for (int i = 0; i < urun.urunResimleri.Count; i++) { ProductImage productImage = new ProductImage(); productImage.url = siteUrl + "/Content/icerik/urun/orjinal/" + urun.urunResimleri[i].resim; productImage.order = urun.urunResimleri[i].sira.ToString(); productImages[i] = productImage; } ProductUpdateSkuBasicRequest[] productUpdateSkuBasicRequests = new ProductUpdateSkuBasicRequest[1]; ProductUpdateSkuBasicRequest productUpdateSkuBasicRequest = new ProductUpdateSkuBasicRequest(); productUpdateSkuBasicRequest.quantity = urun.miktar.ToString(); productUpdateSkuBasicRequest.optionPrice = urun.entegrasyonBilgi.GetN11Fiyat(urun.fiyat); productUpdateSkuBasicRequest.id = product.stockItems.stockItem[0].id; productUpdateSkuBasicRequests[0] = productUpdateSkuBasicRequest; UpdateProductBasicRequest updateProductBasicRequest = new UpdateProductBasicRequest(); updateProductBasicRequest.auth = authentication; updateProductBasicRequest.description = urun.urunAciklamasi; updateProductBasicRequest.images = productImages; updateProductBasicRequest.price = urun.entegrasyonBilgi.GetN11Fiyat(urun.fiyat); updateProductBasicRequest.productId = urun.entegrasyonBilgi.n11UrunID; //updateProductBasicRequest.productSellerCode = urun.urunID.ToString(); updateProductBasicRequest.stockItems = productUpdateSkuBasicRequests; ProductServicePortService port = new ProductServicePortService(); UpdateProductBasicResponse updateProductBasicResponse = port.UpdateProductBasic(updateProductBasicRequest); return(updateProductBasicResponse); }
//public MagazaStokKoduIleStokMiktariArttir() //{ // //String strAppKey = "***"; // //String strAppSecret = "***"; // String strSellerStockCode = "StokKod1234567"; // int quantityIncreaseValue = 10; // long versionValue = 9; // Authentication authentication = new Authentication(); // authentication.appKey = strAppKey; // authentication.appSecret = strAppSecret; // n11ProductStockService.StockItemForAddStockWithSellerStockCodeList stockList = new StockItemForAddStockWithSellerStockCodeList(); // StockItemForAddStockWithSellerStockCode stockItem = new StockItemForAddStockWithSellerStockCode(); // stockItem.setVersion(versionValue); // stockItem.setQuantityToIncrease(BigInteger.valueOf(quantityIncreaseValue)); // stockItem.setSellerStockCode(strSellerStockCode); // stockList.getStockItem().add(stockItem); // IncreaseStockByStockSellerCodeRequest request = new IncreaseStockByStockSellerCodeRequest(); // request.setAuth(authentication); // request.setStockItems(stockList); // ProductStockServicePort port = new ProductStockServicePortService().getProductStockServicePortSoap11(); // IncreaseStockByStockSellerCodeResponse response = port.increaseStockByStockSellerCode(request); // System.out.println("Increasing status is " + response.getResult().getStatus().getValue()); //} public void StokFiyatiGuncelle(string StokKoud, decimal Fiyati) { try { //String strAppKey = "***"; //String strAppSecret = "***"; String strSellerCode = StokKoud; String strSellerStockCode = StokKoud; int currencyTypeValue = 1; decimal optionalPriceValue = Fiyati; decimal priceValue = Fiyati; n11ProductService.Authentication authentication = new Authentication(); authentication.appKey = strAppKey; authentication.appSecret = strAppSecret; List <n11ProductService.ProductSkuBasicRequest> productSkuBasicRequestItemList = new List <ProductSkuBasicRequest>(); n11ProductService.ProductSkuRequest productSkuRequest = new ProductSkuRequest(); productSkuRequest.sellerStockCode = strSellerStockCode; productSkuRequest.optionPrice = Convert.ToDecimal(optionalPriceValue); UpdateProductPriceBySellerCodeRequest request = new UpdateProductPriceBySellerCodeRequest(); request.auth = authentication; request.currencyType = currencyTypeValue.ToString(); request.stockItems = productSkuBasicRequestItemList.ToArray(); request.price = Convert.ToDecimal(priceValue); request.productSellerCode = strSellerCode; //n11ProductService.ProductServicePortService port = new ProductServicePortService().getProductServicePortSoap11(); n11ProductService.ProductServicePortService port = new ProductServicePortService(); UpdateProductPriceBySellerCodeResponse response = port.UpdateProductPriceBySellerCode(request); ProductBasic sampleProduct = response.product; } catch (Exception ex) { throw ex; } //authentication = new Authentication(); }
private static Product product(long prodId) { var authentication1 = new com.n11.api.Authentication(); authentication1.appKey = apiAnahtari1; //api anahtarınız authentication1.appSecret = apiSifresi1; //api şifeniz ProductServicePortService proxy = new ProductServicePortService(); GetProductByProductIdRequest request = new GetProductByProductIdRequest(); request.auth = authentication1; request.productId = prodId; GetProductByProductIdResponse response = new GetProductByProductIdResponse(); var product = proxy.GetProductByProductId(request).product; return(product); }
public Product GetProductBySellerCode(int urunID) { com.n11Product.api.Authentication authentication = new com.n11Product.api.Authentication { appKey = apiKey, appSecret = apiSecret }; GetProductBySellerCodeRequest getProductBySellerCodeRequest = new GetProductBySellerCodeRequest(); getProductBySellerCodeRequest.auth = authentication; getProductBySellerCodeRequest.sellerCode = urunID.ToString(); ProductServicePortService port = new ProductServicePortService(); GetProductBySellerCodeResponse getProductBySellerCodeResponse = port.GetProductBySellerCode(getProductBySellerCodeRequest); Product product = getProductBySellerCodeResponse.product; return(product); }
private static Product getProdDetails(long prodId) { var authentication1 = new com.n11.api.Authentication(); authentication1.appKey = apiAnahtari1; //api anahtarınız authentication1.appSecret = apiSifresi1; //api şifeniz com.n11.api.GetProductByProductIdRequest ProductRequest = new com.n11.api.GetProductByProductIdRequest(); ProductRequest.auth = authentication1; com.n11.api.ProductServicePortService port = new ProductServicePortService(); ProductRequest.productId = prodId; com.n11.api.GetProductByProductIdResponse response = port.GetProductByProductId(ProductRequest); var product = response.product; return(product); }
private static ProductBasic[] getProds() { setProxy(); var authentication1 = new com.n11.api.Authentication(); authentication1.appKey = apiAnahtari1; //api anahtarınız authentication1.appSecret = apiSifresi1; //api şifeniz com.n11.api.GetProductListRequest ProductListRequest = new com.n11.api.GetProductListRequest(); ProductListRequest.auth = authentication1; com.n11.api.ProductServicePortService port = new ProductServicePortService(); com.n11.api.GetProductListResponse response = port.GetProductList(ProductListRequest); var products = response.products; return(products); }
public ProductBasic[] GetProductList() { com.n11Product.api.Authentication authentication = new com.n11Product.api.Authentication { appKey = apiKey, appSecret = apiSecret }; com.n11Product.api.RequestPagingData requestPagingData = new com.n11Product.api.RequestPagingData(); requestPagingData.currentPage = 0; requestPagingData.pageSize = 10; GetProductListRequest getProductListRequest = new GetProductListRequest(); getProductListRequest.auth = authentication; getProductListRequest.pagingData = requestPagingData; ProductServicePortService port = new ProductServicePortService(); GetProductListResponse getProductListResponse = port.GetProductList(getProductListRequest); ProductBasic[] productBasics = getProductListResponse.products; return(productBasics); }
private static ProductBasic[] getProds() { apiAnahtari1 = "dbd6f8d0-52c1-4675-ab4d-3efc2badb56c"; apiSifresi1 = "iDg6PakWEtkcLrea"; var authentication1 = new n11Api.com.n11.api.Authentication(); authentication1.appKey = apiAnahtari1; //api anahtarınız authentication1.appSecret = apiSifresi1; //api şifeniz GetProductListRequest ProductListRequest = new GetProductListRequest(); ProductListRequest.auth = authentication1; ProductServicePortService port = new ProductServicePortService(); GetProductListResponse response = port.GetProductList(ProductListRequest); var products = response.products; return(products); }
public KayitIslemi ahandaaa() { try { //String strAppKey = "64155786-da91-4204-8735-443d17acf808"; //String strAppSecret = "***"; String strUrl = FotoUrl; String strSellerStockCode = productSellerCode; //String strSellerStockCode1 = "KırmızıKod-APIDeneme4321000000000"; String strAttributeName = "Marka"; String strAttributeValue = "Apple"; String strSkuAttributeKey = "Renk"; String strSkuAttributeValue = "Mavi"; String strSkuAttributeValue1 = "Kırmızı"; String strProductTitle = "Lorem ipsum"; String strProductSubtitle = "Lorem ipsum dolor sit amet"; String strProductSellerCode = productSellerCode; String strProductCondition = "1"; // 1 yeni, 2 ikinci el String strShipmentTemplate = "AGT"; //String strProductDescription = this.description; String strGtin = "0190198066473"; String strGtin1 = "0190198066474"; int setOrderValue = 1; int quantityValue = 10; int quantityValue1 = 20; int categoryIdValue = 592; int priceValue = 50; int currencyTypeValue = 1; int approvalStatusValue = 1; int preparingDayValue = 3; Authentication authentication = new Authentication(); authentication.appKey = strAppKey; authentication.appSecret = strAppSecret; ProductImage productImage = new ProductImage(); List <ProductImage> productImageList = new List <ProductImage>(); productImage.url = strUrl; productImage.order = "1"; // foto sırası bu productImageList.Add(productImage); //List<ProductAttributeRequest> skuAttributeRequestList = new List<ProductAttributeRequest>(); //ProductAttributeRequest skuAttributeRequest = new ProductAttributeRequest(); //skuAttributeRequest.name = strSkuAttributeKey; //skuAttributeRequest.value = strSkuAttributeValue; //skuAttributeRequestList.Add(skuAttributeRequest); //List<ProductAttributeRequest> skuAttributeRequestList1 = new List<ProductAttributeRequest>(); //ProductAttributeRequest skuAttributeRequest1 = new ProductAttributeRequest(); //skuAttributeRequest1.name = strSkuAttributeKey; //skuAttributeRequest1.value = strSkuAttributeValue1; //skuAttributeRequestList1.Add(skuAttributeRequest1); List <ProductSkuRequest> stockItems = new List <ProductSkuRequest>(); foreach (ProductSku item in this.stockItems.stockItem) { ProductSkuRequest sku1 = new ProductSkuRequest(); sku1.sellerStockCode = item.sellerStockCode; foreach (var item2 in item.attributes) { List <ProductAttributeRequest> skuAttributeRequestList1 = new List <ProductAttributeRequest>(); ProductAttributeRequest skuAttributeRequest1 = new ProductAttributeRequest(); skuAttributeRequest1.name = item2.name; skuAttributeRequest1.value = item2.value; skuAttributeRequestList1.Add(skuAttributeRequest1); //skuAttributeRequest1.name = strSkuAttributeKey; //skuAttributeRequest1.value = strSkuAttributeValue1; //skuAttributeRequestList1.Add(skuAttributeRequest1); sku1.attributes = skuAttributeRequestList1.ToArray(); } sku1.quantity = item.quantity; sku1.optionPrice = item.optionPrice; sku1.gtin = item.gtin; stockItems.Add(sku1); } //ProductSkuRequest sku = new ProductSkuRequest(); //sku = this.stockItems; //sku.sellerStockCode = strSellerStockCode; //sku.attributes = skuAttributeRequestList1.ToArray();// (skuAttributeRequestList); //sku.quantity = quantityValue.ToString(); //sku.gtin = strGtin; //ProductSkuRequest sku1 = new ProductSkuRequest(); ////sku1.sellerStockCode = strSellerStockCode1; //sku1.attributes = skuAttributeRequestList1.ToArray(); //sku1.quantity = quantityValue1.ToString(); //sku1.gtin = strGtin1; //stockItems.Add(sku); //stockItems.Add(sku1); CategoryRequest categoryRequest = new CategoryRequest(); categoryRequest.id = category.id; //ProductAttributeRequest productAttribute = new ProductAttributeRequest(); //productAttribute.name = strAttributeName; //productAttribute.value = strAttributeValue; //List<ProductAttributeRequest> productAttributeRequestList = new List<ProductAttributeRequest>(); //productAttributeRequestList.Add(this.attributes[0]); //productAttributeRequestList.Add(productAttribute); ProductRequest productRequest = new ProductRequest(); productRequest.title = this.title; productRequest.subtitle = this.subtitle; productRequest.description = this.description; productRequest.category = categoryRequest; productRequest.productSellerCode = this.productSellerCode; productRequest.price = this.price; productRequest.currencyType = "1"; productRequest.images = this.Foto; productRequest.approvalStatus = this.approvalStatus; productRequest.preparingDay = this.preparingDay; productRequest.stockItems = stockItems.ToArray(); //productRequest.stockItems = this.stostockItems.ToArray(); productRequest.productCondition = strProductCondition; productRequest.shipmentTemplate = this.shipmentTemplate; //productRequest.attributes = this.proproductAttributeRequestList.ToArray(); SaveProductRequest saveProductRequest = new SaveProductRequest(); saveProductRequest.auth = authentication; saveProductRequest.product = productRequest; ProductServicePortService port = new ProductServicePortService(); SaveProductResponse response = port.SaveProduct(saveProductRequest); //ResultInfo info = new ResultInfo(); if (response.result.status == "failure") { return(KayitIslemi.Basarisiz); } else if (response.result.status == "failure") { return(KayitIslemi.Basarili); } else { return(KayitIslemi.AgabuNe); } //System.out.println("Saving product " + response.getProduct().getId() + " is " + response.getResult().getStatus().getValue()); } catch (Exception ex) { throw ex; } }
public SaveProductResponse SaveProduct(Urun urun) { string siteUrl = string.Format("{0}://{1}{2}{3}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port == 80 ? string.Empty : ":" + HttpContext.Current.Request.Url.Port, HttpContext.Current.Request.ApplicationPath); #if DEBUG siteUrl = "https://aysemtuhafiye.com"; #endif com.n11Product.api.Authentication authentication = new com.n11Product.api.Authentication { appKey = apiKey, appSecret = apiSecret }; CategoryRequest categoryRequest = new CategoryRequest(); categoryRequest.id = urun.entegrasyonBilgi.n11KategoriID; ProductImage[] productImages = new ProductImage[urun.urunResimleri.Count]; for (int i = 0; i < urun.urunResimleri.Count; i++) { ProductImage productImage = new ProductImage(); productImage.url = siteUrl + "/Content/icerik/urun/orjinal/" + urun.urunResimleri[i].resim; productImage.order = urun.urunResimleri[i].sira.ToString(); productImages[i] = productImage; } //ProductAttributeRequest[] productAttributeRequests = new ProductAttributeRequest[0]; /* * ProductDiscountRequest productDiscountRequest = new ProductDiscountRequest(); * productDiscountRequest.startDate = "dd/MM/yyyy"; * productDiscountRequest.endDate = "dd/MM/yyyy"; * productDiscountRequest.type = ""; * productDiscountRequest.value = "1"; */ ProductSkuRequest[] productSkuRequests = new ProductSkuRequest[1]; ProductSkuRequest productSkuRequest = new ProductSkuRequest(); productSkuRequest.quantity = urun.miktar.ToString(); productSkuRequest.optionPrice = urun.entegrasyonBilgi.GetN11Fiyat(urun.fiyat); productSkuRequests[0] = productSkuRequest; ProductRequest productRequest = new ProductRequest(); productRequest.productSellerCode = urun.urunID.ToString(); productRequest.title = urun.urunAdi; productRequest.subtitle = urun.urunAdi; productRequest.description = urun.urunAciklamasi; //productRequest.attributes = productAttributeRequests;//Özellik ve değerleri productRequest.category = categoryRequest; productRequest.price = urun.entegrasyonBilgi.GetN11Fiyat(urun.fiyat); productRequest.currencyType = "TL";//USD|EUR|TL productRequest.images = productImages; //productRequest.saleStartDate = "dd/MM/yyyy";//Satışa başlama tarihi //productRequest.saleEndDate = "dd/MM/yyyy";//Satışı bitirme tarihi //productRequest.productionDate = "dd/MM/yyyy";//Üretim tarihi //productRequest.expirationDate = "dd/MM/yyyy";//Son kullanma tarihi productRequest.productCondition = "1";//1:Yeni|2:2.El productRequest.preparingDay = (urun.kargoSuresi < 1 ? 1 : urun.kargoSuresi).ToString(); //productRequest.domestic = true;//Yerli ürün mü true|false //productRequest.discount = productDiscountRequest;//İndirim bilgisi productRequest.shipmentTemplate = urun.entegrasyonBilgi.n11TemplateName; productRequest.stockItems = productSkuRequests; //productRequest.groupAttribute = ""; //productRequest.groupItemCode = ""; //productRequest.itemName = ""; //productRequest.maxPurchaseQuantity = "1";//Maximum satın alma miktarı SaveProductRequest saveProductRequest = new SaveProductRequest(); saveProductRequest.auth = authentication; saveProductRequest.product = productRequest; ProductServicePortService port = new ProductServicePortService(); SaveProductResponse saveProductResponse = port.SaveProduct(saveProductRequest); if (saveProductResponse.result.status == "success") { new EntegrasyonBilgi().N11UrunIDGuncelle(urun.urunID, saveProductResponse.product.id); } return(saveProductResponse); }