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); }