private void btnScrappingHtml_Click(object sender, EventArgs e)
        {
            StoreScrapper storeScrapper = new StoreScrapper();

            txtNombre.Text              = string.Empty;
            txtPrecio.Text              = string.Empty;
            txtPrecioOferta.Text        = string.Empty;
            txtPrecioOfertaTarjeta.Text = string.Empty;
            txtSKU.Text = string.Empty;
            string storeName = string.Empty;
            Uri    url       = new Uri(txtURL.Text);

            switch (url.Host)
            {
            case StoreScrapper.hostFalabella:
                storeName = "Falabella";
                break;

            case StoreScrapper.hostRipley:
                storeName = "Ripley";
                break;
            }

            if (storeName == string.Empty)
            {
                MessageBox.Show("Service not available for this web");
            }
            else
            {
                var productExtractResult = storeScrapper.ExtractProductData(txtURL.Text, storeName);

                if (productExtractResult != null)
                {
                    txtSKU.Text                 = productExtractResult.SKU;
                    txtNombre.Text              = productExtractResult.Name;
                    txtPrecio.Text              = productExtractResult.Price;
                    txtPrecioOferta.Text        = productExtractResult.DiscountPrice;
                    txtPrecioOfertaTarjeta.Text = productExtractResult.DiscountPriceWithCard;
                }
            }
        }
Exemple #2
0
        private void btnScrappingHtml_Click(object sender, EventArgs e)
        {
            txtNombre.Text              = string.Empty;
            txtPrecio.Text              = string.Empty;
            txtPrecioOferta.Text        = string.Empty;
            txtPrecioOfertaTarjeta.Text = string.Empty;

            StoreScrapper storeScrapper = new StoreScrapper();

            var storeName = rdbFalabella.Checked ? "Falabella" : "Ripley";

            var productExtractResult = storeScrapper.ExtractProductData(txtURL.Text, storeName);

            if (productExtractResult != null)
            {
                txtNombre.Text              = productExtractResult.Name;
                txtPrecio.Text              = productExtractResult.Price;
                txtPrecioOferta.Text        = productExtractResult.DiscountPrice;
                txtPrecioOfertaTarjeta.Text = productExtractResult.DiscountPriceWithCard;
            }
        }