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; } }
void hamisina() { var authentication = new n11ProductService.Authentication(); authentication.appKey = "66e296ef-ba12-4c7a-8d3f-67027f1e1962"; //api anahtarınız authentication.appSecret = "OiVekmVJRKC2wi0X"; //api şifeniz var productImageList = new List <ProductImage>(); var productImage = new ProductImage(); productImage.url = "http://www.cikolatacerez.com/images/products/00/02/70/270_buyuk_zoom.jpg"; productImage.order = "1"; //sıra; productImageList.Add(productImage); var stockItems = new List <ProductSkuRequest>(); var sku1 = new ProductSkuRequest(); sku1.sellerStockCode = "1"; //stokkodu; sku1.quantity = "1"; //Stokmiktar; sku1.optionPrice = 105; // Stok Fiyatı stockItems.Add(sku1); var categoryRequest = new CategoryRequest(); categoryRequest.id = 1356;// Ürünü bağlayacağınız kategoriId ProductRequest productRequest = new ProductRequest(); productRequest.productSellerCode = "1"; productRequest.title = "MEHMET ALİ HASAN"; productRequest.subtitle = "BUAYA AÇIKLAMA LAZIM"; productRequest.description = "AçıklamaWEWQE"; productRequest.category = categoryRequest; productRequest.price = 105; //Ürün Fiyatı productRequest.currencyType = "9999"; //Döviztipi productRequest.images = productImageList.ToArray(); productRequest.approvalStatus = "1"; // 1: Onaylanmış ürün | 0: Beklemede productRequest.preparingDay = "3"; //Ürün Hazırlık Süresi; productRequest.stockItems = stockItems.ToArray(); productRequest.productCondition = "1"; // 1 Yeni Ürün | 2 İkinci El productRequest.shipmentTemplate = "AKİDE"; //Kargo Şablon adı; var attr = new ProductAttributeRequest(); attr.name = "Marka"; attr.value = "Ahs"; var attList = new List <ProductAttributeRequest>(); attList.Add(attr); productRequest.attributes = attList.ToArray(); var discount = new ProductDiscountRequest(); discount.type = "3"; //1: İndirim Tutarı Cinsinden | 2: İndirim Oranı Cinsinden | 3: İndirimli Fiyat Cinsinden discount.value = "80"; // % olarak indirim productRequest.discount = discount; var saveProductRequest = new SaveProductRequest(); saveProductRequest.auth = authentication; saveProductRequest.product = productRequest; // ProductServicePort port = new ProductServicePortService().getProductServicePortSoap11(); var port = new n11ProductService.ProductServicePortService(); SaveProductResponse saveProductResponse = port.SaveProduct(saveProductRequest); MessageBox.Show(saveProductResponse.result.errorMessage); }