using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Text; using LocationService.net.mappoint; namespace LocationService { /// /// Summary description for ViewAd. /// public class ViewAd : System.Web.UI.Page { protected System.Web.UI.WebControls.Image Image1; protected System.Web.UI.WebControls.Label textLab; protected System.Web.UI.WebControls.Label dirLab; protected System.Web.UI.WebControls.Label nameLab; private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here int nid = 1; if(Request.QueryString["nid"] != null) nid = Int32.Parse(Request.QueryString["nid"]); LocationServ ls = new LocationServ(); MyAdNotify man = ls.GetAdNotification(nid); nameLab.Text = man.AdName; textLab.Text = man.AdText; MyRouteProxy mRouteP = new MyRouteProxy(); Route r = mRouteP.GetRouteFromLatLong(man.AdLatitude, man.AdLongitude, man.Latitude, man.Longitude); StringBuilder sb = new StringBuilder(); sb.Append("Distance: " + r.Direction.Distance.ToString("##.##") + "
"); sb.Append("Driving Time: " + r.Direction.DrivingTime.ToString("##.##") + "
"); sb.Append("Directions:
"); int iter = 0; foreach(SegmentDirection sd in r.Direction.Directions) { foreach(DirectionPrimitive dp in sd.Direction) { iter++; sb.Append(iter.ToString() + ") " + dp.Instruction + " [" + dp.Distance.ToString("##.##") + "]
"); } } dirLab.Text = sb.ToString(); MyAddress toAdd = new MyAddress(); toAdd.Name = man.AdName; toAdd.LatPoint = man.AdLatitude.ToString(); toAdd.LongPoint = man.AdLongitude.ToString(); MyAddress fromAdd = new MyAddress(); fromAdd.Name = man.SubscriberId; fromAdd.LatPoint = man.Latitude.ToString(); fromAdd.LongPoint = man.Longitude.ToString(); MyRenderProxy mRenderP = new MyRenderProxy(); MapImage mi = mRenderP.GetRouteMap(toAdd, fromAdd, r, 229, 229); Session["myMapImage"] = mi; } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion } }