Exemplo n.º 1
0
        private void btnEditItem_Click(object sender, EventArgs e)
        {
            OrderItem item = ItemBindingSource.Current as OrderItem;

            if (item == null)
            {
                MessageBox.Show("请选择一件商品进行修改");
                return;
            }
            ItemEditForm form2 = new ItemEditForm(item, true);

            if (form2.ShowDialog() == DialogResult.OK)
            {
                CurrentOrder.AddItem(item);
                OrderBindingSource.ResetBindings(true);
            }
        }
Exemplo n.º 2
0
        private void btnAddItem_Click(object sender, EventArgs e)
        {
            ItemEditForm form2 = new ItemEditForm(new OrderItem());

            try
            {
                if (form2.ShowDialog() == DialogResult.OK)
                {
                    CurrentOrder.AddItem(form2.CurrentItem);
                    OrderBindingSource.ResetBindings(true);
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }