Ejemplo n.º 1
0
 private void Modify_Click(object sender, EventArgs e)
 {
     if (inquiryState == false)                                         //非查询模式
     {
         warning.Text = $"   ";
         Order newOrder = new Order();
         if (OrderDataSource.Current != null)
         {
             Order       currentOrder = OrderDataSource.Current as Order;
             modifyForm1 form2        = new modifyForm1(currentOrder);
             form2.ShowDialog();
             if (form2.isSuccess == true)
             {
                 string no = currentOrder.OrderNo;
                 currentOrder = form2.order;
                 OrderService.modifyOrder(orderList, no, currentOrder);                                 //orderService表格修改
             }
             this.OrderDataSource.ResetBindings(false);
         }
         else
         {
             warning.Text = $"未选中订单。";
         }
     }
     else
     {
         string textbox = inquiryBox.Text;
         warning.Text = $"   ";
         Order newOrder = new Order();
         if (OrderDataSource.Current != null)
         {
             Order       currentOrder = OrderDataSource.Current as Order;
             modifyForm1 form2        = new modifyForm1(currentOrder);
             form2.ShowDialog();
             if (form2.isSuccess == true)
             {
                 string no = currentOrder.OrderNo;
                 currentOrder = form2.order;
                 OrderService.modifyOrder(orderList, no, currentOrder);                //修改orderList
                 inquiryResultList[dataGridView1.CurrentCell.RowIndex] = currentOrder; //同时修改当前inquiryList
             }
             this.OrderDataSource.ResetBindings(false);
         }
         else
         {
             warning.Text = $"未选中订单。";
         }
     }
 }