Ejemplo n.º 1
0
        private void okButton_Click(object sender, EventArgs e)
        {
            Form1 form1  = (Form1)this.Owner;
            Order order1 = new Order(order.OrderId, order.Customer, new List <OrderItem> {
                item
            });


            if (form1.os.Orders.Contains(order1))
            {
                Order order2 = form1.os.GetOrder(order.OrderId);


                if (order2.Items.Contains(item))
                {
                    OrderItem item2 = order2.GetItem(item.Index);
                    order2.RemoveItem(item2);
                    order2.Items.Add(item);
                }
                else
                {
                    order2.Items.Add(item);
                }
            }
            else
            {
                form1.os.AddOrder(order1);
            }

            form1.orderBindingSource.ResetBindings(false);
            this.Close();
        }
Ejemplo n.º 2
0
        private void updateButton_Click(object sender, EventArgs e)
        {
            uint      orderID   = (uint)orderDataGridView.CurrentRow.Cells[0].Value;
            Order     order     = os.GetOrder(orderID);
            uint      index     = (uint)itemDataGridView.CurrentRow.Cells[0].Value;
            OrderItem orderItem = order.GetItem(index);
            Form2     form2     = new Form2(order, orderItem);

            form2.Show(this);
        }