Exemplo n.º 1
0
        private void PosMainWindow_Load(object sender, EventArgs e)
        {
            DataSourceSelectorUI dataSelector = new DataSourceSelectorUI();

            if (dataSelector.ShowDialog() == DialogResult.OK)
            {
                m_record = dataSelector.Record;
            }
            else
            {
                this.Dispose();
                Application.Exit();
                return;
            }

            m_register    = new Register(m_record);
            m_report      = new Report();
            m_saleControl = new SaleControl(ref m_register, ref m_report, ref removeItemButton);
            saleTab.Controls.Add(m_saleControl);

            m_reportTab = new TabPage(" Report ");
            m_reportTab.Controls.Add(new ReportControl(ref m_report, ref m_register));
            m_reportTab.Enter += new EventHandler(m_reportTab_Enter);

            m_inventoryTab = new TabPage(" Inventory ");
            m_inventoryTab.Controls.Add(new InventoryControl(ref m_register));
            m_inventoryTab.Enter += new EventHandler(m_inventoryTab_Enter);
        }
Exemplo n.º 2
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);
            }
        }