Exemplo n.º 1
0
        private void EditDetail()
        {
            OrderDetail detail = bdsDetail.Current as OrderDetail;

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

            if (formDetailEdit.ShowDialog() == DialogResult.OK)
            {
                bdsDetail.ResetBindings(false);
            }
        }
Exemplo n.º 2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            FormDetail formItemEdit = new FormDetail(new OrderDetail());

            try
            {
                if (formItemEdit.ShowDialog() == DialogResult.OK)
                {
                    int index = 0;
                    if (CurrentOrder.Details.Count != 0)
                    {
                        index = CurrentOrder.Details.Max(i => i.Index) + 1;
                    }
                    formItemEdit.Detail.Index = index;
                    CurrentOrder.AddDetail(formItemEdit.Detail);
                    bdsDetail.ResetBindings(false);
                }
            }
            catch (Exception e2)
            {
                MessageBox.Show(e2.Message);
            }
        }