Ejemplo n.º 1
0
        //-----------------------------
        //  ITEM DETAILS TAB METHODS  |
        //-----------------------------
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if ((txtSearchFor.Text == "Search for...") || (txtSearchFor.Text == ""))
            {
                MessageBox.Show("Please input something to search for.", "Nothing to Search", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (cbbFilterBy.Text == "Filter by...")
            {
                MessageBox.Show("Please select a filter option.", "No Filter Option", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //Valid search input
            if (dgvItemSelection.Rows.Count == 0) //If Supplier selected doesn't offer anything
            {
                MessageBox.Show("There is nothing to search for.", "No Items to Search For", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //Valid search input, and there are items in dgvItemSelection
            SupplierIDFK = sql.SelectSupplierID(SupplierName); //Extract Supplier ID; use it next query
            dgvItemSelection.Rows.Clear();
            sql.SearchSupplierItems(dgvItemSelection, cbbFilterBy.Text, SupplierIDFK, txtSearchFor.Text);
            if (dgvItemSelection.Rows.Count == 0) //Empty search results
            {
                MessageBox.Show("No item(s) was found.", "Empty Search Results", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }