Exemple #1
0
        private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Clear the filtering text fields when refreshing data grid
            filterMenu.Text = "Click to expand...";
            txtFilterByItem.Clear();
            filterMenu.Text        = String.Empty;
            itembox.Text           = String.Empty;
            qtnBox.Text            = String.Empty;
            quantityEquations.Text = String.Empty;
            txtNum.Clear();
            quantityEquations.Text = null;

            // Re-enabling all search fields
            txtFilterByItem.Enabled   = true;
            txtNum.Enabled            = true;
            quantityEquations.Enabled = true;


            // Viewing Raw Materials
            if (dgTools.dbName.Equals("RawMaterials"))
            {
                dgTools.SqlCommand = "SELECT RawMaterialName, Quantity FROM RawMaterials"; // Viewing all data from RawMaterials database except the ID

                dgTools.RefreshDataGrid(stockDataGridView);
            }
        }
Exemple #2
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            // Clear the filtering text fields when refreshing data grid
            filterMenu.Text = "Click to expand...";
            txtFilterByItem.Clear();
            cBoxLocation.Text = null;
            cBoxQuality.Text  = null;
            txtNum.Clear();
            quantityEquations.Text = null;

            // Re-enabling all search fields
            cBoxQuality.Enabled       = true;
            cBoxLocation.Enabled      = true;
            txtFilterByItem.Enabled   = true;
            txtNum.Enabled            = true;
            quantityEquations.Enabled = true;


            // Viewing Products
            if (dgTools.dbName.Equals("Products"))
            {
                dgTools.SqlCommand = "SELECT ProductName, Quality, Quantity, Location FROM Products";

                dgTools.RefreshDataGrid(prodDataGridView);
            }

            // Viewing Raw Materials
            else if (dgTools.dbName.Equals("RawMaterials"))
            {
                dgTools.SqlCommand = "SELECT RawMaterialName, Quantity FROM RawMaterials"; // Viewing all data from RawMaterials database except the ID

                dgTools.RefreshDataGrid(prodDataGridView);
            }
        }
Exemple #3
0
        // Event handler for Add button click
        private void addItemBtn_Click(object sender, EventArgs e)
        {
            addedItems = false;
            try
            {
                strProductsBeingAdded = new List <String>(); // For formatting items into a string to confirm changes on screen

                // Getting the text fields on screen
                string ProductName = txtName.Text;
                int    Quantity    = int.Parse(txtQuantity.Text);

                newProduct = new Product(ProductName, "", Quantity, ""); // Creating Product object with the text fields
                newProducts.Add(newProduct);

                // Clear list view
                itemsView.Items.Clear();

                // Format each product to display in list views
                foreach (Product prod in newProducts)
                {
                    string s = prod.quantity.ToString() + "x " + prod.productName; // Format to display -> (quantity)x (name)
                    strProductsBeingAdded.Add(s);
                    itemsView.Items.Add(s);
                }


                // Creating a new product object, adding it to the database, and auto refreshing the datagrid

                dgTools.RefreshDataGrid(prodDataGridView);

                // Clearing entered values
                txtName.Clear();
                txtQuantity.Clear();
                quantityEquations.Text = null;
                addedItems             = true;
            }
            catch (Exception)
            {
                MessageBox.Show("Cannot add empty product.\nPlease try again.", "Warning!"); // User tries to add a product before typing anything in
                addedItems = false;
            }
        }
 private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
 {
     statusStrip1.Text  = String.Empty;
     dgTools.SqlCommand = "SELECT firstname, lastname FROM AuthorizedUsers WHERE userjob in ('Administrator')"; // Viewing all data from RawMaterials database except the ID
     dgTools.RefreshDataGrid(AdminDataGridView);
     dgTools.SqlCommand = "SELECT firstname, lastname FROM AuthorizedUsers WHERE userjob in ('Quality Analyzer')";
     dgTools.RefreshDataGrid(QualityDataGridView);
     dgTools.SqlCommand = "SELECT firstname, lastname FROM AuthorizedUsers WHERE userjob in ('Report Manager')";
     dgTools.RefreshDataGrid(ReportDataGridView);
     dgTools.SqlCommand = "SELECT firstname, lastname FROM AuthorizedUsers WHERE userjob in ('Delivery Manager')";
     dgTools.RefreshDataGrid(DeliveryDataGridView);
     dgTools.SqlCommand = "SELECT firstname, lastname FROM AuthorizedUsers WHERE userjob in ('Product Manager')";
     dgTools.RefreshDataGrid(ProductDataGridView);
     dgTools.SqlCommand = "SELECT firstname, lastname FROM AuthorizedUsers WHERE userjob in ('Stockiest')";
     dgTools.RefreshDataGrid(StockiestDataGridView);
     txtFirstName.Clear();
     txtLastName.Clear();
     boxOccupation.Text = String.Empty;
 }
        private void refreshBtn_Click(object sender, EventArgs e)
        {
            dgTools.SqlCommand = "SELECT ProductName, Quality, Quantity, Location FROM Products";

            dgTools.RefreshDataGrid(prodDataGridView);
        }