Esempio n. 1
0
        private bool isSaved;             //проверка, чтобы не выйти без сохранения

        /* Конструктор, если будем сохранять результаты индексации в БД */
        public IndexingDetails(int _productId, string _asin, string _sku, string _productName, IndexingStatus _mf, DateTime _date)
        {
            InitializeComponent();

            ProductId   = _productId;
            ASIN        = _asin;
            ProductName = _productName;
            Date        = _date;
            SKU         = _sku;

            controlIndexingStatus = _mf;
            connection            = DBData.GetDBConnection();

            isSaved = false;

            this.Text = ProductName + " : " + ASIN + ", " + SKU;

            GetAllProductWithSameASIN();
        }
Esempio n. 2
0
        /* Запускаем индексацию, получаем поля семантики из БД и открываем с их помощью вкладки поиска на Амазон */
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0 && e.ColumnIndex == 7 && (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == null || dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().Equals("")))
            {
                int row = dataGridView1.CurrentCell.RowIndex;
                int col = dataGridView1.CurrentCell.ColumnIndex;


                int      proId    = int.Parse(dataGridView1.Rows[row].Cells[0].Value.ToString());
                string   asin     = dataGridView1.Rows[row].Cells[2].Value.ToString();
                string   prodName = dataGridView1.Rows[row].Cells[1].Value.ToString();
                string   sku      = dataGridView1.Rows[row].Cells[3].Value.ToString();
                DateTime dt       = DateTime.Now;

                //IndexingStatus indst = new IndexingStatus(proId, asin, sku, prodName, this, dt);

                //indst.Show();
                //this.Visible = false;

                //getSemanticsFromDBAndOpenURL(proId);

                string     sqlSemantics = "SELECT * FROM Semantics WHERE ProductId = " + proId;
                SqlCommand command      = new SqlCommand(sqlSemantics, connection);

                try
                {
                    connection.Open();

                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            SetSemanticsToList((IDataRecord)reader);
                        }
                    }
                    else
                    {
                        Console.WriteLine("No rows found.");
                    }
                    reader.Close();
                    connection.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Упс! Возникла проблема с подключением к БД.", "Ошибка");
                    return;
                }
                if (smList.Count > 0)
                {
                    IndexingStatus indst = new IndexingStatus(proId, asin, sku, prodName, this, dt);

                    indst.Show();
                    this.Visible = false;

                    System.Diagnostics.Process.Start(AmazonLink + smList[smList.Count - 1].Title.Replace(' ', '+'));
                    System.Threading.Thread.Sleep(200);
                    System.Diagnostics.Process.Start(AmazonLink + smList[smList.Count - 1].Bullet1.Replace(' ', '+'));
                    System.Threading.Thread.Sleep(200);
                    System.Diagnostics.Process.Start(AmazonLink + smList[smList.Count - 1].Bullet2.Replace(' ', '+'));
                    System.Threading.Thread.Sleep(200);
                    System.Diagnostics.Process.Start(AmazonLink + smList[smList.Count - 1].Bullet3.Replace(' ', '+'));
                    System.Threading.Thread.Sleep(200);
                    System.Diagnostics.Process.Start(AmazonLink + smList[smList.Count - 1].Bullet4.Replace(' ', '+'));
                    System.Threading.Thread.Sleep(200);
                    System.Diagnostics.Process.Start(AmazonLink + smList[smList.Count - 1].Bullet5.Replace(' ', '+'));
                    System.Threading.Thread.Sleep(200);
                    System.Diagnostics.Process.Start(AmazonLink + smList[smList.Count - 1].Backend.Replace(' ', '+'));

                    smList.RemoveAt(0);
                }
                else
                {
                    MessageBox.Show("Семантики для выбранного товара не найдено.", "Ошибка");
                }
            }
        }