private void ConfigureProductsList()
 {
     ProductDataGridView.SelectionChanged -= ProductDataGridView_SelectionChanged;
     ProductDataGridView.DataSource        = null;
     ProductDataGridView.DataSource        = source;
     ProductDataGridView.Refresh();
     ConfigureGrid();
     ProductDataGridView.SelectionChanged += ProductDataGridView_SelectionChanged;
 }
Exemplo n.º 2
0
        private void SelectCategoriesButton_Click(object sender, EventArgs e)
        {
            var categories = CategoryCheckedListBox.CheckedCategoriesList().Select(category => (int?)category.CategoryID);
            var ops        = new DataOperations();
            var data       = ops.ProductsByCategories(categories.ToList()).ToList();

            ProductDataGridView.DataSource = data;
            ProductDataGridView.ExpandColumns();
        }
        /// <summary>
        /// This is event handler for SelectForm Load event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SelectForm_Load(object sender, EventArgs e)
        {
            // loading up the database

            using (var db = new ProductModel())
            {
                db.products.Load();
                productBindingSource.DataSource = db.products.Local.ToBindingList();
            }
            ProductDataGridView.ClearSelection();
        }
 private void SelectForm_Load(object sender, EventArgs e)
 {
     using (var db = new ProductModel())
     {
         db.products.Load();
     }
     // TODO: This line of code loads data into the 'dollarComputersDataSet.products' table. You can move, or remove it, as needed.
     this.productsTableAdapter.Fill(this.dollarComputersDataSet.products);
     ProductDataGridView.ClearSelection();
     NextButton.Enabled = false;
 }
Exemplo n.º 5
0
        /// <summary>
        /// This method handle the Load event of the selectForm
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SelectProductForm_Load(object sender, EventArgs e)
        {
            //disable next button
            SelectFormNextButton.Enabled = false;

            //bind database data to the productDataGridView
            using (var db = new DollarComputersContext())
            {
                db.products.Load();
                productBindingSource.DataSource = db.products.Local.ToBindingList();
            }
            ProductDataGridView.UpdateCellValue(0, 0);
        }
Exemplo n.º 6
0
 private void RefreshButton_Click(object sender, EventArgs e)
 {
     LoadPaymentData();
     LoadProductsIntoPaymentData();
     ProductDataGridView.Focus();
 }
Exemplo n.º 7
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            if (ProductTextBox.Text.Length == 0 && checkBox1.Checked == false)
            {
                MessageBox.Show("Please Enter Product Name Or Search By A Certain Store");
            }
            else if (ProductTextBox.Text.Length != 0 && checkBox1.Checked == false)
            {
                search = 1;

                DataTable dt = controllerObj.GetProductsByName(ProductTextBox.Text, DepartmentComboBox.Text);
                ProductDataGridView.DataSource = dt;
                ProductDataGridView.Refresh();
                index = 0;
                if (ProductDataGridView.Rows.Count > 0)
                {
                    label10.Text = ProductDataGridView.Rows[index].Cells[0].Value.ToString();
                    label11.Text = ProductDataGridView.Rows[index].Cells[1].Value.ToString();
                    label12.Text = ProductDataGridView.Rows[index].Cells[2].Value.ToString();
                    label13.Text = ProductDataGridView.Rows[index].Cells[3].Value.ToString();
                    label14.Text = ProductDataGridView.Rows[index].Cells[4].Value.ToString();
                    label17.Text = ProductDataGridView.Rows[index].Cells[5].Value.ToString();
                }
                else
                {
                    label10.Text = "";
                    label11.Text = "";
                    label12.Text = "";
                    label13.Text = "";
                    label14.Text = "";
                    label17.Text = "";
                }
            }

            if (checkBox1.Checked == true)
            {
                if (ProductTextBox.Text.Length == 0)
                {
                    search = 2;
                    string StoreName = StoreComboBox.Text;
                    storeselected = StoreName;
                    DataTable dt = controllerObj.GetProductsByStoreName(StoreName, DepartmentComboBox.Text);
                    ProductDataGridView.DataSource = dt;
                    ProductDataGridView.Refresh();
                    index = 0;
                    if (ProductDataGridView.Rows.Count > 0)
                    {
                        label10.Text = ProductDataGridView.Rows[index].Cells[0].Value.ToString();
                        label11.Text = ProductDataGridView.Rows[index].Cells[1].Value.ToString();
                        label12.Text = ProductDataGridView.Rows[index].Cells[2].Value.ToString();
                        label13.Text = ProductDataGridView.Rows[index].Cells[3].Value.ToString();
                        label14.Text = ProductDataGridView.Rows[index].Cells[4].Value.ToString();
                        label17.Text = ProductDataGridView.Rows[index].Cells[5].Value.ToString();
                    }
                    else
                    {
                        label10.Text = "";
                        label11.Text = "";
                        label12.Text = "";
                        label13.Text = "";
                        label14.Text = "";
                        label17.Text = "";
                    }
                }
                else
                {
                    search = 3;
                    string StoreName = StoreComboBox.Text;
                    storeselected = StoreName;
                    DataTable dt = controllerObj.GetProductsByNameAndStore(ProductTextBox.Text, StoreName, DepartmentComboBox.Text);
                    ProductDataGridView.DataSource = dt;
                    ProductDataGridView.Refresh();
                    index = 0;
                    if (ProductDataGridView.Rows.Count > 0)
                    {
                        label10.Text = ProductDataGridView.Rows[index].Cells[0].Value.ToString();
                        label11.Text = ProductDataGridView.Rows[index].Cells[1].Value.ToString();
                        label12.Text = ProductDataGridView.Rows[index].Cells[2].Value.ToString();
                        label13.Text = ProductDataGridView.Rows[index].Cells[3].Value.ToString();
                        label14.Text = ProductDataGridView.Rows[index].Cells[4].Value.ToString();
                        label17.Text = ProductDataGridView.Rows[index].Cells[5].Value.ToString();
                    }
                    else
                    {
                        label10.Text = "";
                        label11.Text = "";
                        label12.Text = "";
                        label13.Text = "";
                        label14.Text = "";
                        label17.Text = "";
                    }
                }
            }
        }
