Ejemplo n.º 1
0
        private static void AddItem(ApiContext apiContext, ItemType item)
        {
            AddItemCall apiCall = new AddItemCall(apiContext);

            apiContext.ApiLogManager.RecordMessage("Beginning to call eBay, please wait...", MessageType.Information, MessageSeverity.Informational);

            try
            {
                FeeTypeCollection fees = apiCall.AddItem(item);
                apiContext.ApiLogManager.RecordMessage("Completed the call", MessageType.Information, MessageSeverity.Informational);

                apiContext.ApiLogManager.RecordMessage("The item was listed successfully", MessageType.Information, MessageSeverity.Informational);
                apiContext.ApiLogManager.RecordMessage("*************** BEGINNING OF THE LIST", MessageType.Information, MessageSeverity.Informational);
                foreach (FeeType i in fees)
                {
                    apiContext.ApiLogManager.RecordMessage(String.Format("{0} = {1}", i.Name, i.Fee.Value), MessageType.Information, MessageSeverity.Informational);
                }
                apiContext.ApiLogManager.RecordMessage("*************** END OF THE LIST", MessageType.Information, MessageSeverity.Informational);
            }
            catch (Exception e)
            {
                apiContext.ApiLogManager.RecordMessage(e.Message, MessageType.Information, MessageSeverity.Informational);
                throw;
            }
        }
Ejemplo n.º 2
0
        // http://developer.ebay.com/DevZone/xml/docs/Reference/ebay/AddItem.html
        public AddItemCall AddItem(SiteCodeType siteid)
        {
            var call = new AddItemCall(api);

            call.Site = siteid;

            call.AddItem(item);

            return(call);
        }
        private ItemType  AddItem()
        {
            ItemType item = ItemHelper.BuildItem();
            // Execute the API.
            FeeTypeCollection fees;
            // AddItem
            AddItemCall addItem = new AddItemCall(this.apiContext);

            fees = addItem.AddItem(item);
            Assert.IsNotNull(fees);
            // Save the result.
            return(item);
        }
Ejemplo n.º 4
0
        private ItemType  addAdFormatItem()
        {
            ItemType item = ItemHelper.BuildItem();

            GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(this.apiContext);

            DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] {
                DetailLevelCodeType.ReturnAll
            };
            api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels);
            api.LevelLimit      = 10;
            api.ViewAllNodes    = true;
            bool viewAllNodes = true;
            bool isSuccess;
            CategoryTypeCollection categories;
            string message;

            //get an item which supports the Ad-format
            isSuccess = CategoryHelper.GetAdFormatCategory(this.apiContext, 1, out categories, out message);
            Assert.IsTrue(isSuccess, message);
            Assert.IsNotNull(categories);
            Assert.Greater(categories.Count, 0);
            Assert.IsTrue(categories[0].CategoryID != string.Empty);
            item.PrimaryCategory.CategoryID = categories[0].CategoryID;

            // get the list duration value according to the category
            CategoryFeatureTypeCollection features = api.GetCategoryFeatures(item.PrimaryCategory.CategoryID, api.LevelLimit, viewAllNodes, null, true);

            Assert.IsNotNull(features);
            Assert.Greater(features.Count, 0);
            Assert.IsNotNull(features[0].ListingDuration);
            Assert.Greater(features[0].ListingDuration.Count, 0);

            //modify item property to adapt the AdFormatItem
            item.ListingType     = ListingTypeCodeType.AdType;
            item.ListingDuration = features[0].ListingDuration[0].Value.ToString();

            // Execute the API.
            FeeTypeCollection fees;
            // AddItem
            AddItemCall addItem = new AddItemCall(this.apiContext);

            fees = addItem.AddItem(item);
            Assert.IsNotNull(fees);
            // Save the result.
            return(item);
        }
