/// <summary>
 ///
 /// </summary>
 /// <param name="ApiContext">The <see cref="ApiCall.ApiContext"/> for this API Call of type <see cref="ApiContext"/>.</param>
 public GetSellingManagerTemplatesCall(ApiContext ApiContext)
 {
     ApiRequest      = new GetSellingManagerTemplatesRequestType();
     this.ApiContext = ApiContext;
 }
 /// <summary>
 ///
 /// </summary>
 public GetSellingManagerTemplatesCall()
 {
     ApiRequest = new GetSellingManagerTemplatesRequestType();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 
 /// </summary>
 public GetSellingManagerTemplatesCall()
 {
     ApiRequest = new GetSellingManagerTemplatesRequestType();
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="ApiContext">The <see cref="ApiCall.ApiContext"/> for this API Call of type <see cref="ApiContext"/>.</param>
 public GetSellingManagerTemplatesCall(ApiContext ApiContext)
 {
     ApiRequest = new GetSellingManagerTemplatesRequestType();
     this.ApiContext = ApiContext;
 }
Ejemplo n.º 5
0
        public static EbayStockInfo GetEbayStockInfo(Article article)
        {
            Int32 active     = 0;
            Int32 availiable = 0;
            Int32 template   = 0;

            try
            {
                var articleNumber = article.MasterArticle == null ? article.ArticleNumber : article.MasterArticle.ArticleNumber;
                SellingManagerProductType ebayProduct = EbayController.GetSellingManagerProductTypeByArticle(articleNumber);

                if (article.MasterArticle != null)
                {
                    var variation = ebayProduct.SellingManagerProductSpecifics.Variations.Variation
                                    .ToArray()
                                    .FirstOrDefault(runner => runner.SKU == article.ArticleNumber);
                    var status = variation.SellingManagerProductInventoryStatus;

                    active =
                        variation.SellingManagerProductInventoryStatus.QuantityActiveSpecified ?
                        variation.SellingManagerProductInventoryStatus.QuantityActive :
                        0;
                    availiable = variation.UnitsAvailable;
                }
                else
                {
                    if (ebayProduct != null)
                    {
                        active =
                            ebayProduct.SellingManagerProductInventoryStatus.QuantityActiveSpecified ?
                            ebayProduct.SellingManagerProductInventoryStatus.QuantityActive :
                            0;

                        availiable =
                            ebayProduct.SellingManagerProductDetails.QuantityAvailableSpecified ?
                            ebayProduct.SellingManagerProductDetails.QuantityAvailable :
                            0;

                        if (ebayProduct.SellingManagerTemplateDetailsArray.Count > 0)
                        {
                            GetSellingManagerTemplatesCall call = new GetSellingManagerTemplatesCall(apiContext);

                            GetSellingManagerTemplatesRequestType request = new GetSellingManagerTemplatesRequestType();
                            request.Version        = Assembly.GetExecutingAssembly().GetName().Version.ToString();
                            request.SaleTemplateID = new Int64Collection();

                            foreach (SellingManagerTemplateDetailsType item in ebayProduct.SellingManagerTemplateDetailsArray)
                            {
                                request.SaleTemplateID.Add(Convert.ToInt64(item.SaleTemplateID));
                            }

                            GetSellingManagerTemplatesResponseType response = new GetSellingManagerTemplatesResponseType();
                            response = (GetSellingManagerTemplatesResponseType)call.ExecuteRequest(request);

                            if (response.Ack == AckCodeType.Success)
                            {
                                foreach (SellingManagerTemplateDetailsType item in response.SellingManagerTemplateDetailsArray)
                                {
                                    template += item.Template.Quantity;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Can set ebay template amount for " + article.ArticleNumber, ex);
            }

            return(new EbayStockInfo(template, active, availiable));
        }