private void CompleteOrderButton_Click(object sender, EventArgs e) { var SelectedRow = dataGridView1.CurrentRow; if (SelectedRow == null) { MessageBox.Show("No data selected"); return; } var joinedOrderId = SelectedRow.Cells["Order_Id"].Value.ToString(); CompleteOrderDetails completeOrder = new CompleteOrderDetails(joinedOrderId); completeOrder.Show(); }
private void OrderDetailButton_Click(object sender, EventArgs e) { string joinedOrderId = OrderIdField.Text; List <string> orderIds; int stationOrderId; int orderId; try { orderIds = StationIdHelper.SeperateStationId(joinedOrderId); stationOrderId = int.Parse(orderIds[0]); orderId = int.Parse(orderIds[1]); } catch { MessageBox.Show("Order id is not in correct format"); return; } var orderCount = db.Orders.Where(aa => aa.OrderId == orderId && aa.StationOrderId == stationOrderId).Count(); Order order; if (orderCount > 0) { order = db.Orders.Where(aa => aa.OrderId == orderId && aa.StationOrderId == stationOrderId).FirstOrDefault(); } if (orderCount == 0) { MessageBox.Show("No such order found"); return; } CompleteOrderDetails orderDetail = new CompleteOrderDetails(joinedOrderId); orderDetail.Show(); }