private void textBox5_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { try { if (textBox5.Text != "") { Data.OrderID = textBox5.Text.Trim(); ordersAll orders = new ordersAll(); orders.MdiParent = main.ActiveForm; orders.Show(); orders.ordersSearchId(Data.OrderID); } else { MessageBox.Show("You need to enter Order's Id"); return; } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void button3_Click(object sender, EventArgs e) { if (textBox5.Text != "") { Data.OrderID = textBox5.Text.Trim(); ordersAll orders = new ordersAll(); orders.MdiParent = main.ActiveForm; orders.Show(); orders.ordersSearchId(Data.OrderID); } else if (comboBox1.Text != "") { switch (comboBox1.Text) { case "in progress": { Data.OrderStatus = comboBox1.Text; break; } case "completed": { Data.OrderStatus = comboBox1.Text; break; } case "cancelled": { Data.OrderStatus = comboBox1.Text; break; } default: { Data.OrderStatus = ""; break; } } ordersAll orders = new ordersAll(); orders.MdiParent = main.ActiveForm; orders.Show(); orders.ordersSearchStatus(Data.OrderStatus); } else { MessageBox.Show("You need to enter Order's Id or choose Order's Status"); return; } }