protected void fillEvent(string ID, bool isedit) { try { HttpCookie cookie = Request.Cookies["BrowserDate"]; 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); DataView dvEvent = dat.GetDataDV("SELECT * FROM Trips T WHERE T.ID=" + ID); EventNameTextBox.Text = dvEvent[0]["Header"].ToString(); HowDressTextBox.Text = dvEvent[0]["HowDress"].ToString(); WhatObtainTextBox.Text = dvEvent[0]["WhatObtain"].ToString(); if (isedit) { nameLabel.Text = "<h1>You are submitting changes for Adventure: " + dvEvent[0]["Header"].ToString() + "</h1>"; } Session["EffectiveUserName"] = dvEvent[0]["UserName"].ToString(); DataView dvDirections = dat.GetDataDV("SELECT * FROM TripDirections WHERE TripID=" + ID); ListItem item; string walking = ""; foreach (DataRowView row in dvDirections) { walking = "1"; if (row["Walking"].ToString() == "False") walking = "0"; item = new ListItem("Destination " + (DirectionsListBox.Items.Count + 1).ToString(), row["Country"].ToString() + ";" + row["State"].ToString() + ";" + row["City"].ToString() + ";" + row["Zip"].ToString() + ";" + walking + ";" + row["Directions"].ToString() + "-" + row["Address"].ToString()); DirectionsListBox.Items.Add(item); } dvDirections = dat.GetDataDV("SELECT * FROM TripMonths WHERE TripID=" + ID); foreach (DataRowView row in dvDirections) { item = new ListItem(dat.GetMonth(row["MonthStart"].ToString()) + ", " + row["DayStart"].ToString() + " - " + dat.GetMonth(row["MonthEnd"].ToString()) + "," + row["DayEnd"].ToString(), row["MonthStart"].ToString() + ", " + row["DayStart"].ToString() + " - " + row["MonthEnd"].ToString() + "," + row["DayEnd"].ToString()); MonthsListBox.Items.Add(item); } dvDirections = dat.GetDataDV("SELECT * FROM TripDays WHERE TripID=" + ID); string days = ""; foreach (DataRowView row in dvDirections) { item = new ListItem(dat.GetHours(row["Days"].ToString()).Replace("<br/>", "") + " - " + row["StartTime"].ToString() + " - " + row["EndTime"].ToString(), row["Days"].ToString() + " - " + row["StartTime"].ToString() + " - " + row["EndTime"].ToString()); TimeListBox.Items.Add(item); } dvDirections = dat.GetDataDV("SELECT * FROM Trips_WhatToBring WHERE TripID=" + ID); foreach (DataRowView row in dvDirections) { item = new ListItem((BringListBox.Items.Count + 1).ToString() + ". " + row["WhatToBring"].ToString(), row["WhatToBring"].ToString()); BringListBox.Items.Add(item); } foreach (ListItem itemz in MeansCheckList.Items) { if (dvEvent[0]["Means"].ToString().Contains(itemz.Value)) itemz.Selected = true; } char[] delimer = { '-' }; char[] delmer = { ':' }; string[] toksTimes = dvEvent[0]["Duration"].ToString().Split(delimer); string[] toksMin = toksTimes[0].Split(delmer); string[] toksMax = toksTimes[1].Split(delmer); MinHoursTextBox.Text = toksMin[0]; MinMinsTextBox.Text = toksMin[1]; MaxHoursTextBox.Text = toksMax[0]; MaxMinsTextBox.Text = toksMax[1]; if (dvEvent[0]["MinPrice"] != null) { if (dvEvent[0]["MinPrice"].ToString() != "") { MinTextBox.Text = dvEvent[0]["MinPrice"].ToString(); } } if (dvEvent[0]["MaxPrice"] != null) { if (dvEvent[0]["MaxPrice"].ToString() != "") { MaxTextBox.Text = dvEvent[0]["MaxPrice"].ToString(); } } bool isEdit = false; DateTime startDate; DateTime endDate; if (Request.QueryString["edit"] != null) isEdit = bool.Parse(Request.QueryString["edit"].ToString()); DescriptionTextBox.Content = dvEvent[0]["Content"].ToString(); ShortDescriptionTextBox.Text = dvEvent[0]["ShortDescription"].ToString(); string mediaCategory = dvEvent[0]["mediaCategory"].ToString(); string youtube = dvEvent[0]["YouTubeVideo"].ToString(); switch (mediaCategory) { case "1": MainAttractionCheck.Checked = true; MainAttractionPanel.Enabled = true; MainAttractionPanel.Visible = true; char[] delim4 = { ';' }; char[] delim = { '\\' }; string[] youtokens = youtube.Split(delim4); if (youtokens.Length > 0) { UploadedVideosAndPics.Visible = true; for (int i = 0; i < youtokens.Length; i++) { if (youtokens[i].Trim() != "") { ListItem newListItem = new ListItem("You Tube ID: " + youtokens[i], youtokens[i]); PictureCheckList.Items.Add(newListItem); } } } string[] fileArray = System.IO.Directory.GetFiles(MapPath(".") + "\\Trips\\" + ID + "\\Slider\\"); if (fileArray.Length > 0) PictureNixItButton.Visible = true; if (fileArray.Length > 0) { UploadedVideosAndPics.Visible = true; for (int i = 0; i < fileArray.Length; i++) { if (i == 0) UploadedVideosAndPics.Visible = true; string[] fileTokens = fileArray[i].Split(delim); string nameFile = fileTokens[fileTokens.Length - 1]; DataView dvE = dat.GetDataDV("SELECT * FROM Trip_Slider_Mapping WHERE PictureName='" + nameFile + "' AND TripID=" + ID); if (dvE.Count != 0) { ListItem newListItem = new ListItem(dvE[0]["RealPictureName"].ToString(), nameFile); PictureCheckList.Items.Add(newListItem); } } } break; default: break; } //FeatureDatesListBox.Items.Clear(); //if (bool.Parse(dvEvent[0]["Featured"].ToString())) //{ // char[] delim = { ';' }; // string[] tokens = dvEvent[0]["DaysFeatured"].ToString().Split(delim, StringSplitOptions.RemoveEmptyEntries); // foreach (string token in tokens) // { // item = new ListItem(token); // item.Attributes.Add("class", "DisabledListItem"); // item.Value = "Disabled"; // FeatureDatesListBox.Items.Add(item); // } //} //if (Request.QueryString["Feature"] != null) //{ // if (bool.Parse(Request.QueryString["Feature"])) // { // ChangeSelectedTab(0, 1); // ChangeSelectedTab(1, 2); // ChangeSelectedTab(2, 3); // ChangeSelectedTab(3, 4); // FeaturePanel.Visible = true; // FindPrice(); // } //} SetCategories(); Session["EventCategoriesSet"] = null; } catch (Exception ex) { MessagePanel.Visible = true; YourMessagesLabel.Text = ex.ToString(); } }
protected void AddTime(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["BrowserDate"]; 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); if (StartTimePicker.SelectedDate != null && EndTimePicker.SelectedDate != null) { //if (StartTimePicker.SelectedDate.Value < EndTimePicker.SelectedDate.Value) //{ if (DaysOfWeekListBox.SelectedItem != null) { string days = ""; foreach (ListItem it in DaysOfWeekListBox.Items) { if (it.Selected) days += it.Value + ";"; } ListItem item = new ListItem(dat.GetHours(days).Replace("<br/>", "") + " - " + StartTimePicker.SelectedDate.Value.ToShortTimeString() + " - " + EndTimePicker.SelectedDate.Value.ToShortTimeString(), days + " - " + StartTimePicker.SelectedDate.Value.ToShortTimeString() + " - " + EndTimePicker.SelectedDate.Value.ToShortTimeString()); if (!TimeListBox.Items.Contains(item)) TimeListBox.Items.Add(item); } else { TimeErrorLabel.Text = "Please select all days of the week this time corresponds to."; } //} //else //{ // TimeErrorLabel.Text = "Start time must be less than the end time."; //} } else { TimeErrorLabel.Text = "Please enter both the start time and the end time."; } }
protected void DoHours(bool isEvent) { HttpCookie cookie = Request.Cookies["BrowserDate"]; if (cookie == null) { cookie = new HttpCookie("BrowserDate"); cookie.Value = DateTime.Now.ToString(); cookie.Expires = DateTime.Now.AddDays(22); Response.Cookies.Add(cookie); } Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); DataView dv; if (isEvent) { dv = dat.GetDataDV("SELECT * FROM VenueEvents WHERE VenueID=" + Request.QueryString["ID"]); } else { dv = dat.GetDataDV("SELECT * FROM VenueHours WHERE VenueID=" + Request.QueryString["ID"]); HoursLabel.Text = "<h2>Hours</h2>"; } char[] delim = { ';' }; string[] tokens; int firstToken = 0; int secondToken = 0; int tokenCount = 0; string hoursText = ""; string hoursTexts = ""; bool isDash = false; bool allow = false; if (dv.Count > 0) { foreach (DataRowView row in dv) { if (isEvent) { HoursLabel.Text += "<h2>" + row["EventName"].ToString() + "</h2>"; } string starTime = TimeSpan.Parse(row["HourStart"].ToString()).Hours + ":" + TimeSpan.Parse(row["HourStart"].ToString()).Minutes.ToString(); if (starTime.Substring(starTime.Length - 2, 2) == ":0") starTime = starTime.Replace(":0", ":00"); string endTime = TimeSpan.Parse(row["HourEnd"].ToString()).Hours + ":" + TimeSpan.Parse(row["HourEnd"].ToString()).Minutes.ToString(); if (endTime.Substring(endTime.Length - 2, 2) == ":0") endTime = endTime.Replace(":0", ":00"); string ab = dat.GetHours(row["Days"].ToString()); if (isEvent) { HoursLabel.Text += ab.Substring(5, ab.Length - 5) + starTime + " - " + endTime; } else { HoursLabel.Text += "<h2>" + ab.Substring(5, ab.Length - 5).Replace("<br/>", "</h2>") + starTime + " - " + endTime; } } } }
protected void AddEvent(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["BrowserDate"]; if (cookie == null) { cookie = new HttpCookie("BrowserDate"); cookie.Value = DateTime.Now.ToString(); cookie.Expires = DateTime.Now.AddDays(22); Response.Cookies.Add(cookie); } Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); string days = ""; bool gotSelected = false; foreach (ListItem item2 in RegularDaysListBox.Items) { if (item2.Selected) { gotSelected = true; days += item2.Value + ";"; } } RegularEventNameTextBox.Text = dat.stripHTML(RegularEventNameTextBox.Text.Trim()); if (gotSelected && RadTimePicker1.SelectedDate != null && RadTimePicker2.SelectedDate != null) { //if (RadTimePicker1.SelectedDate.Value < RadTimePicker2.SelectedDate.Value) //{ string starTime = RadTimePicker1.SelectedDate.Value.TimeOfDay.Hours + ":" + RadTimePicker1.SelectedDate.Value.TimeOfDay.Minutes.ToString(); if (starTime.Substring(starTime.Length - 2, 2) == ":0") starTime = starTime.Replace(":0", ":00"); string endTime = RadTimePicker2.SelectedDate.Value.TimeOfDay.Hours + ":" + RadTimePicker2.SelectedDate.Value.TimeOfDay.Minutes.ToString(); if (endTime.Substring(endTime.Length - 2, 2) == ":0") endTime = endTime.Replace(":0", ":00"); ListItem item = new ListItem(RegularEventNameTextBox.Text + " -- " + dat.GetHours(days).Replace("<br/>", "") + " -- " + starTime + " -- " + endTime, RegularEventNameTextBox.Text + "---" + days + "---" + starTime + "---" + endTime); if (!RegularEventsListbox.Items.Contains(item)) RegularEventsListbox.Items.Add(item); //} //else //{ // EventsErrorLabel.Text = "The start time must be less than the end time."; //} } else { EventsErrorLabel.Text = "Make sure you have chosen days, start time and end time."; } }
protected void FillHoursAndEvents(string ID) { HttpCookie cookie = Request.Cookies["BrowserDate"]; Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); DataView dvHours = dat.GetDataDV("SELECT * FROM VenueHours WHERE VenueID=" + ID); ListItem item; foreach (DataRowView row in dvHours) { item = new ListItem(dat.GetHours(row["Days"].ToString()).Replace("<br/>", "") + " -- " + row["HourStart"].ToString() + " -- " + row["HourEnd"].ToString(), row["Days"].ToString() + "---" + row["HourStart"].ToString() + "---" + row["HourEnd"].ToString()); HoursListBox.Items.Add(item); } DataView dvEvents = dat.GetDataDV("SELECT * FROM VenueEvents WHERE VenueID=" + ID); foreach (DataRowView row in dvEvents) { item = new ListItem(row["EventName"].ToString() + " -- " + dat.GetHours(row["Days"].ToString()).Replace("<br/>", "") + " -- " + row["HourStart"].ToString() + " -- " + row["HourEnd"].ToString(), row["EventName"].ToString() + "---" + row["Days"].ToString() + "---" + row["HourStart"].ToString() + "---" + row["HourEnd"].ToString()); RegularEventsListbox.Items.Add(item); } }
protected void Page_Load(object sender, EventArgs e) { string eventID = Request.QueryString["ID"].ToString(); HttpCookie cookie = Request.Cookies["BrowserDate"]; if (cookie == null) { cookie = new HttpCookie("BrowserDate"); cookie.Value = DateTime.Now.ToString(); cookie.Expires = DateTime.Now.AddDays(22); Response.Cookies.Add(cookie); } Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); try { Session["RedirectTo"] = Request.Url.AbsoluteUri; bool fillUserData = false; try { if (Session["User"] != null) { LoggedInPanel.Visible = true; LoggedOutPanel.Visible = false; fillUserData = true; } else { LoggedOutPanel.Visible = true; LoggedInPanel.Visible = false; } GetOtherEvents(); } catch (Exception ex) { ErrorLabel.Text = ex.ToString(); } if (Request.QueryString["ID"] == null) Response.Redirect("~/home"); string ID = eventID; Session["TripID"] = ID; DataView dv = dat.GetDataDV("SELECT * FROM Trips WHERE ID=" + ID); Session["FlagID"] = ID; Session["FlagType"] = "T"; #region SEO //Create keyword and description meta tags and title topTopLiteral.Text = "<a class=\"NavyLink12UD\" href=\"#" + dat.MakeNiceNameFull(dv[0]["Header"].ToString()) + "\">" + dat.MakeNiceNameFull(dv[0]["Header"].ToString()).Replace("-", " ") + " From The Top</a>"; HtmlMeta hm = new HtmlMeta(); HtmlMeta kw = new HtmlMeta(); HtmlMeta lg = new HtmlMeta(); HtmlLink cn = new HtmlLink(); HtmlHead head = (HtmlHead)Page.Header; cn.Attributes.Add("rel", "canonical"); cn.Href = "http://" + Request.Url.Authority + "/" + dat.MakeNiceName(dv[0]["Header"].ToString()) + "_" + eventID + "_Trip"; head.Controls.AddAt(0, cn); kw.Name = "keywords"; hm.Name = "Description"; lg.Name = "language"; lg.Content = "English"; head.Controls.AddAt(0, lg); char[] delimeter = { ' ' }; string[] keywords = dat.MakeNiceNameFull(dv[0]["Header"].ToString()).Replace("-", " ").Split(delimeter, StringSplitOptions.RemoveEmptyEntries); int count2 = 0; foreach (string token in keywords) { if (count2 < 16) { if (kw.Content != "") kw.Content += " "; kw.Content += token; count2++; } } head.Controls.AddAt(0, kw); hm.Content = dat.MakeNiceNameFull(dat.stripHTML(dv[0]["Content"].ToString()).Replace(" ", " ").Replace(" ", " ")).Replace("-", " "); if (hm.Content.Length > 200) hm.Content = hm.Content.Substring(0, 197) + "..."; head.Controls.AddAt(0, hm); this.Title = kw.Content; HtmlLink lk = new HtmlLink(); lk.Href = "http://" + Request.Url.Authority + "/" + dat.MakeNiceName(dat.BreakUpString(dv[0]["Header"].ToString(), 14)) + "_" + ID.ToString() + "_Trip"; lk.Attributes.Add("rel", "bookmark"); head.Controls.AddAt(0, lk); #endregion fbLiteral.Text = "<fb:like href=\"" + Request.Url.AbsoluteUri + "\" send=\"true\" layout=\"button_count\" width=\"100\" show_faces=\"true\" font=\"\"></fb:like>"; Literal lit = new Literal(); lit.Text = "<script src=\"http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAjjoxQtYNtdn3Tc17U5-jbBR2Kk_H7gXZZZniNQ8L14X1BLzkNhQjgZq1k-Pxm8FxVhUy3rfc6L9O4g\" type=\"text/javascript\"></script>"; head.Controls.Add(lit); if (bool.Parse(dv[0]["Live"].ToString())) { if (Session["User"] != null) { if (dv[0]["UserName"].ToString() == Session["UserName"].ToString()) EditLink.Visible = true; else EditLink.Visible = false; } else { EditLink.Visible = false; } ASP.controls_contactad_ascx contact = new ASP.controls_contactad_ascx(); contact.THE_TEXT = "Contact Adventure Poster"; contact.RE_LABEL = "Re: " + dat.BreakUpString(dv[0]["Header"].ToString(), 14); contact.TYPE = "ConnectTrip"; contact.ID = int.Parse(eventID); ContactPanel.Controls.Add(contact); PricePanel.Visible = false; if (dv[0]["MaxPrice"] != null) { if (dv[0]["MaxPrice"].ToString() != "") { MinPrice.Text = dv[0]["MinPrice"].ToString().Replace(".00", ""); MaxPrice.Text = dv[0]["MaxPrice"].ToString().Replace(".00", ""); PricePanel.Visible = true; } } DurationLabel.Text = "<b>Duration:</b> " + dat.GetDuration(dv[0]["Duration"].ToString()); char[] del = { ';' }; DataView daysToGo = dat.GetDataDV("SELECT * FROM TripDays WHERE TripID=" + eventID); foreach (DataRowView row in daysToGo) { DaysLabel.Text += dat.GetHours(row["Days"].ToString()) + " " + row["StartTime"].ToString() + " - " + row["EndTime"].ToString() + "<br/>"; } DataView monthsToGo = dat.GetDataDV("SELECT * FROM TripMonths WHERE TripID=" + eventID); foreach (DataRowView row in monthsToGo) { MonthsLabel.Text += dat.GetMonths(row["MonthStart"].ToString()) + ", " + row["DayStart"].ToString() + " - " + dat.GetMonths(row["MonthEnd"].ToString()) + ", " + row["DayEnd"].ToString() + "<br/>"; } ObtainLabel.Text = dv[0]["WhatObtain"].ToString(); DressLabel.Text = dv[0]["HowDress"].ToString(); foreach (ListItem item in MeansCheckList.Items) { if (dv[0]["Means"].ToString().Contains(item.Value)) { item.Selected = true; } } foreach (ListItem item in MeansCheckList2.Items) { if (dv[0]["Means"].ToString().Contains(item.Value)) { item.Selected = true; } } foreach (ListItem item in MeansCheckList3.Items) { if (dv[0]["Means"].ToString().Contains(item.Value)) { item.Selected = true; } } DataView dvBring = dat.GetDataDV("SELECT * FROM Trips_WhatToBring WHERE TripID=" + eventID); int count = 1; foreach (DataRowView row in dvBring) { BringLabel.Text += count.ToString() + ". " + row["WhatToBring"].ToString() + "<br/>"; count++; } dvBring = dat.GetDataDV("SELECT * FROM TripDirections WHERE TripID=" + eventID); count = 1; string dirFunc = "function PlotMapDirections(){var address; var address2; \r\n"; string prevAddrs = ""; string thisAddress = ""; int mapCount = 0; string walking = ""; if (dvBring.Count == 1) { Directions.Text += count.ToString() + ". " + dvBring[0]["Directions"].ToString(); MapLiteral.Text = "<div id=\"map_canvas\" class=\"TripMapCanvas\"></div>"; thisAddress = dat.GetAddress(dvBring[0]["Address"].ToString(), dvBring[0]["Country"].ToString() != "223") + " " + dvBring[0]["City"].ToString() + " " + dvBring[0]["State"].ToString() + " " + dvBring[0]["Zip"].ToString() + " " + dvBring[0]["Country"].ToString(); dirFunc += "map = new GMap2(document.getElementById(\"map_canvas\")); map.setUIToDefault(); " + "address = '" + thisAddress.Replace("'", "''") + "'; createMarker(address, '" + dv[0]["Header"].ToString().Replace("'", "''") + "','<div class=\"MapHeader\"><h2>" + dv[0]["Header"].ToString().Replace("'", "''") + ":</h2> <br/>" + dvBring[0]["Directions"].ToString().Replace("'", "''") + "</div>');}"; } else { string firstAddress = ""; foreach (DataRowView row in dvBring) { Directions.Text += count.ToString() + ". " + row["Directions"].ToString() + "<br/>"; count++; thisAddress = dat.GetAddress(row["Address"].ToString(), row["Country"].ToString() != "223") + " " + row["City"].ToString() + " " + row["State"].ToString() + " " + row["Zip"].ToString() + " " + row["Country"].ToString(); if (prevAddrs != "") { if ((bool)row["Walking"]) walking = "{travelMode:G_TRAVEL_MODE_WALKING}"; else walking = "{travelMode:G_TRAVEL_MODE_DRIVING}"; dirFunc += "map = new GMap2(document.getElementById(\"map_canvas" + mapCount.ToString() + "\")); \r\n map.setUIToDefault();\r\n directionsPanel = document.getElementById(\"my_textual_div" + mapCount.ToString() + "\"); \r\n directions = " + "new GDirections(map, directionsPanel);directions.load(\"from: " + prevAddrs.Replace("'", "''") + " to: " + thisAddress.Replace("'", "''") + "\", " + walking + ");\r\n "; GoogleDirectionsLiteral.Text += "<div id=\"my_textual_div" + mapCount.ToString() + "\"></div>"; MapLiteral.Text += "<div class=\"MapLiteral2\" id=\"map_canvas" + mapCount.ToString() + "\"></div>"; mapCount++; } else { firstAddress = thisAddress; } prevAddrs = thisAddress; } MapLiteral.Text += "<h1 class=\"SideColumn\">Map: <a onclick=\"createMarker('" + firstAddress.Replace("'", "''") + "', 'Beginning', '<h2>Beginning:</h2> <br/>" + dvBring[0]["Directions"].ToString().Replace("'", "''") + "');\" class=\"NavyLinkUD\">Beginning</a> " + "and <a class=\"NavyLinkUD\" onclick=\"createMarker('" + prevAddrs.Replace("'", "''") + "', 'Destination', '<h2>Destination:</h2> <br/>" + dvBring[dvBring.Count - 1]["Directions"].ToString() + "');\">Destination</a></h1><div class=\"topDiv MapLiteral3\" id=\"map_canvas\" " + "></div>"; dirFunc += "\r\n map = new GMap(document.getElementById(\"map_canvas\"));" + "map.addControl(new GSmallMapControl());map.setCenter(new GLatLng(0,0), 0);\r\n " + "createMarker('" + firstAddress.Replace("'", "''") + "', \"Beginning\", '<div class=\"MapHeader\"><h2>Beginning:</h2> <br/>" + dvBring[0]["Directions"].ToString().Replace("'", "''") + "</div>');\r\n"; dirFunc += "}\r\n"; } DirectionsLiteral.Text = "<script type=\"text/javascript\">" + dirFunc + "</script>"; Master.BodyTag.Attributes.Add("onload", "initialize();"); Master.BodyTag.Attributes.Add("onunload", "GUnload()"); EventName.Text = "<a id=\"" + dat.MakeNiceNameFull(dv[0]["Header"].ToString()) + "\" class=\"aboutLink\" href=\"http://" + Request.Url.Authority + "/" + dat.MakeNiceName(dv[0]["Header"].ToString()) + "_" + ID.ToString() + "_Trip\"><h1>" + dat.BreakUpString(dv[0]["Header"].ToString(), 50) + "</h1></a>"; Session["Subject"] = "Re: " + dv[0]["Header"].ToString(); Session["CommentSubject"] = "Re: " + dv[0]["Header"].ToString(); string UserName = dv[0]["UserName"].ToString(); TagCloud.THE_ID = int.Parse(ID); string content = dv[0]["Content"].ToString(); string niceName = dat.MakeNiceName(dv[0]["Header"].ToString()); //ScriptLiteral.Text = "<script type=\"text/javascript\">ReturnURL('" + niceName.Replace("_", " ") + " http://HippoHappenings.com/" + Request.QueryString["ID"].ToString() + "_Trip');</script>"; if (Session["User"] != null) { DataSet dsComments; string commentPrefs = dat.GetData("SELECT * FROM UserPreferences WHERE UserID=" + Session["User"].ToString()).Tables[0].Rows[0]["CommentsPreferences"].ToString(); if (commentPrefs == "1") { dsComments = dat.GetData("SELECT C.BlogDate AS theDate, * FROM TripComments C, Users U WHERE U.User_ID=C.UserID AND C.BlogID=" + ID + " ORDER BY C.BlogDate"); } else { dsComments = dat.GetData("SELECT DISTINCT U.ProfilePicture, U.User_ID, U.UserName, C.Comment, C.BlogDate AS theDate FROM TripComments C, Users U, User_Friends UF WHERE ((UF.UserID=" + Session["User"].ToString() + " AND UF.FriendID=U.User_ID AND U.User_ID=C.UserID) OR (U.User_ID=" + Session["User"].ToString() + " AND U.User_ID=C.UserID)) AND C.BlogID=" + ID + " ORDER BY C.BlogDate"); } TheComments.DATA_SET = dsComments; TheComments.DataBind2(true); } else { DataSet dsComments = dat.GetData("SELECT C.BlogDate AS theDate, * FROM TripComments C, Users U WHERE U.User_ID=C.UserID AND C.BlogID=" + ID + " ORDER BY C.BlogDate"); TheComments.DATA_SET = dsComments; TheComments.DataBind2(true); } ShowDescriptionBegining.Text = dat.BreakUpString(content, 20); Session["messageText"] = dat.BreakUpString(dv[0]["Header"].ToString(), 14); Session["messageEmail"] = "Adventure Name: <a href=\"http://hippohappenings.com/" + dat.MakeNiceName(dat.BreakUpString(dv[0]["Header"].ToString(), 14)) + "_" + ID + "_Trip\">" + dat.BreakUpString(dv[0]["Header"].ToString(), 14) + "</a> <br/><br/> "+ ShowDescriptionBegining.Text; //Media Categories: NONE: 0, Picture: 1, Video: 2, YouTubeVideo: 3, Slider: 4 Rotator1.Items.Clear(); int mediaCategory = int.Parse(dv[0]["mediaCategory"].ToString()); string youtube = dv[0]["YouTubeVideo"].ToString(); switch (mediaCategory) { case 0: break; case 1: char[] delim4 = { ';' }; string[] youtokens = youtube.Split(delim4); if (youtube != "") { for (int i = 0; i < youtokens.Length; i++) { if (youtokens[i].Trim() != "") { Literal literal3 = new Literal(); //literal3.Text = "<object width=\"400\" height=\"250\"><param name=\"wmode\" value=\"opaque\" ><param name=\"movie\" value=\"http://www.youtube.com/cp/vjVQa1PpcFOFUjhw1qTHaE09Z1e9QYKk9y1JrWf5VAc=\"></param><embed wmode=\"opaque\" src=\"http://www.youtube.com/cp/vjVQa1PpcFOFUjhw1qTHaE09Z1e9QYKk9y1JrWf5VAc=\" type=\"application/x-shockwave-flash\" width=\"400\" height=\"250\"></embed></object>"; literal3.Text = "<div class=\"YouTubeWrapper\"><object class=\"toHidde\" width=\"412\" " + "height=\"250\"><param name=\"movie\" value=\"http://www.youtube.com/v/" + youtokens[i] + "\"/><param name=\"wmode2\" value=\"transparent\" /><param name=\"wmode\" " + "value=\"opaque\" /><param name=\"allowFullScreen\" value=\"true\"/><embed " + "src=\"http://www.youtube.com/v/" + youtokens[i] + "\" wmode=\"opaque\" wmode2=\"transparent\" type=\"application/x-shockwave" + "-flash\" allowfullscreen=\"true\" width=\"412\" height=\"250\"/></object></div>"; Telerik.Web.UI.RadRotatorItem r3 = new Telerik.Web.UI.RadRotatorItem(); r3.Controls.Add(literal3); Rotator1.Items.Add(r3); } } } DataView dsSlider = dat.GetDataDV("SELECT * FROM Trip_Slider_Mapping WHERE TripID=" + ID); if (dsSlider.Count > 0) { try { char[] delim = { '\\' }; char[] delim3 = { '.' }; string[] fileArray = System.IO.Directory.GetFiles(MapPath(".") + "\\Trips\\" + ID + "\\Slider"); string[] finalFileArray = new string[fileArray.Length]; for (int i = 0; i < dsSlider.Count; i++) { string[] tokens = dsSlider[i]["PictureName"].ToString().Split(delim3); //dsSlider.RowFilter = "PictureName='" + tokens[0] + "." + tokens[1] + "'"; if (tokens.Length >= 2 && dsSlider.Count > 0) { if (tokens[1].ToUpper() == "JPG" || tokens[1].ToUpper() == "JPEG" || tokens[1].ToUpper() == "GIF" || tokens[1].ToUpper() == "PNG") { System.Drawing.Image image = System.Drawing.Image.FromFile(MapPath(".") + "\\Trips\\" + ID + "\\Slider\\" + dsSlider[i]["PictureName"].ToString()); int width = 410; int height = 250; int newHeight = 0; int newIntWidth = 0; //if image height is less than resize height if (height >= image.Height) { //leave the height as is newHeight = image.Height; if (width >= image.Width) { newIntWidth = image.Width; } else { newIntWidth = width; double theDivider = double.Parse(image.Width.ToString()) / double.Parse(newIntWidth.ToString()); double newDoubleHeight = double.Parse(newHeight.ToString()); newDoubleHeight = double.Parse(height.ToString()) / theDivider; newHeight = (int)newDoubleHeight; } } //if image height is greater than resize height...resize it else { //make height equal to the requested height. newHeight = height; //get the ratio of the new height/original height and apply that to the width double theDivider = double.Parse(image.Height.ToString()) / double.Parse(newHeight.ToString()); double newDoubleWidth = double.Parse(newIntWidth.ToString()); newDoubleWidth = double.Parse(image.Width.ToString()) / theDivider; newIntWidth = (int)newDoubleWidth; //if the resized width is still to big if (newIntWidth > width) { //make it equal to the requested width newIntWidth = width; //get the ratio of old/new width and apply it to the already resized height theDivider = double.Parse(image.Width.ToString()) / double.Parse(newIntWidth.ToString()); double newDoubleHeight = double.Parse(newHeight.ToString()); newDoubleHeight = double.Parse(image.Height.ToString()) / theDivider; newHeight = (int)newDoubleHeight; } } Literal literal4 = new Literal(); string[] nameTokens = dsSlider[i]["RealPictureName"].ToString().Split(delim3); string realName = dat.MakeNiceName(nameTokens[0]).Replace("_", " "); literal4.Text = "<div class=\"RotatorImage\"><img alt=\"" + realName + "\" style=\" margin-left: " + ((410 - newIntWidth) / 2).ToString() + "px; margin-top: " + ((250 - newHeight) / 2).ToString() + "px;\" height=\"" + newHeight + "px\" width=\"" + newIntWidth + "px\" src=\"" + "Trips/" + ID + "/Slider/" + dsSlider[i]["PictureName"].ToString() + "\" /></div>"; Telerik.Web.UI.RadRotatorItem r4 = new Telerik.Web.UI.RadRotatorItem(); r4.Controls.Add(literal4); Rotator1.Items.Add(r4); } } } } catch (Exception ex) { } } break; default: break; } if (Rotator1.Items.Count == 0) RotatorPanel.Visible = false; else { RotatorPanel.Visible = true; if (Rotator1.Items.Count == 1) { RotatorPanel.CssClass = "HiddeButtons"; } } if (fillUserData) { ASP.controls_sendmessage_ascx SendMessage1 = new ASP.controls_sendmessage_ascx(); SendMessage1.THE_TEXT = "Share on Hippo"; SendMessage1.RE_LABEL = "Re: " + Session["UserName"].ToString() + " would like to share \"" + dat.BreakUpString(dv[0]["Header"].ToString(), 14) + "\" with you."; SendMessage1.TYPE = "t"; SendMessage1.ID = int.Parse(ID); CalendarSharePanel.Controls.Add(SendMessage1); Session["Subject"] = "Re: " + Session["UserName"].ToString() + " would like to share \"" + dat.BreakUpString(dv[0]["Header"].ToString(), 14) + "\" with you."; } } else { EventName.Text = "This adventure has been disabled"; } } catch (Exception ex) { ErrorLabel.Text = ex.ToString(); //Response.Redirect("~/home"); } }