Tracking Details Button Alternative

@psiebers I did this for 5 forms last month, so it is not hard as I rarely do customizations. This not my code originally, but I have used it since the E9 days and it works for this by using the default browser. I did the Misc Shipment Tracker now to document the steps I followed.

Form Event Wizard - Add EpiviewNotification on the view that has the tracking number.

Add button named btnTrack (make it the same size and location after testing of the original button)

use wizard - Reference Adaptor to add ShipViaAdaptor

script F5 to compile

save

close form - open form to get button available

Event wizard

epiButton - Your button - Click - Add.

paste in the btnTrack_Click routine.

edit data views to the ones added earlier for this form

edit shipvia adaptor to current form name

private static void btnTrack_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		System.Data.DataRow edvShipHeadRow = edvShipHead.CurrentDataRow; 
			if ((edvShipHeadRow != null) && !string.IsNullOrEmpty(edvShipHeadRow["TrackingNumber"].ToString()))
			{
					//MessageBox.Show(edvShipHeadRow["TrackingNumber"].ToString());

		
						var x = new ShipViaAdapter(CustShipForm);
		        oTrans.PushStatusText(string.Format("3 "), false);
		        x.BOConnect();
		        oTrans.PushStatusText(string.Format("4 "), false);
		
		
		        // MessageBox.Show("ShipViaCode " & sh.MiscShipData.Tables("MscShpHd").Rows(0)("ShipViaCode"))
		
		        if (!x.GetByID(edvShipHeadRow["ShipViaCode"].ToString().Trim()))
		        {
		            MessageBox.Show("No ShipVia Record Found!");
		        }
			
		        oTrans.PushStatusText(string.Format("6 "), false);
		        string url = (string)x.ShipViaData.Tables["ShipVia"].Rows[0]["TrackingURL"];
		        oTrans.PushStatusText(string.Format("7 "), false);
						string placeholder = (string)x.ShipViaData.Tables["ShiPVia"].Rows[0]["TrackingNumPlaceHolder"];
						string tracking = (edvShipHeadRow["TrackingNumber"].ToString());
		        url = url.Replace(placeholder, tracking);
		
		//		MessageBox.Show(url);
		
		        oTrans.PushStatusText(string.Format("8 "), false);
		        Process.Start(url);
				
		
		
		        oTrans.PushStatusText(string.Format("9 "), false);
		        x.Dispose();
		        oTrans.PushStatusText(string.Format("10"), false);
		        x = null;
		        oTrans.PushStatusText(string.Format("11"), false);
		       

			}


	}
2 Likes