コード例 #1
0
        private void issuingPartsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmDataEntry d = new FrmDataEntry();

            d.Title = "Issuing Parts";

            if (d.ShowDialog() == DialogResult.OK)
            {
                MessageBox.Show("Back from Issuing Parts");

                string pn = d.PartNumber;
                int    q  = Convert.ToInt32(d.Quantity);

                string s = "";

                if (d.Small == true)
                {
                    s = "small";
                }
                else if (d.Medium == true)
                {
                    s = "medium";
                }
                else if (d.Large == true)
                {
                    s = "large";
                }

                int pnpicked = Search.Linear(partnumber, pn, ur);
                int spicked  = Search.Linear(partsize, s, uc);

                if (pnpicked != -1 && spicked != -1)
                {
                    if (inventory[pnpicked, spicked] < q)
                    {
                        MessageBox.Show("Not enough stock to fill order" + "\n" + "Present Stock " + inventory[pnpicked, spicked]);
                    }
                    else
                    {
                        inventory[pnpicked, spicked] -= q;
                        MessageBox.Show("Inventory Stock is now " + inventory[pnpicked, spicked]);
                    }
                }
                else
                {
                    MessageBox.Show("Invalid Selection");
                }
            }
        }
コード例 #2
0
        private void receivingPartsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmDataEntry d = new FrmDataEntry();

            d.Title = "Receiving Parts";

            if (d.ShowDialog() == DialogResult.OK)
            {
                MessageBox.Show("back from Receiving Parts");

                string pn = d.PartNumber;
                int    q  = Convert.ToInt32(d.Quantity);

                string s = "";

                if (d.Small == true)
                {
                    s = "small";
                }
                else if (d.Medium == true)
                {
                    s = "medium";
                }
                else if (d.Large == true)
                {
                    s = "large";
                }

                int pnpicked = Search.Linear(partnumber, pn, ur);
                int spicked  = Search.Linear(partsize, s, uc);

                if (pnpicked != -1 && spicked != -1)
                {
                    inventory[pnpicked, spicked] += q;
                }
                else
                {
                    MessageBox.Show("Invalid Selection");
                }
            }
            else
            {
                MessageBox.Show("You pressed cancel");
            }
        }