Exemplo n.º 1
0
        //添加订单
        private void addBtn_Click(object sender, EventArgs e)
        {
            InfoLbl.Text = "";
            AddInfo addInfo = new AddInfo();

            addInfo.ShowDialog();
            if (!string.IsNullOrEmpty(addInfo.NewOrder.ClientName))
            {
                service.AddOrder(addInfo.NewOrder);
                orderlistBindingSource.ResetBindings(false);
            }
            else
            {
                InfoLbl.Text = "添加失败";
                return;
            }
        }
Exemplo n.º 2
0
        //添加订单
        private void addBtn_Click(object sender, EventArgs e)
        {
            InfoLbl.Text = "";
            AddInfo addInfo = new AddInfo();

            addInfo.ShowDialog();
            if (!string.IsNullOrEmpty(addInfo.NewOrder.ClientName))
            {
                service.AddOrder(addInfo.NewOrder);
                using (var context = new OrderContext())
                {
                    context.Orders.Load();
                    context.OrderItems.Load();
                    orderlistBindingSource.DataSource = context.Orders.Local.ToBindingList();
                    itemListBindingSource.DataSource  = context.OrderItems.Local.ToBindingList();
                }
            }
            else
            {
                InfoLbl.Text = "添加失败";
                return;
            }
        }