Ejemplo n.º 5
0
        public void AddItemFull()
        {
            if (TestData.NewItem2 != null)
            {
                (new T_120_EndItemLibrary()).EndItemFull();
                TestData.NewItem2 = null;
            }

            bool     isSucess, isSupport = true;
            string   message;
            ItemType item = ItemHelper.BuildItem();

            item.PrimaryCategory.CategoryID = CATEGORYID.ToString();
            //add Item AttributeSetArray
            //AttributeSetTypeCollection attributeSAT=GetAttributeSetCol(CATEGORYID,apiContext);
            //item.AttributeSetArray=attributeSAT;

            //check this category is custom specifics support
            FeatureIDCodeTypeCollection features = new FeatureIDCodeTypeCollection();
            FeatureIDCodeType           feature  = FeatureIDCodeType.ItemSpecificsEnabled;

            features.Add(feature);
            isSucess = UnitTests.Helper.CategoryHelper.IsSupportFeature(CATEGORYID, features, apiContext, out isSupport, out message);
            System.Console.WriteLine(message);
            Assert.IsTrue(isSucess, "there are some errors during checkging the CategoryFeatures");
            Assert.IsTrue(isSupport, "this category 104970 do not support the custom item specified any more!");
            //add CIS
            item.ItemSpecifics = getCIS();

            FeeTypeCollection fees;

            VerifyAddItemCall vi = new VerifyAddItemCall(apiContext);

            fees = vi.VerifyAddItem(item);
            Assert.IsNotNull(fees);

            AddItemCall addItemCall = new AddItemCall(apiContext);;

            fees = addItemCall.AddItem(item);
            //check whether the call is success.
            Assert.IsTrue(addItemCall.AbstractResponse.Ack == AckCodeType.Success || addItemCall.AbstractResponse.Ack == AckCodeType.Warning, "do not success!");
            Assert.IsNotNull(fees);
            // Save the result.
            TestData.NewItem2 = item;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// add an item of chinese category.
        /// </summary>
        /// <returns></returns>
        private ItemType  addChineseAuctionItem()
        {
            ItemType item = ItemHelper.BuildItem();

            //modify the property to adapt the Chinese Type Item
            item.ListingType = ListingTypeCodeType.Chinese;
            item.Quantity    = 1;

            // Execute the API.
            FeeTypeCollection fees;
            // AddItem
            AddItemCall addItem = new AddItemCall(this.apiContext);

            fees = addItem.AddItem(item);
            Assert.IsNotNull(fees);
            // Save the result.
            return(item);
        }
Ejemplo n.º 7
0
        public void AddItemProPay()
        {
            ItemType item = ItemHelper.BuildItem();

            item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection(new BuyerPaymentMethodCodeType[] { BuyerPaymentMethodCodeType.ProPay, BuyerPaymentMethodCodeType.PayPal });
            // Execute the API.
            FeeTypeCollection fees;
            // VerifyAddItem
            VerifyAddItemCall vi = new VerifyAddItemCall(this.apiContext);

            fees = vi.VerifyAddItem(item);
            Assert.IsNotNull(fees);
            // AddItem
            AddItemCall addItem = new AddItemCall(this.apiContext);

            fees = addItem.AddItem(item);
            Assert.IsNotNull(fees);
        }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            try {
                Console.WriteLine("+++++++++++++++++++++++++++++++++++++++");
                Console.WriteLine("+ Welcome to eBay SDK for .Net Sample +");
                Console.WriteLine("+ - ConsoleAddItem                    +");
                Console.WriteLine("+++++++++++++++++++++++++++++++++++++++");

                //[Step 1] Initialize eBay ApiContext object
                ApiContext apiContext = GetApiContext();

                //[Step 2] Create a new ItemType object
                ItemType item = BuildItem();


                //[Step 3] Create Call object and execute the Call
                AddItemCall apiCall = new AddItemCall(apiContext);
                Console.WriteLine("Begin to call eBay API, please wait ...");
                FeeTypeCollection fees = apiCall.AddItem(item);
                Console.WriteLine("End to call eBay API, show call result ...");
                Console.WriteLine();

                //[Step 4] Handle the result returned
                Console.WriteLine("The item was listed successfully!");
                double listingFee = 0.0;
                foreach (FeeType fee in fees)
                {
                    if (fee.Name == "ListingFee")
                    {
                        listingFee = fee.Fee.Value;
                    }
                }
                Console.WriteLine(String.Format("Listing fee is: {0}", listingFee));
                Console.WriteLine(String.Format("Listed Item ID: {0}", item.ItemID));
            }
            catch (Exception ex)
            {
                Console.WriteLine("Fail to list the item : " + ex.Message);
            }

            Console.WriteLine();
            Console.WriteLine("Press any key to close the program.");
            Console.ReadKey();
        }
