private void btnNav_Click(object sender, EventArgs e) { if (cbRoute.SelectedIndex == -1) { MessageBox.Show("Select Route"); return; } var manager = new TripManager(); var tripUnit = new TripUnit(); tripUnit.TripId = lblTripNo.Text; tripUnit.ExpectedStart = lblTripStart.Text; tripUnit.ExpectedEnd = lblTripEnd.Text; tripUnit.Incharge = lblIncharge.Text; tripUnit.VehicleId = lblVehicle.Text; tripUnit.RouteId = cbRoute.SelectedValue.ToString(); tripUnit.ActualStart = ""; tripUnit.ActualEnd = ""; tripUnit.Cost = ""; tripUnit.LastUpdated = DateTime.Now.Date.ToShortDateString(); manager.InsertTrip(tripUnit); manager.WMSHeaderInsert(lblTripNo.Text, lblIncharge.Text); foreach (DataGridViewRow row in grdOrders.Rows) { var tripOrderUnit = new TripOrderUnit(); tripOrderUnit.DropSequence = row.Cells["colDropSequence"].Value.ToString(); tripOrderUnit.TripId = lblTripNo.Text; tripOrderUnit.OrderId = row.Cells["colShipId"].Value.ToString(); tripOrderUnit.Reference = row.Cells["colRefDoc"].Value.ToString(); tripOrderUnit.ReferenceDate = row.Cells["colRefDocDate"].Value.ToString(); tripOrderUnit.ClientId = row.Cells["colClient"].Value.ToString(); tripOrderUnit.CustomerId = row.Cells["colCustId"].Value.ToString(); tripOrderUnit.OrderManagementSystem = row.Cells["colClient"].Value.ToString(); tripOrderUnit.DocumentValue = row.Cells["colDocValue"].Value.ToString(); tripOrderUnit.CustomerDeliveryAddress = ""; tripOrderUnit.Remarks = ""; tripOrderUnit.Status = "FOR RECEIVING"; manager.InsertTripOrder(tripOrderUnit); manager.UpdateOutgoingShipmentRequest("out_shipment_id", tripOrderUnit.OrderId); manager.WMSDetailsInsert(tripOrderUnit.TripId, tripOrderUnit.OrderId, tripOrderUnit.DropSequence, lblTripStart.Text); } manager.RunScript(); MessageBox.Show("SAVED"); DialogResult = DialogResult.OK; }