ShowMap.aspx.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using BizCom;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Web;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using Utils;
  11. using SiteCore;
  12. public partial class bdrr_plug_ShowMap : BasePage
  13. {
  14. protected override void OnPreInit(EventArgs e)
  15. {
  16. //PmTag = "merlist";
  17. }
  18. protected void Page_Load(object sender, EventArgs e)
  19. {
  20. //if(UrlParmsCheck("iid"))
  21. //{
  22. // string mId = GetString("id");
  23. // DataTable dt = SInst.Query("ID=" + mId);
  24. // if (dt == null || dt.Rows.Count < 1) { Response.Write("错误页面!");Response.End(); return; }
  25. // DataRow dr = dt.Rows[0];
  26. // string mName = dr["Name"].ToString();
  27. // lblAddress.Text = dr["Address"].ToString();
  28. // StringBuilder content = new StringBuilder();
  29. // content.AppendFormat("地址:{0}<br/>", dr["Address"]);
  30. // string point = "";
  31. // if (dr["lng"].ToString() == "" || dr["lat"].ToString() == "")
  32. // {
  33. // point = "117.023732|25.081733";
  34. // }
  35. // else
  36. // {
  37. // point = dr["lng"] + "|" + dr["lat"];
  38. // }
  39. // litScript.Text = "<script>var markerArr = [{ title: \"" + mName + "\", content: \"" + content + "\", point: \"" + point + "\", isOpen: 0 }];initMap();</script>";
  40. //}
  41. //else
  42. //{
  43. // litScript.Text = "<script>var markerArr = [{ title: \"名称\", content: \"\", point: \"117.023732|25.081733\", isOpen: 0 }];initMap();</script>";
  44. //}
  45. string lnglat = GetString("lnglat");
  46. if (lnglat == "") lnglat = "117.024001|25.08175";
  47. string ad = GetString("ad");
  48. if (ad == "") ad = "地点";
  49. litScript.Text = "<script>var markerArr = [{ title: \""+ad+"\", content: \"\", point: \""+ lnglat+"\", isOpen: 0 }];initMap();</script>";
  50. }
  51. protected void btnSave_Click(object sender, EventArgs e)
  52. {
  53. if (hLng.Value == "" || hLat.Value == "")
  54. {
  55. ShowMsg("点击地图标记您的位置再保存");
  56. return;
  57. }
  58. string mId = SecurityHelper.UrlDecoding(GetString("iid"));
  59. try
  60. {
  61. //SInst entity = SInst.Get(Convert.ToInt32(mId));
  62. //entity.Lng = hLng.Value;
  63. //entity.Lat = hLat.Value;
  64. //entity.Update();
  65. ShowMsg("提示", "保存成功", "window.location=window.location.href");
  66. }
  67. catch (Exception ex)
  68. {
  69. ShowMsg("保存发生错误了!");
  70. }
  71. }
  72. }