コード例 #1
0
		public void ReviseItem()
		{
			ItemType itemTest = TestData.NewItem;
			Assert.IsNotNull(itemTest);
			//
			ReviseItemCall rviCall = new ReviseItemCall(this.apiContext);
			ItemType item = new ItemType();
			item.ItemID = itemTest.ItemID;
			item.StartPrice = new AmountType(); 
			item.StartPrice.Value = 2.89; 
			item.StartPrice.currencyID = CurrencyCodeType.USD;
			rviCall.Item = item;
			
            //verify fisrt
            rviCall.VerifyOnly = true;
            rviCall.Execute();
            FeeTypeCollection fees = rviCall.FeeList;

            //check whether the call is success.
            Assert.IsTrue(rviCall.AbstractResponse.Ack == AckCodeType.Success || rviCall.AbstractResponse.Ack == AckCodeType.Warning, "do not success!");
            // Call GetItem and then compare the startPrice.
            GetItemCall getItem1 = new GetItemCall(this.apiContext);
            DetailLevelCodeType[] detailLevels1 = new DetailLevelCodeType[] {
			DetailLevelCodeType.ReturnAll
			};
            getItem1.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels1);
            ItemType returnedItem1 = getItem1.GetItem(itemTest.ItemID);
            Assert.AreNotEqual(returnedItem1.StartPrice.Value, item.StartPrice.Value);
            
            //revise
            rviCall.VerifyOnly = false;
            rviCall.Execute();
			// Let's wait for the server to "digest" the data.
			System.Threading.Thread.Sleep(1000);
			//check whether the call is success.
			Assert.IsTrue(rviCall.AbstractResponse.Ack==AckCodeType.Success || rviCall.AbstractResponse.Ack==AckCodeType.Warning,"do not success!");
			// Call GetItem and then compare the startPrice.
			GetItemCall getItem2 = new GetItemCall(this.apiContext);
			DetailLevelCodeType[] detailLevels2 = new DetailLevelCodeType[] {
			DetailLevelCodeType.ReturnAll
			};
			getItem2.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels2);
			ItemType returnedItem2 = getItem2.GetItem(itemTest.ItemID);
			Assert.AreEqual(returnedItem2.StartPrice.Value, item.StartPrice.Value);
			// Update itemTest.
			TestData.NewItem = returnedItem2;
			
		}
コード例 #2
0
ファイル: Program.cs プロジェクト: msaleh/HRM
        static DateTime UpdateItem(string ItemId, string ItemSkU)
        {
            var apiContext = eBayServiceSettingHelper.GetApiContext();
            ReviseItemCall apicall = new ReviseItemCall(apiContext);
            if (string.IsNullOrEmpty(ItemId) == true) // if item not provided try lookup by sku from ebay
            {
                ItemType itemOnline = null;
                itemOnline = GetItembySku(ItemSkU);// get thay use get item method by passing sku
                if (itemOnline == null)// try get that from Active item
                {
                    itemOnline = getITembySkuUsingActiveITems(ItemSkU);
                }

                ItemId = itemOnline.ItemID;
            }
            //Note when update item pas itemtype then asign the ItemId value that all use the method GetItembyId(Itemid); to get ebay item by sku
            ItemType item = new ItemType();
            item.ItemID = ItemId;
            item.SKU = ItemSkU;
            //item.InventoryTrackingMethod = InventoryTrackingMethodCodeType.SKU;
            var t =  apicall.ReviseItem(item, null, false);
            return t;
        }
コード例 #3
0
ファイル: eBayApi.cs プロジェクト: jaskirat-danits/oswebshop
		/// <summary>
		/// revise an item
		/// </summary>
		/// <param name="itemId"></param>
		/// <param name="metrics"></param>
		public static void ReviseItem(ItemType item, CallMetricsTable metrics) 
		{
			Debug.Assert(item != null);
			Debug.Assert(item.ItemID != null);
			Debug.Assert(item.ItemID.Length > 0);
			
			try
			{
				ApiContext ctx = GetContext();
				ctx.EnableMetrics = true;
				ctx.CallMetricsTable = metrics;
				ReviseItemCall call = new ReviseItemCall(ctx);
				call.Site = SiteCodeType.US;
				ItemType itemToBeRevised = new ItemType();
				itemToBeRevised.ItemID = item.ItemID;
				call.Item=itemToBeRevised;
				itemToBeRevised.Description="Item has been modified!";

				call.Execute();

			}
			catch (Exception e) 
			{
				if(item==null)
				{
					ShowException("ReviseItem(null)", e);
				}
				else
				{
					ShowException("ReviseItem(" + item.ItemID + ")", e);
				}
			}
		}
