예제 #1
0
        private void updateButton_Click(object sender, EventArgs e)
        {
            string q1    = "SELECT COUNT(*) FROM EQUIPMENT WHERE EQUIPMENT.EQUIPMENT_NAME = '" + EquipCombobox.Text + "' AND EQUIPMENT.STATUS = '1' ";
            string q2    = "SELECT COUNT(*) FROM INVENTORY WHERE INVENTORY.TERM_ID = '" + TermIDTextbox.Text + "' AND INVENTORY.STATUS = '1' ";
            string query = "SELECT TERM_ID FROM INVENTORY WHERE INVENTORY_ID = '" + IDTextbox.Text + "' ";

            string queryCheck1 = "SELECT PROJECT_NAME FROM PROJECT JOIN INVENTORY ON INVENTORY.PROJECT_ID = PROJECT.PROJECT_ID " +
                                 "WHERE INVENTORY.INVENTORY_ID = '" + IDTextbox.Text + "' ";
            string queryCheck2 = "SELECT EQUIPMENT_NAME FROM EQUIPMENT JOIN INVENTORY ON INVENTORY.EQUIPMENT_ID = EQUIPMENT.EQUIPMENT_ID " +
                                 "WHERE INVENTORY.INVENTORY_ID = '" + IDTextbox.Text + "' ";
            string queryCheck3 = "SELECT TERM_ID FROM INVENTORY WHERE INVENTORY.INVENTORY_ID = '" + IDTextbox.Text + "' ";

            List <string> editList = new List <string>();


            //EditChecking(q1);
            //EditTermIDCheck(q2);

            if (DataTableSQLQuery(q1).Rows[0][0].ToString() == "0")
            {
                MessageBox.Show("Not a valid value");
            }
            else
            {
                eqCheck = true;
            }

            if ((DataTableSQLQuery(q2).Rows[0][0].ToString() == "1") && (ScalarSQLQuery(query, con) != TermIDTextbox.Text))
            {
                MessageBox.Show("TERM ID already exists.");
            }
            else
            {
                tmCheck = true;
            }

            if ((eqCheck == true) && (tmCheck == true))
            {
                eqCheck = false;
                tmCheck = false;
                UpdateList(queryCheck1, IDTextbox.Text, ProjectCombobox.Text, editList);
                UpdateList(queryCheck2, IDTextbox.Text, EquipCombobox.Text, editList);
                UpdateList(queryCheck3, IDTextbox.Text, TermIDTextbox.Text, editList);

                for (int i = 0; i < editList.Count; i++)
                {
                    Console.WriteLine(editList[i]);
                    History.HistoryInventoryUpdate(editList[i]);
                }
                Inventory.UpdateButton(EquipCombobox, ProjectCombobox, TermIDTextbox, IDTextbox, con);
            }

            InventoryDataGrid.DataSource = null;
            Inventory.DisplayInventory(InventoryDataGrid, con);
            checkBox1.Checked = false;
        }
예제 #2
0
        private void inventoryBackButton_Click(object sender, EventArgs e)
        {
            //Inventory inven = new Inventory();

            inventoryGridIndex = 0;
            Inventory.DisplayInventory(InventoryDataGrid, con);

            // inventoryBackButton.Enabled = false;
            // inventoryBackButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(115)))), ((int)(((byte)(115)))), ((int)(((byte)(120)))));
            // inventoryBackButton.ForeColor = Color.Black;
        }
예제 #3
0
        //Inventory Tab - Runs a sql query with every keystroke within searchTextbox.
        private void InventorySearchTextbox_TextChanged(object sender, EventArgs e)
        {
            if (inventoryGridIndex == 0)
            {
                inventoryGridIndex = 1;
            }

            if (String.IsNullOrEmpty(InventorySearchTextbox.Text))
            {
                Inventory.DisplayInventory(InventoryDataGrid, con);
            }
            else if (System.Text.RegularExpressions.Regex.IsMatch(InventorySearchTextbox.Text, "^[a-zA-Z0-9]"))
            {
                Inventory.InventorySearch(InventoryDataGrid, InventoryFilterCombo.Text, InventorySearchTextbox.Text, con);
            }
        }
예제 #4
0
        //Display inventory panel and hide every other panel.
        private void InventoryPanelButton_Click(object sender, EventArgs e)
        {
            inventoryPanel.Visible        = true;
            projectsPanel.Visible         = false;
            historyPanel.Visible          = false;
            barcodePanel.Visible          = false;
            insertBarcodeButton.Enabled   = false;
            insertBarcodeButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(115)))), ((int)(((byte)(115)))), ((int)(((byte)(120)))));
            insertBarcodeButton.ForeColor = Color.Black;

            InventoryDataGrid.DataSource = null;
            inventoryGridIndex           = 0;
            label19.Text = "Pathology Informatics - Inventory";

            TabBtnColor(InventoryPanelButton, ProjectsPanelButton, HistoryPanelButton, BarcodePanelButton);
            Inventory.DisplayInventory(InventoryDataGrid, con);
        }
예제 #5
0
        ////////// MAIN FORM ////////////

        //Loads these functions on main form load
        private void Main_Load_1(object sender, EventArgs e)
        {
            InventoryPanelButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(65)))), ((int)(((byte)(65)))), ((int)(((byte)(75)))));
            fakeSearchTextbox.ForeColor    = Color.LightGray;
            quantityTextbox.Text           = "1";
            label19.Text = "Pathology Informatics - Inventory";

            InventoryDataGrid.EnableHeadersVisualStyles = false;

            Inventory.InventorySearchComboFill(InventoryFilterCombo);
            InventoryFilterCombo.SelectedIndex = 3;
            fakeSearchTextbox.Text             = "Search " + InventoryFilterCombo.Text;
            Inventory.DisplayInventory(InventoryDataGrid, con);
            Inventory.InventoryComboFill(ProjectCombobox, CategoryCombobox, EquipCombobox);


            EditData(IDTextbox, TermIDTextbox, ProjectCombobox, CategoryCombobox, EquipCombobox, ProductTextbox, InventoryDataGrid, con);
            barcodeTextbox.Select();
        }
예제 #6
0
 private void mainTabControl_Selected(object sender, TabControlEventArgs e)
 {
     //Refresh displayed data when switching between tabs.
     Inventory.DisplayInventory(InventoryDataGrid, con);
 }