private void loadProductAtIndex() { if (xResult.ChildNodes.Count != 0) { // select next var count = xResult.GetElementsByTagName("product").Count; if (currentIndex > count) { currentIndex = 1; } var xProduct = xResult.SelectSingleNode("/response/product[" + currentIndex + "]"); currentIndex++; nameLabel.Text = xProduct["enName"].InnerText; //avgLabel.Text = xProduct["enName"].InnerText; pidLabel.Text = xProduct["idProduct"].InnerText; editionLabel.Text = xProduct["expansionName"].InnerText; var imageURL = "https://www.magickartenmarkt.de/" + xProduct["image"].InnerText; Console.WriteLine(imageURL); detectedCard.ImageLocation = imageURL; var xResultTmp = MKM.makeRequest( "https://www.mkmapi.eu/ws/v2.0/products/" + xProduct["idProduct"].InnerText, "GET"); if (xResultTmp.ChildNodes.Count != 0) { xProduct = xResultTmp.SelectSingleNode("/response/product/priceGuide"); priceBox.Text = xProduct["AVG"].InnerText; } } }
private void CheckMKM() { // https://www.mkmapi.eu/ws/v2.0/products/find?search=Springleaf&idGame=1&idLanguage=1 currentIndex = 1; var sCardName = currentMatch; try { xResult = MKM.makeRequest( "https://www.mkmapi.eu/ws/v2.0/products/find?search=" + sCardName + "&idGame=1&idLanguage=1", "GET"); loadProductAtIndex(); } catch (Exception e) { MessageBox.Show(e.Message); } }
private void exportToMKMButton_Click(object sender, EventArgs e) { var xBody = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + "<request>"; /*"<article><idProduct>" + pidLabel.Text + "</idProduct><idLanguage>" + * (langCombo.SelectedItem as MKM.ComboboxItem).Value + * "</idLanguage>" + * "<comments></comments><count>1</count><price>" + priceBox.Text + "</price><condition>" + * conditionCombo.Text + * "</condition>" + * "<isFoil>false</isFoil><isSigned>false</isSigned><isPlayset>false</isPlayset></article > */ foreach (DataGridViewRow row in scanDataView.Rows) { if (row.Cells[5].Value != "") { xBody += "<article><idProduct>" + row.Cells[5].Value + "</idProduct><idLanguage>" + row.Cells[3].Value + "</idLanguage>" + "<comments></comments><count>1</count><price>" + row.Cells[2].Value + "</price><condition>" + row.Cells[4].Value + "</condition>" + "<isFoil>" + Convert.ToString(row.Cells[6].Value) + "</isFoil><isSigned>" + Convert.ToString(row.Cells[7].Value) + "</isSigned><isPlayset>" + Convert.ToString(row.Cells[8].Value) + "</isPlayset></article >"; } } xBody += "</request>"; MKM.makeRequest("https://www.mkmapi.eu/ws/v2.0/stock", "POST", xBody); MessageBox.Show("Article were added to the marketplace!"); }
private void addMKM() { logBox.AppendText(pidLabel.Text + " " + nameLabel.Text + " (" + (langCombo.SelectedItem as MKM.ComboboxItem).Value + "\\" + conditionCombo.Text + ")\n"); /* * 3. Add an article to the user's stock: * * POST https://www.mkmapi.eu/ws/v2.0/stock */ var xBody = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + "<request><article><idProduct>" + pidLabel.Text + "</idProduct><idLanguage>" + (langCombo.SelectedItem as MKM.ComboboxItem).Value + "</idLanguage>" + "<comments></comments><count>1</count><price>" + priceBox.Text + "</price><condition>" + conditionCombo.Text + "</condition>" + "<isFoil>false</isFoil><isSigned>false</isSigned><isPlayset>false</isPlayset></article></request>"; MKM.makeRequest("https://www.mkmapi.eu/ws/v2.0/stock", "POST", xBody); }