コード例 #1
0
        private void removeItemButton_Click(object sender, EventArgs e)
        {
            SaleControl sc = null;

            foreach (Control c in saleTab.Controls)
            {
                if (c is SaleControl)
                {
                    sc = c as SaleControl;
                }
            }

            if (sc == null)
            {
                return;
            }

            ItemSearchUI searchUI = new ItemSearchUI(sc, true, true);
            DialogResult tempDR;

            tempDR = searchUI.ShowDialog();

            if (tempDR != DialogResult.OK)
            {
                return;
            }

            if (!sc.Remove(searchUI.Product))
            {
                MessageBox.Show("The Product was not in the Sale!"
                                + " But seriously, how did you do that?",
                                "Error!", MessageBoxButtons.OK);
            }
        }
コード例 #2
0
        private void addItemButton_Click(object sender, EventArgs e)
        {
            ItemSearchUI itemSearch = new ItemSearchUI(m_register.Products, false, true);
            DialogResult tempDR     = itemSearch.ShowDialog();

            if (tempDR == DialogResult.OK)
            {
                m_saleControl.Add(itemSearch.Product);
                removeItemButton.Enabled = true;
            }
            else
            {
                return;
            }
        }