Exemplo n.º 8
0
        private void AddBookButton_Click(object sender, EventArgs e)
        {
            if (ProductDataGridView.Rows.Count > 0)
            {
                int CID = controllerObj.GetCUID(Cuser);



                string storename = ProductDataGridView.Rows[index].Cells[4].Value.ToString();


                string ItemName    = ProductDataGridView.Rows[index].Cells[0].Value.ToString();
                string priceDollar = ProductDataGridView.Rows[index].Cells[2].Value.ToString();
                string PricePoints = ProductDataGridView.Rows[index].Cells[3].Value.ToString();

                int result = controllerObj.AddProductToSC(CID, CID, ItemName, storename, Int32.Parse(priceDollar), Int32.Parse(PricePoints), DepartmentComboBox.Text);
                if (result == 1)
                {
                    controllerObj.DecPQuantity(ItemName, storename);
                    MessageBox.Show("Item Added To Shopping Cart");
                    if (search == 1)
                    {
                        DataTable dt = controllerObj.GetProductsByName(ProductTextBox.Text, DepartmentComboBox.Text);
                        ProductDataGridView.DataSource = dt;
                        ProductDataGridView.Refresh();
                        index = 0;
                        if (ProductDataGridView.Rows.Count > 0)
                        {
                            label10.Text = ProductDataGridView.Rows[index].Cells[0].Value.ToString();
                            label11.Text = ProductDataGridView.Rows[index].Cells[1].Value.ToString();
                            label12.Text = ProductDataGridView.Rows[index].Cells[2].Value.ToString();
                            label13.Text = ProductDataGridView.Rows[index].Cells[3].Value.ToString();
                            label14.Text = ProductDataGridView.Rows[index].Cells[4].Value.ToString();
                            label17.Text = ProductDataGridView.Rows[index].Cells[5].Value.ToString();
                        }
                        else
                        {
                            label10.Text = "";
                            label11.Text = "";
                            label12.Text = "";
                            label13.Text = "";
                            label14.Text = "";
                            label17.Text = "";
                        }
                    }
                    if (search == 2)
                    {
                        string StoreName = StoreComboBox.Text;
                        storeselected = StoreName;
                        DataTable dt = controllerObj.GetProductsByStoreName(StoreName, DepartmentComboBox.Text);
                        ProductDataGridView.DataSource = dt;
                        ProductDataGridView.Refresh();
                        index = 0;
                        if (ProductDataGridView.Rows.Count > 0)
                        {
                            label10.Text = ProductDataGridView.Rows[index].Cells[0].Value.ToString();
                            label11.Text = ProductDataGridView.Rows[index].Cells[1].Value.ToString();
                            label12.Text = ProductDataGridView.Rows[index].Cells[2].Value.ToString();
                            label13.Text = ProductDataGridView.Rows[index].Cells[3].Value.ToString();
                            label14.Text = ProductDataGridView.Rows[index].Cells[4].Value.ToString();
                            label17.Text = ProductDataGridView.Rows[index].Cells[5].Value.ToString();
                        }
                        else
                        {
                            label10.Text = "";
                            label11.Text = "";
                            label12.Text = "";
                            label13.Text = "";
                            label14.Text = "";
                            label17.Text = "";
                        }
                    }
                    if (search == 3)
                    {
                        string StoreName = StoreComboBox.Text;
                        storeselected = StoreName;
                        DataTable dt = controllerObj.GetProductsByNameAndStore(ProductTextBox.Text, StoreName, DepartmentComboBox.Text);
                        ProductDataGridView.DataSource = dt;
                        ProductDataGridView.Refresh();
                        index = 0;
                        if (ProductDataGridView.Rows.Count > 0)
                        {
                            label10.Text = ProductDataGridView.Rows[index].Cells[0].Value.ToString();
                            label11.Text = ProductDataGridView.Rows[index].Cells[1].Value.ToString();
                            label12.Text = ProductDataGridView.Rows[index].Cells[2].Value.ToString();
                            label13.Text = ProductDataGridView.Rows[index].Cells[3].Value.ToString();
                            label14.Text = ProductDataGridView.Rows[index].Cells[4].Value.ToString();
                            label17.Text = ProductDataGridView.Rows[index].Cells[5].Value.ToString();
                        }
                        else
                        {
                            label10.Text = "";
                            label11.Text = "";
                            label12.Text = "";
                            label13.Text = "";
                            label14.Text = "";
                            label17.Text = "";
                        }
                    }
                }
            }
        }
 private void ListRefreshToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ConfigureProductsList();
     ProductDataGridView.Focus();
 }