Exemplo n.º 1
0
        public List<BegemotPriceRow> ParsePrice(string path)
        {
            DataTable priceTable = GetExcelTable(path);

            var begemotPriceRows = new List<BegemotPriceRow>();
            for (int i = 4; i < priceTable.Rows.Count; i++)
            {
                var dataRow = priceTable.Rows[i];
                var begemotRow = new BegemotPriceRow(dataRow);
                begemotPriceRows.Add(begemotRow);
            }

            return begemotPriceRows;
        }
Exemplo n.º 2
0
        void timer_Tick(object sender, EventArgs e)
        {
            SaveScreenShot();

            while (true)
            {
                while (true)
                {
                    index++;

                    if (index >= lots.Count)
                    {
                        timer.Stop();
                        return;
                    }

                    Title = string.Format("{0} из {1}", index + 1, lots.Count);
                    lot = lots[index];
                    var articleStr = lot.Article.ToString();

                    var needToSkip = imagesToSkipProccess.Any(i => i == articleStr);
                    if (!needToSkip) break;
                }

                string uri = string.Format("http://www.begemott.ru/photos/{0}.jpg", lot.Article);
                string savePath = string.Format("{0}/{1}.jpg", sourceImagesFolder.FullName, lot.Article);

                bool noImage = false;
                try
                {
                    bool skipDownload = imagesToSkipDownload.Any(i => i == lot.Article.ToString());

                    if (!skipDownload)
                    {
                        pageLoader.RequestImage(uri, savePath);
                    }
                }
                catch (WebException we)
                {
                    noImage = true;

                }

                if (noImage)
                {
                    // обрабатываем следующий лот
                }
                else
                {

                    imgProductPhoto.Source = new BitmapImage(new Uri(savePath));
                    txtPrice.Text = lot.OldPrice.ToString("f2");
                    txtDescountPrice.Text = lot.DescountPrice.ToString("f2");
                    txtTitle.Text = lot.TitleNormal;

                    saveImageFlag = true;

                    break;
                }
            }
        }