private void btn_delete_Click(object sender, EventArgs e) { String info = Interaction.InputBox("请输入要删除的订单号", "输入字符串", "", 100, 100); int deleteId = int.Parse(info); Service.RemoveOrder(deleteId); }
private void btnDelete_Click(object sender, EventArgs e) { string type = comboBoxOrder.SelectedItem.ToString(); string index = textBoxOrder.Text; switch (type) { case "订单号": Order order1 = orderService.GetByID(int.Parse(index)); orderService.RemoveOrder(order1); break; case "客户": List <Order> order2 = orderService.GetByCustomer(index); for (int i = 0; i < order2.Count - 1; i++) { orderService.RemoveOrder(order2[i]); } break; case "商家": List <Order> order3 = orderService.GetByMerchant(index); for (int i = 0; i < order3.Count - 1; i++) { orderService.RemoveOrder(order3[i]); } break; case "商品": List <Order> order4 = orderService.GetByGoods(index); for (int i = 0; i < order4.Count - 1; i++) { orderService.RemoveOrder(order4[i]); } break; case "总金额": List <Order> order5 = orderService.GetByPrice(int.Parse(index)); for (int i = 0; i < order5.Count - 1; i++) { orderService.RemoveOrder(order5[i]); } break; } OrderbindingSource.ResetBindings(false); }
private void btnDelete_Click(object sender, EventArgs e) { Order order = orderbindingSource.Current as Order; if (order == null) { MessageBox.Show("请选择一个订单进行删除"); return; } orderService.RemoveOrder(order.OrderId); QueryAll(); }