protected void DoCraigslist() { CLPanel.Visible = true; Data dat = new Data(DateTime.Now); ArrayList clEvents = dat.grabEvents(); Label lab; RadRotatorItem item; foreach (string token in clEvents) { lab = new Label(); lab.Text = token; item = new RadRotatorItem(); item.Controls.Add(lab); RadRotator3.Items.Add(item); } }
public void AddItemToRotator2(Container container) { var item = new RadRotatorItem(); item.Controls.Add(container); tilesRotator2.Items.Add(item); }
protected void PostEvents(DataSet ds) { try { HttpCookie cookie = Request.Cookies["BrowserDate"]; if (cookie == null) { cookie = new HttpCookie("BrowserDate"); cookie.Value = DateTime.Now.Date.ToString(); cookie.Expires = DateTime.Now.AddDays(22); Response.Cookies.Add(cookie); } bool fillUserData = false; DateTime isn = DateTime.Now; if (!DateTime.TryParse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"), out isn)) isn = DateTime.Now; DateTime isNow = isn; Data dat = new Data(isn); Rotator1.Items.Clear(); DataView dv = new DataView(ds.Tables[0], "", "", DataViewRowState.CurrentRows); string content = ""; bool isPathAbsolute = false; string imagePath = ""; if (dv.Count > 0) { foreach (DataRowView row in dv) { Telerik.Web.UI.RadRotatorItem item = new Telerik.Web.UI.RadRotatorItem(); Literal lit = new Literal(); if (row["Type"].ToString() == "E") { DataView dsSlider = dat.GetDataDV("SELECT * FROM Event_Slider_Mapping WHERE EventID=" + row["EventID"].ToString()); string imageStr = ""; bool doImage = false; if (dsSlider.Count > 0) { doImage = true; isPathAbsolute = bool.Parse(dsSlider[0]["ImgPathAbsolute"].ToString()); if (isPathAbsolute) { imagePath = dsSlider[0]["PictureName"].ToString(); } else { imagePath = "UserFiles/Events/" + row["EventID"].ToString() + "/Slider/" + dsSlider[0]["PictureName"].ToString(); if (!System.IO.File.Exists(MapPath(".")+imagePath)) { doImage = true; } } } if (doImage) { if (isPathAbsolute) { imagePath = dsSlider[0]["PictureName"].ToString(); } else { imagePath = "UserFiles/Events/" + row["EventID"].ToString() + "/Slider/" + dsSlider[0]["PictureName"].ToString(); } imageStr = "<div align=\"center\" style=\"vertical-align: middle;position: absolute; height: 240px; width: 240px;\"><table width='240px' cellpadding='0' cellspacing='0' height='238px' bgcolor='black'><tr><td valign='center'><a width='240px' href=\"" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EventID"].ToString() + "_Event\"" + "\"><img alt=\"" + dat.MakeNiceName(row["Header"].ToString()).Replace("-", " ") + "\" src=\"" + imagePath + "\" /></a></td></tr></table><div style=\"font-weight: bold;color: white;position: absolute;bottom: 0;width: 240px; height: 50px; z-index: 1000;\"><table cellpadding='0' cellspacing='0' height='50px'><tr><td valign='center'><div align='center'>" + row["Header"].ToString() + "</div></td></tr></table></div>" + "<div style=\"vertical-align: middle;color: white;position: absolute; bottom: 0;width: 240px; " + "background-color: black; opacity: .7; filter: alpha(opacity=70);height: 50px;\"></div>" + "</div>"; lit.Text = imageStr; } else { DataView dvTime = dat.GetDataDV("SELECT * FROM Event_Occurance WHERE EventID=" + row["EventID"].ToString() + " ORDER BY DateTimeStart DESC"); DateTime itEvent = new DateTime(); itEvent = DateTime.Parse(dvTime[0]["DateTimeStart"].ToString()); string timeStr = GetTimeStr(itEvent); lit.Text = "<div class=\"Home42\"><div class=\"Home43\"><div align=\"center\" class=\"FooterBottom\">" + "<h2 class=\"Event\"><a class=\"HomeEventTitle\" href=\"" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EventID"].ToString() + "_Event\">"; string headerStr = row["Header"].ToString(); if (headerStr.Length > 49) { headerStr = headerStr.Substring(0, 46) + "..."; } lit.Text += dat.BreakUpString(headerStr, 20) + "</a></h2></div><div class=\"FooterBottom\">" + imageStr + "<div class=\"Text12 Home44\">"; int contentLimit = 105; if (imageStr == "") contentLimit = 281; content = dat.stripHTML(row["Content"].ToString()); if (content.Length > contentLimit) { content = content.Substring(0, contentLimit) + "..."; } lit.Text += timeStr + "<br/>" + dat.BreakUpString(content.Replace("<br/>", " ").Replace("<br>", " ").Replace("<br />", " ").Replace("<BR>", " ").Replace("<BR />", " ").Replace("<BR/>", " "), 13); lit.Text += "</div><div class=\"ReadMoreHome\"><a class=\"ReadMoreHome\" href=\"" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EventID"].ToString() + "_Event\">Read More</a></div></div></div></div>"; } item.Controls.Add(lit); RadRotator1.Items.Add(item); } else if (row["Type"].ToString() == "T") { DataView dsSlider = dat.GetDataDV("SELECT * FROM Trip_Slider_Mapping WHERE TripID=" + row["EventID"].ToString()); string imageStr = ""; bool isImage = false; if (dsSlider.Count > 0) { isImage = true; if (!System.IO.File.Exists(MapPath(".") + "/Trips/" + row["EventID"].ToString() + "/Slider/" + dsSlider[0]["PictureName"].ToString())) { isImage = false; } } if (isImage) { imageStr = "<div align=\"center\" style=\"vertical-align: middle; width: 240px; height: 240px;\"><table width='240px' cellpadding='0' cellspacing='0' height='238px' bgcolor='black'><tr><td valign='center'><a width='240px' href=\"" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EventID"].ToString() + "_Trip\"" + "\"><img alt=\"" + dat.MakeNiceName(row["Header"].ToString()).Replace("-", " ") + "\" src=\"" + "Trips/" + row["EventID"].ToString() + "/Slider/" + dsSlider[0]["PictureName"].ToString() + "\" /></a></td></tr></table>" + "<div style=\"font-weight: bold;color: white;position: absolute;bottom: 0;width: 240px; height: 50px; z-index: 1000;\"><table cellpadding='0' cellspacing='0' height='50px'><tr><td valign='center'><div align='center'>" + row["Header"].ToString() + "</div></td></tr></table></div>" + "<div style=\"vertical-align: middle;color: white;position: absolute; bottom: 0;width: 240px; " + "background-color: black; opacity: .7; filter: alpha(opacity=70);height: 50px;\"></div>" + "</div>"; lit.Text = imageStr; } else { lit.Text = "<div class=\"Home42\"><div class=\"Home43\"><div align=\"center\" class=\"FooterBottom\">" + "<h2 class=\"Event\"><a class=\"HomeEventTitle\" href=\"" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EventID"].ToString() + "_Trip\">"; string headerStr = row["Header"].ToString(); if (headerStr.Length > 49) { headerStr = headerStr.Substring(0, 46) + "..."; } lit.Text += dat.BreakUpString(headerStr, 20) + "</a></h2></div><div class=\"FooterBottom\">" + imageStr + "<div class=\"Home44\" class=\"Text12\">"; string timeStr = ""; DateTime itEvent = new DateTime(); itEvent = DateTime.Parse(row["StartTime"].ToString()); timeStr = "<span class='HomeTime'>" + GetHourStr(itEvent) + "</span>"; itEvent = DateTime.Parse(row["EndTime"].ToString()); timeStr += "<span class='HomeTime'> to " + GetHourStr(itEvent) + "</span><span class=\"MoreTimes\"> + more times</span>"; int contentLimit = 105; if (imageStr == "") contentLimit = 281; content = dat.stripHTML(row["Content"].ToString()); if (content.Length > contentLimit) { content = content.Substring(0, contentLimit) + "..."; } lit.Text += timeStr + "<br/>" + dat.BreakUpString(content.Replace("<br/>", " ").Replace("<br>", " ").Replace("<br />", " ").Replace("<BR>", " ").Replace("<BR />", " ").Replace("<BR/>", " "), 13); lit.Text += "</div><div class=\"ReadMoreHome\"><a class=\"ReadMoreHome\" href=\"" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EventID"].ToString() + "_Trip\">Read More</a></div></div></div></div>"; } item.Controls.Add(lit); RadRotator2.Items.Add(item); } else { DataView dsSlider = dat.GetDataDV("SELECT * FROM Venue_Slider_Mapping WHERE VenueID=" + row["EventID"].ToString()); string imageStr = ""; bool isImage = false; if (dsSlider.Count > 0) { isImage = true; if (!System.IO.File.Exists(MapPath(".") + "VenueFiles/" + row["EventID"].ToString() + "/Slider/" + dsSlider[0]["PictureName"].ToString())) { isImage = false; } } if (isImage) { imageStr = "<div align=\"center\" style=\"vertical-align: middle; width: 240px; height: 240px;\"><table width='240px' cellpadding='0' cellspacing='0' height='238px' bgcolor='black'><tr><td valign='center'><a width='240px' href=\"" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EventID"].ToString() + "_Venue\"" + "\"><img alt=\"" + dat.MakeNiceName(row["Header"].ToString()).Replace("-", " ") + "\" src=\"" + "VenueFiles/" + row["EventID"].ToString() + "/Slider/" + dsSlider[0]["PictureName"].ToString() + "\" /></a></td></tr></table>"+ "<div style=\"font-weight: bold;color: white;position: absolute;bottom: 0;width: 240px; height: 50px; z-index: 1000;\"><table cellpadding='0' cellspacing='0' height='50px'><tr><td valign='center'><div align='center'>" + row["Header"].ToString() + "</div></td></tr></table></div>" + "<div style=\"vertical-align: middle;color: white;position: absolute; bottom: 0;width: 240px; " + "background-color: black; opacity: .7; filter: alpha(opacity=70);height: 50px;\"></div>" + "</div>"; lit.Text = imageStr; } else { string timeStr = ""; DateTime itEvent = new DateTime(); itEvent = DateTime.Parse(row["StartTime"].ToString()); timeStr = "<span class='HomeTime'>" + GetHourStr(itEvent) + "</span>"; itEvent = DateTime.Parse(row["EndTime"].ToString()); timeStr += "<span class='HomeTime'> to " + GetHourStr(itEvent) + "</span><span class=\"MoreTimes\"> + more times</span>"; lit.Text = "<div class=\"Home42\"><div class=\"Home43\"><div align=\"center\" class=\"FooterBottom\">" + "<h2 class=\"Event\"><a class=\"HomeEventTitle\" href=\"" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EventID"].ToString() + "_Venue\">"; string headerStr = row["Header"].ToString(); if (headerStr.Length > 49) { headerStr = headerStr.Substring(0, 46) + "..."; } lit.Text += dat.BreakUpString(headerStr, 20) + "</a></h2></div><div class=\"FooterBottom\">" + imageStr + "<div class=\"Home44\" class=\"Text12\">"; int contentLimit = 105; if (imageStr == "") contentLimit = 281; content = dat.stripHTML(row["Content"].ToString()); if (content.Length > contentLimit) { content = content.Substring(0, contentLimit) + "..."; } lit.Text += timeStr + "<br/>" + dat.BreakUpString(content.Replace("<br/>", " ").Replace("<br>", " ").Replace("<br />", " ").Replace("<BR>", " ").Replace("<BR />", " ").Replace("<BR/>", " "), 13); lit.Text += "</div><div class=\"ReadMoreHome\"><a class=\"ReadMoreHome\" href=\"" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EventID"].ToString() + "_Venue\">Read More</a></div></div></div></div>"; } item.Controls.Add(lit); Rotator1.Items.Add(item); } } if (RadRotator2.Controls.Count == 0) { Literal lit = new Literal(); lit.Text = "<div class=\"Home42\"><div class=\"Home43\"><div align=\"center\" class=\"FooterBottom\">"; string headerStr = "<div style=\"padding-top: 55px;\">There are currently no adventures "+ "posted in your location. But you can add them! <a class=\"NavyLinkSmall\" "+ "href=\"enter-trip\"><br/>+Add Adventure</a></div>"; lit.Text += dat.BreakUpString(headerStr, 20) + "</div><div class=\"FooterBottom\"><div "+ "class=\"Home44\" class=\"Text12\">"; lit.Text += "</div></div></div></div>"; RadRotatorItem item = new RadRotatorItem(); item.Controls.Add(lit); RadRotator2.Items.Add(item); } if (RadRotator1.Controls.Count == 0) { Literal lit = new Literal(); lit.Text = "<div class=\"Home42\"><div class=\"Home43\"><div align=\"center\" class=\"FooterBottom\">"; string headerStr = "<div style=\"padding-top: 55px;\">There are currently no events " + "posted in your location. But you can add them! <a class=\"NavyLinkSmall\" "+ "href=\"blog-event\"><br/>+Add Event</a></div>"; lit.Text += dat.BreakUpString(headerStr, 20) + "</div><div class=\"FooterBottom\"><div " + "class=\"Home44\" class=\"Text12\">"; lit.Text += "</div></div></div></div>"; RadRotatorItem item = new RadRotatorItem(); item.Controls.Add(lit); RadRotator1.Items.Add(item); } if (Rotator1.Controls.Count == 0) { Literal lit = new Literal(); lit.Text = "<div class=\"Home42\"><div class=\"Home43\"><div align=\"center\" class=\"FooterBottom\">"; string headerStr = "<div style=\"padding-top: 55px;\">There are currently no locales " + "posted in your location. But you can add them! <a class=\"NavyLinkSmall\" "+ "href=\"enter-locale\"><br/>+Add Locale</a></div>"; lit.Text += dat.BreakUpString(headerStr, 20) + "</div><div class=\"FooterBottom\"><div " + "class=\"Home44\" class=\"Text12\">"; lit.Text += "</div></div></div></div>"; RadRotatorItem item = new RadRotatorItem(); item.Controls.Add(lit); Rotator1.Items.Add(item); } //if (ds.Tables[0].Rows.Count < 4) //{ // if (ds.Tables[0].Rows.Count == 1) // { // Literal lit = new Literal(); // lit.Text = "<div class=\"Text12 Home45\">" + // "<div class=\"AdEmptyInner\">There aren't many events posted " + // "in your location for this time frame. Be the first to post an event and have it featured on our home page. " + // "<br/><a class=\"NavyLinkSmall\" href=\"blog-event\"><br/>+Add Event</a><a class=\"NavyLinkSmall\" href=\"enter-locale\"><br/>+Add Locale</a>" + // "<a class=\"NavyLinkSmall\" href=\"enter-trip\"><br/>+Add Adventure</a></div></div>"; // Telerik.Web.UI.RadRotatorItem item = new Telerik.Web.UI.RadRotatorItem(); // item.Controls.Add(lit); // Rotator1.Items.Add(item); // RadRotator1.Items.Add(item); // RadRotator2.Items.Add(item); // lit = new Literal(); // lit.Text = "<div class=\"Text12 Home46\">" + // "</div>"; // item = new Telerik.Web.UI.RadRotatorItem(); // item.Controls.Add(lit); // Rotator1.Items.Add(item); // RadRotator1.Items.Add(item); // RadRotator2.Items.Add(item); // lit = new Literal(); // lit.Text = "<div class=\"Text12 Home47\">" + // "</div>"; // item = new Telerik.Web.UI.RadRotatorItem(); // item.Controls.Add(lit); // Rotator1.Items.Add(item); // RadRotator1.Items.Add(item); // RadRotator2.Items.Add(item); // } // else if (ds.Tables[0].Rows.Count == 2) // { // Literal lit = new Literal(); // lit.Text = "<div class=\"Text12 Home45\">" + // "<div class=\"AdEmptyInner\">There aren't many events posted in your location for this time frame. Be the first to post an event and have " + // "it featured on our home page. " + // "<br/><a class=\"NavyLinkSmall\" href=\"blog-event\"><br/>+Add Event</a>" + // "<a class=\"NavyLinkSmall\" href=\"enter-locale\"><br/>+Add Locale</a>" + // "<a class=\"NavyLinkSmall\" href=\"enter-trip\"><br/>+Add Adventure</a></div></div>"; // Telerik.Web.UI.RadRotatorItem item = new Telerik.Web.UI.RadRotatorItem(); // item.Controls.Add(lit); // Rotator1.Items.Add(item); // RadRotator1.Items.Add(item); // RadRotator2.Items.Add(item); // lit = new Literal(); // lit.Text = "<div class=\"Home47\">" + // "</div>"; // item = new Telerik.Web.UI.RadRotatorItem(); // item.Controls.Add(lit); // Rotator1.Items.Add(item); // RadRotator1.Items.Add(item); // RadRotator2.Items.Add(item); // } // else if (ds.Tables[0].Rows.Count == 3) // { // Literal lit = new Literal(); // lit.Text = "<div class=\"Text12 Home48\">" + // "<div class=\"AdEmptyInner\">There aren't many events posted in your location for this time frame. Be the first to post an event and have it featured on our home page. " + // "<br/><a class=\"NavyLinkSmall\" href=\"blog-event\"><br/>+Add Event</a>" + // "<a class=\"NavyLinkSmall\" href=\"enter-locale\"><br/>+Add Locale</a>" + // "<a class=\"NavyLinkSmall\" href=\"enter-trip\"><br/>+Add Adventure</a></div></div>"; // Telerik.Web.UI.RadRotatorItem item = new Telerik.Web.UI.RadRotatorItem(); // item.Controls.Add(lit); // Rotator1.Items.Add(item); // RadRotator1.Items.Add(item); // RadRotator2.Items.Add(item); // } //} } else { Literal lit = new Literal(); lit.Text = "<div class=\"Text12 Home45\">" + "<div class=\"AdEmptyInner\">There are no posted events in your location for this time frame. Be the first to post an event and have it featured on our home page. " + "<br/><a class=\"NavyLinkSmall\" href=\"blog-event\"><br/>+Add Event</a>" + "<a class=\"NavyLinkSmall\" href=\"enter-locale\"><br/>+Add Locale</a>" + "<a class=\"NavyLinkSmall\" href=\"enter-trip\"><br/>+Add Adventure</a></div></div>"; Telerik.Web.UI.RadRotatorItem item = new Telerik.Web.UI.RadRotatorItem(); item.Controls.Add(lit); Rotator1.Items.Add(item); RadRotator1.Items.Add(item); RadRotator2.Items.Add(item); lit = new Literal(); lit.Text = "<div class=\"Home49\">" + "</div>"; item = new Telerik.Web.UI.RadRotatorItem(); item.Controls.Add(lit); Rotator1.Items.Add(item); RadRotator1.Items.Add(item); RadRotator2.Items.Add(item); lit = new Literal(); lit.Text = "<div class=\"Home49\">" + "</div>"; item = new Telerik.Web.UI.RadRotatorItem(); item.Controls.Add(lit); Rotator1.Items.Add(item); RadRotator1.Items.Add(item); RadRotator2.Items.Add(item); lit = new Literal(); lit.Text = "<div class=\"Home50\">" + "</div>"; item = new Telerik.Web.UI.RadRotatorItem(); item.Controls.Add(lit); Rotator1.Items.Add(item); RadRotator1.Items.Add(item); RadRotator2.Items.Add(item); } } catch (Exception ex) { TimeFrameLabel.Text += ex.ToString(); } }
protected void rotFeatures_DataBound(object sender, RadRotatorEventArgs e) { if (IsConfigured) { string template; int imageWidth = 200; RadRotator rot = sender as RadRotator; RadRotatorItem item = e.Item as RadRotatorItem; FeatureListItemInfo featureListItem = item.DataItem as FeatureListItemInfo; if (featureListItem != null) { PlaceHolder ph = e.Item.FindControl("featurePlaceHolder") as PlaceHolder; template = Template; template = template.Replace("[TITLE]", "<asp:Label ID=\"lblTitle\" runat=\"server\" />"); if (template.IndexOf("[IMAGE") > -1) { if (template.IndexOf("[IMAGE:") > -1) { string width = template.Substring(template.IndexOf("[IMAGE:") + 7); width = width.Substring(0, width.IndexOf("]")); if (Int32.TryParse(width, out imageWidth) == false) { imageWidth = 200; } template = template.Replace("[IMAGE:" + width + "]", "<asp:PlaceHolder ID=\"phimgFeature\" runat=\"server\" />"); } else { template = template.Replace("[IMAGE]", "<asp:PlaceHolder ID=\"phimgFeature\" runat=\"server\" />"); } } Control ctrl = ParseControl(template); Label lblTitle = FindControlRecursive(ctrl, "lblTitle") as Label; if (lblTitle != null) { lblTitle.Text = featureListItem.FeatureListItem; } PlaceHolder phimgFeature = FindControlRecursive(ctrl, "phimgFeature") as PlaceHolder; if (phimgFeature != null && featureListItem.Image != null) { string fileName = PortalSettings.HomeDirectoryMapPath.Replace(HttpContext.Current.Request.PhysicalApplicationPath, "") + featureListItem.Image.Replace('/', '\\'); GeneratedImage imgFeature = new GeneratedImage(); imgFeature.ImageHandlerUrl = "~/BBImageHandler.ashx"; if (imageWidth > 0) { imgFeature.Parameters.Add(new ImageParameter() { Name = "Width", Value = imageWidth.ToString() }); } imgFeature.Parameters.Add(new ImageParameter() { Name = "File", Value = fileName }); // TODO: Watermark //if (false) //{ // imgProduct.Parameters.Add(new ImageParameter() { Name = "WatermarkText", Value = Localization.GetString("Sold.Text", this.LocalResourceFile) }); // imgProduct.Parameters.Add(new ImageParameter() { Name = "WatermarkFontFamily", Value = "Verdana" }); // imgProduct.Parameters.Add(new ImageParameter() { Name = "WatermarkFontColor", Value = "Red" }); // imgProduct.Parameters.Add(new ImageParameter() { Name = "WatermarkFontSize", Value = "20" }); //} phimgFeature.Controls.Add(imgFeature); } ph.Controls.Add(ctrl); } } else { rotFeatures.Visible = false; } }