private void EditOrder() { Order order = orderBindingSource.Current as Order; if (order == null) { MessageBox.Show("请选择一个订单进行修改"); return; } FormEdit form2 = new FormEdit(order, true); if (form2.ShowDialog() == DialogResult.OK) { OrderService.UpdateOrder(form2.CurrentOrder); QueryAll(); } }
private void btnModify_Click(object sender, EventArgs e) { FormEdit form2 = new FormEdit((Order)orderBindingSource.Current); form2.ShowDialog(); Order newOrder = form2.getResult(); if (newOrder != null) { orderService.Delete(((Order)orderBindingSource.Current).Id); orderService.Add(newOrder); orderBindingSource.DataSource = orderService.GetAllOrders(); } // FormEdit form2 = new FormEdit((Order)orderBindingSource.Current); // form2.ShowDialog(); //orderBindingSource.DataSource = orderService.GetAllOrders(); }
private void btnAdd_Click(object sender, EventArgs e) { FormEdit form2 = new FormEdit(new Order()); form2.ShowDialog(); Order newOrder = form2.getResult(); if (newOrder != null) { int flag = orderService.AddOrder(newOrder); if (flag == 0) { MessageBox.Show("您输入的订单号已存在!"); } else { orderBindingSource.DataSource = orderService.QueryAllOrders(); } } }
private void btnModify_Click(object sender, EventArgs e) { FormEdit form2 = new FormEdit((Order)orderBindingSource.Current); form2.ShowDialog(); }