コード例 #1
0
ファイル: Form1.cs プロジェクト: vietle2111/SnkrBot
        /// <summary>
        /// Build sample SellerProfile details
        /// </summary>
        /// <returns></returns>
        private SellerProfilesType BuildSellerProfiles()
        {
            /*
             * Beginning with release 763, some of the item fields from
             * the AddItem/ReviseItem/VerifyItem family of calls have been
             * moved to the Business Policies API.
             * See http://developer.ebay.com/Devzone/business-policies/Concepts/BusinessPoliciesAPIGuide.html for more
             *
             * This example uses profiles that were previously created using this api.
             */

            SellerProfilesType sellerProfile = new SellerProfilesType();

            Note_MS("Return policy profile Id:");
            sellerProfile.SellerReturnProfile = new SellerReturnProfileType();
            sellerProfile.SellerReturnProfile.ReturnProfileID = 123456;//Int64.Parse(Console.ReadLine());

            Note_MS("Shipping profile Id:");
            sellerProfile.SellerShippingProfile = new SellerShippingProfileType();
            sellerProfile.SellerShippingProfile.ShippingProfileID = 123456;// Int64.Parse(Console.ReadLine());

            Note_MS("Payment profile Id:");
            sellerProfile.SellerPaymentProfile = new SellerPaymentProfileType();
            sellerProfile.SellerPaymentProfile.PaymentProfileID = 123456;// Int64.Parse(Console.ReadLine());

            return(sellerProfile);
        }
コード例 #2
0
        public static ItemType BuildItemForBusinessPoliciesAPI()
        {
            ItemType item = new ItemType();

            item.Site        = SiteCodeType.US;
            item.Currency    = CurrencyCodeType.USD;
            item.ListingType = ListingTypeCodeType.Chinese;
            String t = "eBay SDK SanityTest " + DateTime.Now + " DO NOT BID!";

            item.ApplicationData       = "this is an application data";
            item.Title                 = t;
            item.Description           = "This is a test item created by eBay SDK SanityTest.";
            item.StartPrice            = new AmountType();
            item.StartPrice.Value      = 1.01;
            item.StartPrice.currencyID = item.Currency;
            item.ListingDuration       = "Days_7";
            item.Location              = "San Jose, CA";
            item.Country               = CountryCodeType.US;
            BestOfferDetailsType bo = new BestOfferDetailsType();

            bo.BestOfferEnabled   = false;
            item.BestOfferDetails = bo;
            CategoryType cat = new CategoryType();

            cat.CategoryID         = "14111";
            item.PrimaryCategory   = cat;
            item.Quantity          = 1;
            item.QuantitySpecified = true;
            //handling time
            item.DispatchTimeMax = 1;

            //item condition
            item.ConditionID = 1000;

            // Picture details
            PictureDetailsType pictureDetails = new PictureDetailsType();

            pictureDetails.PictureURL = new StringCollection();
            pictureDetails.PictureURL.Add("http://pics.ebaystatic.com/aw/pics/navbar/eBayLogoTM.gif");

            item.PictureDetails = pictureDetails;

            // Seller Profiles
            SellerProfilesType sellerProfilesType = new SellerProfilesType();

            sellerProfilesType.SellerPaymentProfile  = GetSellerPaymentProfile();
            sellerProfilesType.SellerReturnProfile   = GetSellerReturnProfile();
            sellerProfilesType.SellerShippingProfile = GetSellerShippingProfile();

            item.SellerProfiles = sellerProfilesType;

            return(item);
        }
コード例 #3
0
        public static ItemType BuildItemForBusinessPoliciesAPI()
        {
            ItemType item = new ItemType();
            item.Site = SiteCodeType.US;
            item.Currency = CurrencyCodeType.USD;
            item.ListingType = ListingTypeCodeType.Chinese;
            String t = "eBay SDK SanityTest " + DateTime.Now + " DO NOT BID!";

            item.ApplicationData = "this is an application data";
            item.Title = t;
            item.Description = "This is a test item created by eBay SDK SanityTest.";
            item.StartPrice = new AmountType();
            item.StartPrice.Value = 1.01;
            item.StartPrice.currencyID = item.Currency;
            item.ListingDuration = "Days_7";
            item.Location = "San Jose, CA";
            item.Country = CountryCodeType.US;
            BestOfferDetailsType bo = new BestOfferDetailsType();
            bo.BestOfferEnabled = false;
            item.BestOfferDetails = bo;
            CategoryType cat = new CategoryType();
            cat.CategoryID = "14111";
            item.PrimaryCategory = cat;
            item.Quantity = 1;
            item.QuantitySpecified = true;
            //handling time
            item.DispatchTimeMax = 1;

            //item condition
            item.ConditionID = 1000;

            // Picture details
            PictureDetailsType pictureDetails = new PictureDetailsType();
			pictureDetails.PictureURL = new StringCollection();
			pictureDetails.PictureURL.Add( "http://pics.ebaystatic.com/aw/pics/navbar/eBayLogoTM.gif");
            
            item.PictureDetails = pictureDetails;

            // Seller Profiles
            SellerProfilesType sellerProfilesType = new SellerProfilesType();
            sellerProfilesType.SellerPaymentProfile = GetSellerPaymentProfile();
            sellerProfilesType.SellerReturnProfile = GetSellerReturnProfile();
            sellerProfilesType.SellerShippingProfile = GetSellerShippingProfile();

            item.SellerProfiles = sellerProfilesType;

            return item;
        }
コード例 #4
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);
            }
        }
コード例 #5
0
ファイル: AddItem.cs プロジェクト: jaskirat-danits/oswebshop
        //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);
            }

        }
コード例 #6
0
ファイル: Program.cs プロジェクト: jaskirat-danits/oswebshop
        /// <summary>
        /// Build sample SellerProfile details
        /// </summary>
        /// <returns></returns>
        static SellerProfilesType BuildSellerProfiles()
        {
            /*
             * Beginning with release 763, some of the item fields from
             * the AddItem/ReviseItem/VerifyItem family of calls have been
             * moved to the Business Policies API. 
             * See http://developer.ebay.com/Devzone/business-policies/Concepts/BusinessPoliciesAPIGuide.html for more
             * 
             * This example uses profiles that were previously created using this api.
             */

            SellerProfilesType sellerProfile = new SellerProfilesType();
      
            Console.WriteLine("Enter Return policy profile Id:");            
            sellerProfile.SellerReturnProfile = new SellerReturnProfileType();
            sellerProfile.SellerReturnProfile.ReturnProfileID = Int64.Parse(Console.ReadLine());

            Console.WriteLine("Enter Shipping profile Id:");            
            sellerProfile.SellerShippingProfile = new SellerShippingProfileType();
            sellerProfile.SellerShippingProfile.ShippingProfileID = Int64.Parse(Console.ReadLine());

            Console.WriteLine("Enter Payment profile Id:");            
            sellerProfile.SellerPaymentProfile = new SellerPaymentProfileType();
            sellerProfile.SellerPaymentProfile.PaymentProfileID = Int64.Parse(Console.ReadLine());

            return sellerProfile;
        }