Beispiel #1
0
        private void EditDetail()
        {
            OrderDetail detail = bdsDetails.Current as OrderDetail;

            if (detail == null)
            {
                MessageBox.Show("请选择一个订单项进行修改");
                return;
            }
            DetailEditForm detailEditForm = new DetailEditForm(detail);

            if (detailEditForm.ShowDialog() == DialogResult.OK)
            {
                bdsDetails.ResetBindings(false);
            }
        }
Beispiel #2
0
        private void button_AddDetail_Click(object sender, EventArgs e)
        {
            DetailEditForm detailEditForm = new DetailEditForm(new OrderDetail());

            try
            {
                if (detailEditForm.ShowDialog() == DialogResult.OK)
                {
                    uint index = 0;
                    if (CurrentOrder.OrderDetails.Count != 0)
                    {
                        index = CurrentOrder.OrderDetails.Max(i => i.Index) + 1;
                    }
                    detailEditForm.Detail.Index = index;
                    CurrentOrder.AddItem(detailEditForm.Detail);
                    bdsDetails.ResetBindings(false);
                }
            }
            catch (Exception e2)
            {
                MessageBox.Show(e2.Message);
            }
        }