示例#1
0
 private void Delete_Click(object sender, EventArgs e)
 {
     if (inquiryState == false)                            //非查询模式
     {
         warning.Text = $"   ";
         if (OrderDataSource.Current != null)
         {
             Order currentOrder = OrderDataSource.Current as Order;
             OrderService.deleteOrder(orderList, currentOrder.OrderNo);
             this.OrderDataSource.ResetBindings(false);
             this.ItemDataSource.ResetBindings(false);
             if (orderList.Count == 0)             //如果此时orderGrid为空,则itemGrid显示为空
             {
                 ItemDataSource.DataSource = null;
             }
         }
         else
         {
             warning.Text = $"未选中订单。";
         }
     }
     else                                                    //查询模式
     {
         warning.Text = $"   ";
         if (OrderDataSource.Current != null)
         {
             Order currentOrder = OrderDataSource.Current as Order;
             OrderService.deleteOrder(orderList, currentOrder.OrderNo);        //修改orderList
             dataGridView1.Rows.Remove(dataGridView1.CurrentRow);              //修改当前inquiryList
             if (OrderDataSource.Current == null)
             {
                 ItemDataSource.DataSource = null;
             }
             this.ItemDataSource.ResetBindings(false);
         }
         else
         {
             warning.Text = $"未选中订单。";
         }
     }
 }