Ejemplo n.º 1
0
        /*------------------------
        |   Part event handlers  |
        |  ------------------------*/

        // Add New Part.
        private void AddPartButton_Click(object sender, EventArgs e)
        {
            this.Hide();
            this.dataGridViewProducts.Refresh();
            PartScreen addPartScreen = new PartScreen();

            // Change addModifyPartLabel text to Add Part.
            addPartScreen.addModifyPartLabel.Text = "Add Part";

            // Change text color to sliver.
            addPartScreen.partNametextBox.ForeColor  = Color.Silver;
            addPartScreen.inventoryTextBox.ForeColor = Color.Silver;
            addPartScreen.priceCostTextBox.ForeColor = Color.Silver;
            addPartScreen.maxTextBox.ForeColor       = Color.Silver;
            addPartScreen.minTextBox.ForeColor       = Color.Silver;
            addPartScreen.compMachTextBox.ForeColor  = Color.Silver;
            addPartScreen.ShowDialog();
        }
Ejemplo n.º 2
0
        // Modify part.
        private void ModifyPartButton_Click(object sender, EventArgs e)
        {
            if (indexOfSelectedPart >= 0)
            {
                this.Hide();
                PartScreen modifyPartScreen = new PartScreen();

                // Change addModifyPartLabel text to Modify Part.
                modifyPartScreen.addModifyPartLabel.Text = "Modify Part";
                modifyPartScreen.partIDTextBox.Text      = Inventory.CurrentPart.PartID.ToString();
                modifyPartScreen.partNametextBox.Text    = Inventory.CurrentPart.PartName;
                modifyPartScreen.inventoryTextBox.Text   = Inventory.CurrentPart.InStock.ToString();
                modifyPartScreen.priceCostTextBox.Text   = Inventory.CurrentPart.PriceCost.ToString();
                modifyPartScreen.maxTextBox.Text         = Inventory.CurrentPart.Max.ToString();
                modifyPartScreen.minTextBox.Text         = Inventory.CurrentPart.Min.ToString();
                modifyPartScreen.Show();
            }
            else
            {
                MessageBox.Show("Select a Part to modify!");
            }
        }