protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { ((HtmlAnchor)e.Item.FindControl("title")).InnerText = ((Signal)e.Item.DataItem).Subject; ((HtmlAnchor)e.Item.FindControl("title")).HRef = "/" + ((Signal)e.Item.DataItem).City + "/" + ((Signal)e.Item.DataItem).SignalID + "/segnalazione.aspx"; if (((Signal)e.Item.DataItem).Status == 1) ((Image)e.Item.FindControl("status")).ImageUrl = "/images/alert.png"; else ((Image)e.Item.FindControl("status")).ImageUrl = "/images/check.png"; ((Label)e.Item.FindControl("timeframe")).Text = SignalUtils.GetTimeframe(((Signal)e.Item.DataItem).CreationDate); CategoryManager cm = new CategoryManager(); ((Label)e.Item.FindControl("category")).Text = cm.Load(((Signal)e.Item.DataItem).CategoryID).Name; } }
private void RenderPage() { if (QueryStringContains("id")) { SignalManager sm = new SignalManager(); Signal s = sm.LoadSingnal(int.Parse(GetFromQueryString("id"))); divTitle.InnerHtml = s.Subject; divDescription.InnerHtml = s.Description; 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 func = JsUtils.CreateJsFunction("setMarker", false, "signalMarker" + GetFromQueryString("id"), new JsUtils.JsFunction("new google.maps.LatLng(" + s.Latitude.ToString(new CultureInfo("en-US")) + "," + s.Longitude.ToString(new CultureInfo("en-US")) + ")"), false, "map_canvas", true, true) + "getMap('map_canvas').obj.setZoom(" + s.Zoom.ToString() + ");"; RegisterDocumentReadyFunction("setmarker", func); nearby.Attributes.Add("zip", s.Zip); if (!s.Attachment.Equals(string.Empty)) { divPhoto.Visible = true; imgPhoto.ImageUrl = Path.Combine(ConfigurationManager.AppSettings["UploadPath"], s.Attachment); } ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "currentSignalID", "currentSignalID=" + GetFromQueryString("id"), true); } }
private string GetSignalDescription(Signal s) { CategoryManager cm = new CategoryManager(); string categoryName = cm.Load(s.CategoryID).Name; StringBuilder sb = new StringBuilder(); sb.Append(s.Subject); sb.Append("<br/>"); sb.Append("<br/>"); sb.Append("Inviato "); sb.Append(SignalUtils.GetTimeframe(s.CreationDate)); sb.Append(" "); sb.Append("nella categoria '"); sb.Append(categoryName); sb.Append("'"); sb.Append(" - "); sb.Append(s.Address); return sb.ToString(); }