Example #1
0
        void setting(Label name, HiddenField itemid, Label unitprice, Label second, Label aver)
        {
            itemName = name.Text;
            url      = "https://api.neople.co.kr/df/auction?itemName=" + itemName + "&sort=unitPrice:asc&limit=20&wordType=match&apikey=" + apiKey;
            HttpWebRequest  request  = (HttpWebRequest)WebRequest.Create(url);
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            Stream          stream   = response.GetResponseStream();

            StreamReader reader  = new StreamReader(stream, Encoding.UTF8);
            RowMenu      rowMenu = JsonConvert.DeserializeObject <RowMenu>(reader.ReadToEnd());


            itemid.Value = rowMenu.rows[0].itemID;

            for (int i = 0; i < rowMenu.rows.Length; i++)
            {
                if (rowMenu.rows[i].unitPrice == 0)
                {
                    continue;
                }
                else
                {
                    unitprice.Text = rowMenu.rows[i].unitPrice + "";
                    if ((i + 1) < rowMenu.rows.Length)
                    {
                        second.Text = rowMenu.rows[i + 1].unitPrice + "";
                    }
                    break;
                }
            }
            aver.Text = rowMenu.rows[0].averagePrice + "";
        }
Example #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            unitPriceLabel.Text   = "0";
            secondPriceLabel.Text = "0";

            itemName = TextBox1.Text;
            url      = "https://api.neople.co.kr/df/auction?itemName=" + itemName + "&sort=unitPrice:asc&limit=20&wordType=match&apikey=" + apiKey;


            HttpWebRequest  request  = (HttpWebRequest)WebRequest.Create(url);
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            Stream          stream   = response.GetResponseStream();

            StreamReader reader  = new StreamReader(stream, Encoding.UTF8);
            RowMenu      rowMenu = JsonConvert.DeserializeObject <RowMenu>(reader.ReadToEnd());


            if (rowMenu.rows.Length > 0)
            {
                itemNameLabel.Text = itemName;
                for (int i = 0; i < rowMenu.rows.Length; i++)
                {
                    if (rowMenu.rows[i].unitPrice == 0)
                    {
                        continue;
                    }
                    else
                    {
                        unitPriceLabel.Text = rowMenu.rows[i].unitPrice + "";
                        if ((i + 1) < rowMenu.rows.Length)
                        {
                            secondPriceLabel.Text = rowMenu.rows[i + 1].unitPrice + "";
                        }
                        break;
                    }
                }
                averagePriceLabel.Text = rowMenu.rows[0].averagePrice + "";
            }
        }