Ejemplo n.º 9
0
        private void BtnAddItem_Click(object sender, System.EventArgs e)
        {
            try
            {
                TxtItemId.Text     = "";
                TxtListingFee.Text = "";

                ItemType    item    = FillItem();
                AddItemCall apicall = new AddItemCall(Context);

                if (ListPictures.Items.Count > 0)
                {
                    apicall.PictureFileList          = new StringCollection();
                    item.PictureDetails              = new PictureDetailsType();
                    item.PictureDetails.PhotoDisplay = (PhotoDisplayCodeType)Enum.Parse(typeof(PhotoDisplayCodeType), CboPicDisplay.SelectedItem.ToString());
                }

                foreach (string pic in ListPictures.Items)
                {
                    apicall.PictureFileList.Add(pic);
                }

                FeeTypeCollection fees = apicall.AddItem(item);

                TxtItemId.Text = item.ItemID;

                BtnGetItem.Visible = true;

                foreach (FeeType fee in fees)
                {
                    if (fee.Name == "ListingFee")
                    {
                        TxtListingFee.Text = fee.Fee.Value.ToString();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// add an item
        /// </summary>
        /// <returns></returns>
        public static string AddItem(CallMetricsTable metrics)
        {
            try
            {
                ApiContext ctx = GetContext();
                ctx.EnableMetrics    = true;
                ctx.CallMetricsTable = metrics;
                AddItemCall call = new AddItemCall(ctx);
                call.Site = SiteCodeType.US;
                call.Item = ItemHelper.BuildItem();
                call.Execute();


                return(CheckForErrors("AddItem", call) ?
                       call.ApiResponse.ItemID : null);
            }
            catch (Exception e)
            {
                ShowException("AddItem()", e);
                return(null);
            }
        }
Ejemplo n.º 11
0
        //Update an item on Ebay
        public void AddItemEbay(string sneakerID)
        {
            try
            {
                MessageBox.Show("Prepare to list the item " + SQLConnect.Select("Select ShoeName from Shoe where ShoeID = '" + sneakerID + "';") + " on Ebay");
                //[Step 1] Initialize eBay ApiContext object
                ApiContext apiContext = GetApiContext();

                //[Step 2] Create a new ItemType object
                ItemType item = BuildItem(sneakerID);

                //[Step 3] Create Call object and execute the Call
                AddItemCall apiCall = new AddItemCall(apiContext);
                //Note_MS("Begin to call eBay API, please wait ...");
                FeeTypeCollection fees = new FeeTypeCollection();
                // fees = apiCall.AddItem(item);

                //Note_MS("End to call eBay API, show call result ...");

                //[Step 4] Handle the result returned
                MessageBox.Show("The item " + SQLConnect.Select("Select ShoeName from Shoe where ShoeID = '" + sneakerID + "';") + " was listed successfully!");
                double listingFee = 0.0;
                foreach (FeeType fee in fees)
                {
                    if (fee.Name == "ListingFee")
                    {
                        listingFee = fee.Fee.Value;
                    }
                }
                //MessageBox.Show(String.Format("Listing fee is: {0}", listingFee));
                //MessageBox.Show(String.Format("Listed Item ID: {0}", item.ItemID));
            }
            catch (Exception ex)
            {
                //throw ex;
                MessageBox.Show("Fail to list the item : " + ex.StackTrace);
            }
        }
Ejemplo n.º 12
0
        public void AddItem()
        {
            if (TestData.NewItem != null)
            {
                (new T_120_EndItemLibrary()).EndItem();
                TestData.NewItem = null;
            }
            ItemType item = ItemHelper.BuildItem();
            // Execute the API.
            FeeTypeCollection fees;
            // VerifyAddItem
            VerifyAddItemCall vi = new VerifyAddItemCall(this.apiContext);

            fees = vi.VerifyAddItem(item);
            Assert.IsNotNull(fees);
            // AddItem
            AddItemCall addItem = new AddItemCall(this.apiContext);

            fees = addItem.AddItem(item);
            Assert.IsNotNull(fees);
            // Save the result.
            TestData.NewItem = item;
        }
Ejemplo n.º 13
0
        public void SubmitSingleProductListingFeed(MarketplaceProductFeedDto productFeed, string submittedBy)
        {
            if (productFeed.eBayProductFeed == null || productFeed.eBayProductFeed.CategoryId == null)
            {
                _logger.LogWarning(LogEntryType.eBayProductListing, string.Format("Unable to create listing for this product - {0} due to no eBay details or category id.",
                                                                                  productFeed.EisSKU));
                return;
            }
            if (!string.IsNullOrEmpty(productFeed.eBayProductFeed.ItemId))
            {
                _logger.LogWarning(LogEntryType.eBayProductListing, string.Format("The EIS product {0} is already listed in eBay. Please do the product revise feed instead!",
                                                                                  productFeed.EisSKU));
                return;
            }

            try
            {
                // set the log file name
                _context.ApiLogManager.ApiLoggerList.Add(new FileLogger(string.Format(_logDirectory, MethodBase.GetCurrentMethod().Name), false, true, true));
                var apiCall = new AddItemCall(_context);

                // parse the product feed for eBay item
                var itemType = RequestHelper.CreateItemType(productFeed, _credential.eBayDescriptionTemplate);

                // send the request and get the fee collection
                var fees = apiCall.AddItem(itemType);

                var container = new ItemContainer
                {
                    EisSKU = productFeed.EisSKU,
                    ItemId = itemType.ItemID
                };
                foreach (FeeType fee in fees)
                {
                    if (fee.Fee.Value <= 0)
                    {
                        continue;
                    }

                    container.Fees.Add(new Fee
                    {
                        Name           = fee.Name,
                        Amount         = fee.Fee.Value,
                        CurrencyCode   = fee.Fee.currencyID.ToString(),
                        ActionFeedType = eBayConstants.ITEM_ADDED
                    });
                }

                logAndUpdateProductItemId(new List <ItemContainer> {
                    container
                }, LogEntryType.eBayProductListing);
            }
            catch (Exception ex)
            {
                var description = string.Format("Error in submitting single product feed for {0} - {3}. \nError Message: {1} \nRequested by: {2}",
                                                ChannelName,
                                                EisHelper.GetExceptionMessage(ex),
                                                submittedBy,
                                                productFeed.EisSKU);
                _logger.Add(LogEntrySeverity.Error, LogEntryType.eBayProductListing, description, ex.StackTrace);
            }
        }
Ejemplo n.º 14
0
        //list to eBay
        private void addItem()
        {
            try
            {
                //
                ApiContext  apiContext = this.controller.ApiContext;
                AddItemCall api        = new AddItemCall(apiContext);

                // Create the item
                ItemType item = new ItemType();

                item.Site    = apiContext.Site;
                item.Country = CountryCodeType.US;

                item.ListingType = (ListingTypeCodeType)Enum.Parse(typeof(ListingTypeCodeType), (this.listingTypeComboBox.SelectedItem as ListItem).Value);
                if (item.ListingType.Equals(ListingTypeCodeType.LeadGeneration))
                {
                    item.ListingSubtype2 = ListingSubtypeCodeType.ClassifiedAd;
                }
                item.Title       = this.titleTextBox.Text;
                item.Description = this.descriptionTextBox.Text;
                item.Currency    = this.getCurrencyType(item.Site);

                if (this.startPriceTextBox.Text != string.Empty)
                {
                    item.StartPrice            = new AmountType();
                    item.StartPrice.currencyID = item.Currency;
                    item.StartPrice.Value      = Convert.ToDouble(this.startPriceTextBox.Text);
                }

                if (this.binTextBox.Text != string.Empty)
                {
                    item.BuyItNowPrice            = new AmountType();
                    item.BuyItNowPrice.currencyID = item.Currency;
                    item.BuyItNowPrice.Value      = Convert.ToDouble(this.binTextBox.Text);
                }

                item.Quantity = Int32.Parse(this.quantityTextBox.Text);

                item.Location        = this.locationTextBox.Text;
                item.ListingDuration = (this.durationComboBox.SelectedItem as ListItem).Value;

                ListingEnhancementsCodeTypeCollection enhancements = new ListingEnhancementsCodeTypeCollection();
                enhancements.Add(ListingEnhancementsCodeType.BoldTitle);
                item.ListingEnhancement = enhancements;


                // Set Item Condtion
                ConditionEnabledCodeType condition = this.controller.CategoryFacade.ConditionEnabled;
                if (condition == ConditionEnabledCodeType.Enabled ||
                    condition == ConditionEnabledCodeType.Required)
                {
                    ListItem li          = this.conditionComboBox.SelectedItem as ListItem;
                    int      conditionId = int.Parse(li.Value);
                    item.ConditionID = conditionId;
                }

                // Set Attributes property.
                item.PrimaryCategory            = new CategoryType();
                item.PrimaryCategory.CategoryID = this.controller.CategoryFacade.CategoryID;

                if (this.controller.CategoryFacade.ItemSpecificEnabled == ItemSpecificsEnabledCodeType.Enabled &&
                    this.controller.CategoryFacade.ItemSpecificsCache != null)
                {
                    item.ItemSpecifics = this.controller.CategoryFacade.ItemSpecificsCache;
                }

                // Motor
                if (this.controller.ApiContext.Site == SiteCodeType.eBayMotors &&
                    this.subTitleTextBox.Text.Length > 0)
                {
                    MotorAttributeHelper mh = new MotorAttributeHelper(item.AttributeSetArray[0]);
                    mh.Subtitle = this.subTitleTextBox.Text;
                    if (this.depositAmountTextBox.Text.Length > 0)
                    {
                        mh.DepositAmount = Decimal.Parse(this.depositAmountTextBox.Text);
                    }
                }

                if ((this.shippingServiceComboBox.SelectedItem as ListItem).Value != "None")
                {
                    //add shipping information
                    item.ShippingDetails = getShippingDetails((this.shippingServiceComboBox.SelectedItem as ListItem).Value);
                }

                //add handling time
                item.DispatchTimeMax = 1;

                SellerProfilesType sellerProfile = new SellerProfilesType();
                //add return policy
                if (this.controller.CategoryFacade.ReturnPolicyEnabled)
                {
                    if (this.controller.CategoryFacade.ReturnPolicyProfileCache != null)
                    {
                        sellerProfile.SellerReturnProfile = this.controller.CategoryFacade.ReturnPolicyProfileCache;
                    }
                    else if (this.controller.CategoryFacade.ReturnPolicyCache != null)
                    {
                        item.ReturnPolicy = this.controller.CategoryFacade.ReturnPolicyCache;
                    }
                }
                if (paymentProfileIdTextBox.Text != "" || paymentProfileNameTextBox.Text != "")
                {
                    sellerProfile.SellerPaymentProfile = new SellerPaymentProfileType();
                    if (this.paymentProfileIdTextBox.Text != "")
                    {
                        sellerProfile.SellerPaymentProfile.PaymentProfileID          = Int64.Parse(paymentProfileIdTextBox.Text);
                        sellerProfile.SellerPaymentProfile.PaymentProfileIDSpecified = true;
                    }
                    sellerProfile.SellerPaymentProfile.PaymentProfileName = paymentProfileNameTextBox.Text;
                }
                if (shippingProfileIdTextBox.Text != "" || shippingProfileNameTextBox.Text != "")
                {
                    sellerProfile.SellerShippingProfile = new SellerShippingProfileType();
                    if (this.shippingProfileIdTextBox.Text != "")
                    {
                        sellerProfile.SellerShippingProfile.ShippingProfileID          = Int64.Parse(shippingProfileIdTextBox.Text);
                        sellerProfile.SellerShippingProfile.ShippingProfileIDSpecified = true;
                    }
                    sellerProfile.SellerShippingProfile.ShippingProfileName = shippingProfileNameTextBox.Text;
                }

                //get shipping locations
                item.ShipToLocations = getShppingLocations();
                //set payments
                setPaymentMethods(item);
                // set seller profiles
                item.SellerProfiles = sellerProfile;

                FeeTypeCollection fees = api.AddItem(item);

                viewItemInfo(item);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 15
0
        private static void AddItem(ApiContext apiContext)
        {
            AddItemCall apiCall = new AddItemCall(apiContext);

            apiContext.ApiLogManager.RecordMessage("Beginning to call eBay, please wait...", MessageType.Information, MessageSeverity.Informational);

            try
            {
                ItemType item = new ItemType();

                item.ProductListingDetails = new ProductListingDetailsType()
                {
                    UPC        = "610214624192",
                    DetailsURL = "http://www.google.com",
                    IncludePrefilledItemInformation          = true,
                    IncludePrefilledItemInformationSpecified = true,
                    IncludeStockPhotoURL          = true,
                    IncludeStockPhotoURLSpecified = true,
                    StockPhotoURL = "http://i.ebayimg.com/02/!!eFW3!wBGM~$(KGrHqF,!lcE1F1IqYejBNUs+NoIJg~~_7.JPG?set_id=89040003C1"
                };


                item.Title                = "Dell Streak 7 16GB, Wi-Fi + 4G (T-Mobile), 7in - Black";
                item.Description          = "Cool smartphone";
                item.ListingType          = ListingTypeCodeType.FixedPriceItem;
                item.ConditionDisplayName = "New";

                // listing price
                item.Currency   = CurrencyCodeType.USD;
                item.StartPrice = new AmountType()
                {
                    Value = (Double)161.83, currencyID = CurrencyCodeType.USD
                };

                // listing duration
                item.ListingDuration = "Days_10";

                // item location and country
                item.Location = "Farmington";
                item.Country  = CountryCodeType.US;

                // listing category
                item.PrimaryCategory = new CategoryType()
                {
                    CategoryID = "171485"
                };

                // item quantity
                item.Quantity = 300;

                // payment methods
                item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection(
                    new BuyerPaymentMethodCodeType[] { BuyerPaymentMethodCodeType.PayPal }
                    );
                item.PayPalEmailAddress = "*****@*****.**";

                // item condition, new
                item.ConditionID = 1000;

                // handling time is required
                item.DispatchTimeMax = 5;

                item.ShippingDetails = BuildShippingDetailsType();

                // Return policy
                item.ReturnPolicy = new ReturnPolicyType();
                item.ReturnPolicy.ReturnsAcceptedOption = "ReturnsAccepted";

                FeeTypeCollection fees = apiCall.AddItem(item);
                apiContext.ApiLogManager.RecordMessage("Completed the call", MessageType.Information, MessageSeverity.Informational);

                apiContext.ApiLogManager.RecordMessage("The item was listed successfully", MessageType.Information, MessageSeverity.Informational);
                apiContext.ApiLogManager.RecordMessage("*************** BEGINNING OF THE LIST", MessageType.Information, MessageSeverity.Informational);
                foreach (FeeType i in fees)
                {
                    apiContext.ApiLogManager.RecordMessage(String.Format("{0} = {1}", i.Name, i.Fee.Value), MessageType.Information, MessageSeverity.Informational);
                }
                apiContext.ApiLogManager.RecordMessage("*************** END OF THE LIST", MessageType.Information, MessageSeverity.Informational);
            }
            catch (Exception e)
            {
                apiContext.ApiLogManager.RecordMessage(e.Message, MessageType.Information, MessageSeverity.Informational);
                throw;
            }
        }
Ejemplo n.º 16
0
        private string addItem(MySQLWrapper.eBayItem ebayItem)
        {
            string        listedItemId    = "-1";
            StringBuilder htmlDescription = new StringBuilder();
            TextReader    tr = new StreamReader("template.txt");

            htmlDescription.Insert(0, tr.ReadToEnd());
            tr.Close();
            htmlDescription.Replace("{0}", ebayItem.Title);
            htmlDescription.Replace("{1}", ebayItem.Author);
            htmlDescription.Replace("{2}", ebayItem.Publisher);
            htmlDescription.Replace("{3}", ebayItem.publishDate);
            htmlDescription.Replace("{4}", ebayItem.Binding);
            htmlDescription.Replace("{5}", ebayItem.ISBN);
            if (ebayItem.UPC != "")
            {
                htmlDescription.Replace("{6}", "<b>UPC : </b>" + ebayItem.UPC + "</br>");
            }
            else
            {
                htmlDescription.Replace("{6}", "");
            }
            htmlDescription.Replace("{7}", ebayItem.Weight.ToString());
            htmlDescription.Replace("{8}", ebayItem.Notes);
            htmlDescription.Replace("{9}", ebayItem.Description);

            ItemType item = new ItemType();


            item.InventoryTrackingMethod = InventoryTrackingMethodCodeType.SKU;
            item.SKU = ebayItem.SKU;

            // Title max length 55 chars
            if (ebayItem.Title.Length > 55)
            {
                item.Title = ebayItem.Title.Substring(0, 54);
            }
            else
            {
                item.Title = ebayItem.Title;
            }

            if (ebayItem.Image != "")
            {
                item.PictureDetails = new PictureDetailsType();
                item.PictureDetails.PictureURL.Add(ebayItem.Image);
            }

            item.Description     = htmlDescription.ToString();
            item.Currency        = CurrencyCodeType.INR;
            item.ListingType     = ListingTypeCodeType.FixedPriceItem;
            item.Quantity        = ebayItem.Quantity;
            item.PostalCode      = eBayLister.UserSettings.Default.itemPincode;
            item.Location        = eBayLister.UserSettings.Default.itemCityState;
            item.Country         = (CountryCodeType)Enum.Parse(typeof(CountryCodeType), eBayLister.UserSettings.Default.itemCountry, true);
            item.ListingDuration = getListingDuration();
            item.PrimaryCategory = new CategoryType();
            if (eBayLister.UserSettings.Default.ListInCategory.Equals("Other Books"))
            {
                item.PrimaryCategory.CategoryID = "268";
            }
            else
            {
                item.PrimaryCategory.CategoryID = "37558";
            }
            item.StartPrice            = new AmountType();
            item.StartPrice.currencyID = CurrencyCodeType.INR;
            item.StartPrice.Value      = ebayItem.Price *
                                         Convert.ToDouble(eBayLister.UserSettings.Default.ConversionRate);
            item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();
            item.PaymentMethods.Add(BuyerPaymentMethodCodeType.PaisaPayAccepted);
            item.ShippingDetails = this.getShippingDetails();
            item.ReturnPolicy    = this.getReturnPolicy();
            string handlingTime = eBayLister.UserSettings.Default.handlingTime;

            handlingTime         = handlingTime.Remove(handlingTime.IndexOf(' '));
            item.DispatchTimeMax = Convert.ToInt32(handlingTime);

            AttributeType conditionAttribute = new AttributeType();

            conditionAttribute.attributeLabel = "Condition";
            ValTypeCollection valueCollection = new ValTypeCollection();
            ValType           valueType       = new ValType();

            if (ebayItem.bookCondition.Contains("Used"))
            {
                valueType.ValueLiteral = "Used";
            }
            else
            {
                valueType.ValueLiteral = "New";
            }
            valueCollection.Add(valueType);
            conditionAttribute.Value = valueCollection;
            item.AttributeArray      = new AttributeTypeCollection();
            item.AttributeArray.Add(conditionAttribute);
            AddItemCall apiCall = new AddItemCall(context);


            FeeTypeCollection fees = apiCall.AddItem(item);

            foreach (FeeType fee in fees)
            {
                if (fee.Name == "ListingFee")
                {
                    addLogStatus("Success!     Listing Fee : " + Convert.ToString(fee.Fee.Value));
                }
            }

            listedItemId = apiCall.ItemID;
            return(listedItemId);
        }