Пример #1
0
 private void orderQueryButton_Click(object sender, EventArgs e)
 {
     if (inputOrderIdTextBox.Text != "")
     {
         orderId             = Convert.ToInt32(this.inputOrderIdTextBox.Text);
         orderIdTextBox.Text = orderId.ToString();
         if (customer != null)
         {
             if (SqlManage.orderQuery(orderId).CustomerId == customer.CustomerId)
             {
                 customerIdTextBox.Text    = SqlManage.orderQuery(orderId).CustomerId.ToString();
                 customerNameTextBox.Text  = SqlManage.customerQuery(Convert.ToInt32(SqlManage.orderQuery(orderId).CustomerId)).Name;
                 myDataGridView.DataSource = SqlManage.detailQuery(orderId).Tables[0];
             }
             else
             {
                 MessageBox.Show("该用户没有此订单!");
             }
         }
         else
         {
             customerIdTextBox.Text    = SqlManage.orderQuery(orderId).CustomerId.ToString();
             customerNameTextBox.Text  = SqlManage.customerQuery(Convert.ToInt32(SqlManage.orderQuery(orderId).CustomerId)).Name;
             myDataGridView.DataSource = SqlManage.detailQuery(orderId).Tables[0];
         }
     }
     else
     {
         MessageBox.Show("订单号不能为空!");
     }
 }
Пример #2
0
 private void OrderQueryForm_Load(object sender, EventArgs e)
 {
     if (customer != null)
     {
         orderIdTextBox.Text       = orderId.ToString();
         customerIdTextBox.Text    = SqlManage.orderQuery(orderId).CustomerId.ToString();
         customerNameTextBox.Text  = SqlManage.customerQuery(Convert.ToInt32(SqlManage.orderQuery(orderId).CustomerId)).Name;
         myDataGridView.DataSource = SqlManage.detailQuery(orderId).Tables[0];
     }
     else
     {
         dealButton.Hide();
     }
 }