示例#1
0
        //product.saleStatus
        //1: Satış Öncesi(Before_Sale)
        //2: Satışta(On_Sale)
        //3: Stok yok(Out of_Stock)
        //4: Satışa kapalı(Sale_Closed)



        //product.approvalStatus Ürün onay durumu:
        //1: Aktif(Satışta)
        //2: Beklemede
        //3: Yasaklı



        public void ProducktGetir(string SaticiUrunKodu) // yani stok kodu olarak ne verdiysen o işte
        {
            try
            {
                String         strSellerCode  = SaticiUrunKodu;
                Authentication authentication = new Authentication();
                authentication.appKey    = strAppKey;
                authentication.appSecret = strAppSecret;

                GetProductBySellerCodeRequest request = new GetProductBySellerCodeRequest();
                request.auth       = authentication;
                request.sellerCode = strSellerCode;

                n11ProductService.ProductServicePortService port = new n11ProductService.ProductServicePortService();
                //ProductServicePort port = new ProductServicePortService().getProductServicePortSoap11();
                GetProductBySellerCodeResponse response = port.GetProductBySellerCode(request);

                this.title             = response.product.title;
                this.subtitle          = response.product.subtitle;
                this.category          = response.product.category;
                this.description       = response.product.description;       // detay
                this.displayPrice      = response.product.displayPrice;      // Görüntülenen ürün fiyatı(Ürünün indirimler sonucu tanımlanan son fiyat hali)
                this.discount          = response.product.discount;          // indirim
                this.preparingDay      = response.product.preparingDay;      // hazırlama zamanı
                this.price             = response.product.price;             // Ürünün baz fiyatı
                this.approvalStatus    = response.product.approvalStatus;    // onay durumu
                this.attributes        = response.product.attributes;        // özellikleri biz değiştiremiyoruz n11 den kategoriye göre geliyor. attributes[0].name (bu hep marka)
                this.productSellerCode = response.product.productSellerCode; // bizdeki stok kodu
                this.shipmentTemplate  = response.product.shipmentTemplate;
                this.Foto = response.product.images;
                //this.PreparingDay = Convert.ToInt32(response.product.preparingDay);

                productCondition = response.product.productCondition;

                stockItems = response.product.stockItems;

                //response.product.attributes = new ProductAttribute;
            }
            catch (Exception)
            {
                throw;
            }
        }
        public void UrunlistesiniGetir()
        {
            //Authentication authentication = new Authentication();
            authentication.appKey = strAppKey;

            authentication.appSecret = strAppSecret;

            RequestPagingData requestPagingData = new RequestPagingData();

            requestPagingData.currentPage = currentPageValue;
            requestPagingData.pageSize    = pageSizeValue;

            GetProductListRequest getProductListRequest = new GetProductListRequest();

            getProductListRequest.auth       = authentication;
            getProductListRequest.pagingData = requestPagingData;

            n11ProductService.ProductServicePortService port = new n11ProductService.ProductServicePortService();
            GetProductListResponse response = port.GetProductList(getProductListRequest);

            if (productList == null)
            {
                this.productList = response.products.ToList();
            }
            else
            {
                productList.AddRange(response.products);
            }


            //productList[0].stockItems.stockItem.

            if (response.pagingData.currentPage != response.pagingData.pageCount - 1) //son sayfaya kadar gidiyoruz
            {
                currentPageValue = (int)response.pagingData.currentPage + 1;
                UrunlistesiniGetir();
            }
            //return productList;
        }
        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);
        }