コード例 #4
0
ファイル: FrmReviseItem.cs プロジェクト: fudder/cs493
        private void BtnReviseItem_Click(object sender, System.EventArgs e)
        {
            try
            {
                TxtItemId.Text = "";
                TxtListingFee.Text = "";
                BtnGetItem.Visible = false;

                // Populate the Item
                ItemType item = new ItemType();
                item.ItemID = TxtReviseItemId.Text;

                CurrencyCodeType currencyCode = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);

                if (TxtTitle.Text.Length > 0)
                {
                    item.Title = this.TxtTitle.Text;
                }

                if (TxtDescription.Text.Length > 0)
                {
                    item.Description =  this.TxtDescription.Text;
                }

                if (CboDuration.SelectedIndex != -1)
                {
                    item.ListingDuration = CboDuration.SelectedItem.ToString();
                }

                if (TxtStartPrice.Text.Length > 0)
                {
                    item.StartPrice = new AmountType();
                    item.StartPrice.currencyID = currencyCode;
                    item.StartPrice.Value = Double.Parse(this.TxtStartPrice.Text, NumberStyles.Currency);
                }
                if (TxtReservePrice.Text.Length > 0)
                {
                    item.ReservePrice = new AmountType();
                    item.ReservePrice.currencyID = currencyCode;
                    item.ReservePrice.Value = Double.Parse(this.TxtReservePrice.Text, NumberStyles.Currency);
                }
                if (TxtBuyItNowPrice.Text.Length > 0)
                {
                    item.BuyItNowPrice = new AmountType();
                    item.BuyItNowPrice.currencyID = currencyCode;
                    item.BuyItNowPrice.Value = Double.Parse(this.TxtBuyItNowPrice.Text, NumberStyles.Currency);
                }

                if (CboEnableBestOffer.SelectedIndex != -1)
                {
                    item.BestOfferDetails = new BestOfferDetailsType();
                    item.BestOfferDetails.BestOfferEnabled = Boolean.Parse(CboEnableBestOffer.SelectedItem.ToString());
                }

                StringCollection deletedFields = new StringCollection();

                if (ChkPayPalEmailAddress.Checked)
                    deletedFields.Add ("Item.payPalEmailAddress");

                if (ChkApplicationData.Checked)
                    deletedFields.Add ("Item.applicationData");

                ReviseItemCall apicall = new ReviseItemCall(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);
                }
                apicall.DeletedFieldList = deletedFields;

                apicall.ReviseItem(item, deletedFields, false);
                TxtItemId.Text = item.ItemID;

                FeeTypeCollection fees = apicall.FeeList;

                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);
            }
        }
コード例 #5
0
		public void ReviseItemFull()
		{
			bool isSuccess;
			string message;

			ItemType item = TestData.NewItem2,itemOut;
			Assert.IsNotNull(item);
			ReviseItemCall rviCall = new ReviseItemCall(this.apiContext);
			
			StringCollection stringCol=new StringCollection();
			stringCol.Add("item.ApplicationData");
			rviCall.DeletedFieldList=stringCol;
			
			item.StartPrice = new AmountType(); 
			item.StartPrice.Value = 2.89; 
			item.StartPrice.currencyID = CurrencyCodeType.USD;
			
			rviCall.Item = item;
			rviCall.Execute();
			// Let's wait for the server to "digest" the data.
			System.Threading.Thread.Sleep(1000);
			isSuccess=ItemHelper.GetItem(item,this.apiContext,out message,out itemOut);
			Assert.IsTrue(isSuccess,message);
			Assert.IsTrue(message==string.Empty,message);

			Assert.IsNull(itemOut.ApplicationData);
			Assert.AreEqual(itemOut.StartPrice.Value,item.StartPrice.Value);
		}
コード例 #6
0
ファイル: eBayWrapper.cs プロジェクト: madhurjain/eBayLister
 private string modifyItem(string itemId,string SKU,ushort quantity)
 {
     string returnId = "-1";
     ItemType item = new ItemType();
     item.SKU = SKU;
     item.ItemID = itemId;
     item.Quantity = quantity;
     StringCollection deleteFieldList = new StringCollection();
     ReviseItemCall apiCall = new ReviseItemCall(context);
     apiCall.ReviseItem(item, deleteFieldList);
     returnId = apiCall.ItemID;
     return returnId;
 }