private void RenderPage() { if (QueryStringContains("id")) { SignalManager sm = new SignalManager(); Signal s = sm.LoadSingnal(int.Parse(GetFromQueryString("id"))); divTitle.InnerHtml = s.Subject; plhDescription.Controls.Add(new LiteralControl(s.Description)); this.Title = String.Format(this.Title, s.Subject, s.Address, s.City); metaOgDescription.Attributes["content"] = s.Excerpt; ogTitle.Attributes["content"] = String.Format(ogTitle.Attributes["content"], s.Subject, s.Address, s.City); if (!s.ShowName) ltAuthor.Text = "Anonimo"; else ltAuthor.Text = s.Name; lblAddress.Text = s.Address; ltTimeFrame.Text = SignalUtils.GetTimeframe(s.CreationDate); CategoryManager cm = new CategoryManager(); ltCategory.Text = cm.Load(s.CategoryID).Name; string markerImage = "MARKERIMAGE_ALERT"; if (s.Status == Signal.SignalStatus.Resolved) markerImage = "MARKERIMAGE_OK"; JsonObject currentMarker = new JsonObject(); currentMarker["id"] = s.SignalID.ToString(); currentMarker["lat"] = s.Latitude;//.ToString(new CultureInfo("en-US")); currentMarker["lng"] = s.Longitude;//.ToString(new CultureInfo("en-US")); currentMarker["zoom"] = s.Zoom;//.ToString(); currentMarker["image"] = new OpenSignals.Framework.Core.Utility.JsUtils.JsConstant(markerImage); currentMarker["zip"] = s.Zip; currentMarker["status"] = s.Status; ClientScript.RegisterClientScriptBlock(this.GetType(), "currentMarker", "currentMarker=" + currentMarker.ToString() + ";", true); if (!s.Attachment.Equals(string.Empty)) { divPhoto.Visible = true; lnkPhoto.HRef = WebUtils.GetImageUrl(UploadPaths.Big, s.Attachment); imgPhoto.ImageUrl = WebUtils.GetImageUrl(UploadPaths.Small, s.Attachment); ogImage.Attributes["content"] = WebUtils.GetImageUrl(UploadPaths.Small, s.Attachment); } switch (s.Status) { case Signal.SignalStatus.ReOpened: divStatusReopened.Visible = true; divStatusReopened.InnerHtml = String.Format(divStatusReopened.InnerHtml, s.ReopenDate.ToShortDateString(), s.ReopenDescription); break; case Signal.SignalStatus.Approved: divStatusNotResolved.Visible = true; break; case Signal.SignalStatus.Resolved: divStatusResolved.Visible = true; divStatusResolved.InnerHtml = String.Format(divStatusResolved.InnerHtml, s.ResolutionDate, s.ResolutionDescription); break; case Signal.SignalStatus.Expired: divStatusExpired.Visible = true; break; } switch (s.CriticalLevel) { case Signal.CriticalLevels.Normal: lblCriticalLevel.Text = "Bassa"; lblCriticalLevel.CssClass = "criticalNormal"; break; case Signal.CriticalLevels.Medium: lblCriticalLevel.Text = "Media"; lblCriticalLevel.CssClass = "criticalMedium"; break; case Signal.CriticalLevels.High: lblCriticalLevel.Text = "Alta"; lblCriticalLevel.CssClass = "criticalHigh"; break; } if (sm.SearchNearZip(s.Zip, s.SignalID).Count == 0) { liMapNearby.Visible = false; mapNearby.Visible = false; } } }
public JsonArray GetSignalsNearby(JsonObject param) { CheckRequest(param["ajaxSessionKey"].ToString()); JsonArray ar = new JsonArray(); SignalManager sm = new SignalManager(); List<Signal> ret = sm.SearchNearZip(param["zip"].ToString(), Convert.ToInt32(param["signalID"])); for (int i = 0; i < ret.Count; i++) { ret[i].Email = string.Empty; JsonObject obj = new JsonObject(); obj["signal"] = ret[i]; obj["description"] = GetSignalDescription(ret[i]); ar.Push(obj); } return ar; }