示例#1
0
        private void Category_Edit_Click(object sender, EventArgs e)
        {
            try
            {
                var Category_id = Convert.ToInt32(txtCatID.Text);

                Category_Table category_Table = model.Category_Table.Where(a => a.ID_Category == Category_id).FirstOrDefault();

                if (category_Table != null)
                {
                    var            Category_name = txtCatName.Text;
                    Category_Table table         = new Category_Table();

                    table.ID_Category   = Category_id;
                    table.Category_Name = Category_name;

                    model.Entry(table).State = EntityState.Modified;
                    model.SaveChanges();

                    MessageBox.Show("Edit Category Successfully..", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    // TODO: This line of code loads data into the 'scrapeTestDataSetCategories.Category_Table' table. You can move, or remove it, as needed.

                    this.category_TableTableAdapter.Fill(this.scrapeTestDataSetCategories.Category_Table);
                }
                else
                {
                    MessageBox.Show("Your Id is Mismatched!!!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox1.SelectedValue != null)
     {
         Category_Table Obj = Busniss_Logic.SelectCatag(int.Parse(comboBox1.SelectedValue.ToString()));
         CataName.Text = Obj.Catagory_Name;
         CataDes.Text  = Obj.Catagory_Description;
         if (Obj.Catagory_Exist == 1)
         {
             chec.Checked = true;
         }
         else
         {
             chec.Checked = false;
         }
     }
 }
示例#3
0
        private void Del_Category_Btn_Click(object sender, EventArgs e)
        {
            try
            {
                var Category_id = Convert.ToInt32(txtCatID.Text);

                Category_Table category_Table = model.Category_Table.Where(a => a.ID_Category == Category_id).FirstOrDefault();
                model.Category_Table.Remove(category_Table);
                model.SaveChanges();

                MessageBox.Show("Deleted Successfully!!!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);

                // TODO: This line of code loads data into the 'scrapeTestDataSetCategories.Category_Table' table. You can move, or remove it, as needed.

                this.category_TableTableAdapter.Fill(this.scrapeTestDataSetCategories.Category_Table);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#4
0
        private void SaveCategory_Click(object sender, EventArgs e)
        {
            try
            {
                var            Category_id   = Convert.ToInt32(txtCatID.Text);
                var            Category_name = txtCatName.Text;
                Category_Table table         = new Category_Table();

                table.ID_Category   = Category_id;
                table.Category_Name = Category_name;

                model.Category_Table.Add(table);
                model.SaveChanges();
                MessageBox.Show("Category Saved Successfully!!!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);

                // TODO: This line of code loads data into the 'scrapeTestDataSetCategories.Category_Table' table. You can move, or remove it, as needed.

                this.category_TableTableAdapter.Fill(this.scrapeTestDataSetCategories.Category_Table);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#5
0
        private void ScrappingStart_Click(object sender, EventArgs e)
        {
            if (checkboxListCat.SelectedItems.Count != 0)
            {
                if (txtSoldValueInput.Text != "" && txtProductMinPrice.Text != "" && txtProductMaxPrice.Text != "")
                {
                    var maxVal = Convert.ToInt32(txtProductMaxPrice.Text);
                    var minVal = Convert.ToInt32(txtProductMinPrice.Text);
                    if (minVal <= maxVal)
                    {
                        TimerProgressBar.Enabled = true;
                        MessageBox.Show("Timer is on ");
                        ScrapDataTime scrapDataTime = new ScrapDataTime();

                        var    time  = DateTime.Now;
                        string timed = time.ToString();
                        scrapDataTime.TimeDates = timed;

                        model.ScrapDataTimes.Add(scrapDataTime);
                        model.SaveChanges();

                        string soldPrice = txtSoldValueInput.Text;
                        //string name = checkboxListCat.Text;
                        string minPrice = txtProductMinPrice.Text;
                        string maxPrice = txtProductMaxPrice.Text;

                        txtSoldValueInput.ReadOnly  = true;
                        txtProductMinPrice.ReadOnly = true;
                        txtProductMaxPrice.ReadOnly = true;

                        var itemCounr = checkboxListCat.Items.Count;
                        for (int i = 0; i < checkboxListCat.Items.Count; i++)
                        {
                            if (checkboxListCat.GetItemChecked(i) == true)
                            {
                                string         str            = (string)checkboxListCat.Items[i];
                                Category_Table category_Table = model.Category_Table.Where(a => a.Category_Name == str).FirstOrDefault();
                                string         url            = category_Table.UrlCategory;
                                url = url.ToString();
                                ScrapeData(str, url, soldPrice);
                            }
                        }
                        //foreach (ListItem item in checkboxListCat.SelectedItems)
                        //{
                        //    ScrapeData(item.ToString(), soldPrice);
                        //}


                        //ScrapeData("Women's Fashion", soldPrice);
                        TimerProgressBar.Enabled = false;
                    }
                    else
                    {
                        MessageBox.Show("Minimum Price is Greator than Maximum!!!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("Enter All Required Values", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("Nothing will be selected", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }