public void DataBind2() { HttpCookie cookie = Request.Cookies["BrowserDate"]; if (adDS != null) { int adCount = 0; if (adDS.Tables.Count > 0) adCount = adDS.Tables[0].Rows.Count; ArrayList a = new ArrayList(adCount); Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); int searchTo = adCount; if (dat.SearchCutOffNumber < adCount) { searchTo = dat.SearchCutOffNumber; } for (int i = 0; i < searchTo; i++) { ASP.controls_adsearchelement_ascx searchElement = new ASP.controls_adsearchelement_ascx(); searchElement.AD_ID = int.Parse(adDS.Tables[0].Rows[i]["Ad_ID"].ToString()); searchElement.SEARCH_LABEL = adDS.Tables[0].Rows[i]["Header"].ToString(); searchElement.IS_WINDOW = windowT; if (i % 2 != 0) searchElement.COLOR = "#1b1b1b"; a.Add(searchElement); //pagerPanel.Add(searchElement); } ASP.controls_pager_test_ascx pagerPanel = new ASP.controls_pager_test_ascx(); pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 10; pagerPanel.DATA = a; pagerPanel.WIDTH = 420; pagerPanel.PANEL_NAME = "AdSearchElements_ctl00_Panel"; pagerPanel.DataBind2(); SearchElementsPanel.Controls.Add(pagerPanel); } }
public int DataBind2() { HttpCookie cookie = Request.Cookies["BrowserDate"]; Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); Hashtable hash = new Hashtable(); int countInHash = 0; if (eventsDS != null) { try { Clear(); int eventCount = 0; if (eventsDS.Tables.Count > 0) eventCount = eventsDS.Tables[0].Rows.Count; ArrayList a = new ArrayList(eventCount); int searchTo = eventCount; if (dat.SearchCutOffNumber < eventCount) { searchTo = dat.SearchCutOffNumber; } DataView dv = new DataView(eventsDS.Tables[0], "", "", DataViewRowState.CurrentRows); if (Session["sortString"] != null) { if (Session["sortString"] != "") { dv.Sort = Session["sortString"].ToString(); sortString = Session["sortString"].ToString(); } } int countGotten = 0; int i = 0; Hashtable actualHash = new Hashtable(); while (countInHash < searchTo && i < dv.Count) { if (!hash.Contains(dv[i]["HashID"].ToString())) { hash.Add(dv[i]["HashID"].ToString(), ""); actualHash.Add(countInHash, dv[i]["HashID"].ToString()); countInHash++; } i++; } int somecount = 0; ASP.controls_pager_test_ascx pagerPanel = new ASP.controls_pager_test_ascx(); pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = num_of_pages; pagerPanel.ID = "PagerPanel"; if (Request.Url.AbsolutePath.ToLower() == "/searchresults.aspx") { pagerPanel.RUN_FUNCTION = "initialize"; pagerPanel.PANEL_NAME = "EventSearchElements_PagerPanel_Panel"; } else if (Request.Url.AbsolutePath.ToLower() == "/eventcategorysearch.aspx") { pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_SearchElements_PagerPanel_Panel"; } else if (Request.Url.AbsolutePath.ToLower() == "/Friend.aspx") { pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_EventsCtrl_PagerPanel_Panel"; } int mapCount = 0; if (countInHash > theCutOff) countInHash = theCutOff; for (int j = 0; j < countInHash;j++ ) { try { string str = actualHash[j].ToString(); dv.RowFilter = "HashID = '" + str + "'"; ASP.controls_searchelement_ascx searchElement = new ASP.controls_searchelement_ascx(); //if (j % num_of_pages == 0) //{ // if (mapStrings != null) // { // searchElement.IMAGE_LITERAL += mapStrings[mapCount]; // mapCount++; // } //} if (doCalendar) { searchElement.CALENDAR_LETTER = dv[0]["CalendarNum"].ToString(); } searchElement.NUM_OF_ALL_RESULTS = countOfUniqueVenues; searchElement.SEARCH_LABEL = dv[0]["Header"].ToString(); string toolTipID = ""; if (bool.Parse(dv[0]["isGroup"].ToString())) { searchElement.EVENT_ID = int.Parse(dv[0]["EID"].ToString()); searchElement.IS_GROUP = true; searchElement.IS_WINDOW = windowT; toolTipID = "True" + dv[0]["EID"].ToString() + dv[0]["ReoccurrID"].ToString(); if (doMap) { searchElement.SEARCH_MAP_NUM = dv[0]["SearchNum"].ToString(); } foreach (DataRowView row in dv) { searchElement.DATE_LABEL += row["DateTimeStart"].ToString() + "<span style='font-family: Arial; font-size: 14px; font-weight: bold; color: #1fb6e7;'>, </span>"; } DataView dvEventOccurance = dat.GetDataDV("SELECT * FROM GroupEvent_Occurance WHERE GroupEventID=" + dv[0]["EID"].ToString() + " AND ID=" + dv[0]["ReoccurrID"].ToString()); DataView dvGroupEvent = dat.GetDataDV("SELECT * FROM GroupEvents WHERE ID=" + dv[0]["EID"].ToString()); bool getAddress = false; if (dvEventOccurance[0]["VenueID"] != null) { if (dvEventOccurance[0]["VenueID"].ToString() != "") { DataView dvVenue = dat.GetDataDV("SELECT * FROM Venues WHERE ID=" + dvEventOccurance[0]["VenueID"].ToString()); searchElement.VENUE_LABEL = dvVenue[0]["Name"].ToString(); searchElement.VENUE_ID = int.Parse(dvVenue[0]["ID"].ToString()); } else getAddress = true; } else getAddress = true; if (getAddress) { bool isInter = false; if (dvEventOccurance[0]["Country"].ToString() != "223") isInter = true; string address = ""; if (dvEventOccurance[0]["Country"].ToString() == "223") { address = dvEventOccurance[0]["StreetNumber"].ToString() + " " + dvEventOccurance[0]["StreetName"].ToString() + " " + dvEventOccurance[0]["StreetDrop"].ToString(); } else { address = dvEventOccurance[0]["Location"].ToString(); } searchElement.ADDRESS = address; } } else { searchElement.VENUE_LABEL = dv[0]["Name"].ToString(); searchElement.NUM_LABEL = ", " + dv[0]["EventGoersCount"].ToString() + " Peeps attending"; searchElement.EVENT_ID = int.Parse(dv[0]["EID"].ToString()); searchElement.IS_WINDOW = windowT; toolTipID = "False" + dv[0]["EID"].ToString() + dv[0]["ReoccurrID"].ToString(); if (doMap) { searchElement.SEARCH_MAP_NUM = dv[0]["SearchNum"].ToString(); } foreach (DataRowView row in dv) { searchElement.DATE_LABEL += row["DateTimeStart"].ToString() + "<span style='font-family: Arial; font-size: 14px; font-weight: bold; color: #1fb6e7;'>, </span>"; } searchElement.VENUE_ID = int.Parse(dv[0]["VID"].ToString()); } searchElement.TOOL_TIP_ID = toolTipID; if (isConnectTo) { searchElement.IS_CONNECT_TO = bool.Parse(dv[0]["isConnect"].ToString()); searchElement.WIDTH = 417; } if (somecount % 2 != 0) searchElement.COLOR = "#1b1b1b"; somecount++; a.Add(searchElement); //pagerPanel.Add(searchElement); } catch (Exception ex) { Label lab = new Label(); lab.Text = ex.ToString(); a.Add(lab); } } pagerPanel.DATA = a; pagerPanel.WIDTH = 420; pagerPanel.DataBind2(); SearchElementsPanel.Controls.Add(pagerPanel); } catch (Exception ex) { ErrorLabel.Text = ex.ToString(); } } return countInHash; }
protected void FillEvents(DataSet dsAll) { HttpCookie cookie = Request.Cookies["BrowserDate"]; Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); int count = dsAll.Tables[0].Rows.Count; Encryption decrypt = new Encryption(); //if (Request.QueryString["message"] != null) // MessageLabel.Text = decrypt.decrypt(Request.QueryString["message"].ToString()); //else if (Session["Message"] != null) //{ // MessageLabel.Text = Session["Message"].ToString(); //} if (count > 0) { ASP.controls_pager_test_ascx pagerPanel = new ASP.controls_pager_test_ascx(); pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 6; pagerPanel.PANEL_NAME = "ctl02_Panel"; pagerPanel.PANEL_CSSCLASS = "FavoritesPanel"; pagerPanel.WIDTH = 650; ArrayList a = new ArrayList(count * 4); for (int i = 0; i < count; i++) { dat.InsertOneEvent(dsAll, i, ref a, true); } pagerPanel.DATA = a; pagerPanel.DataBind2(); RecommendedEvents.Controls.Clear(); RecommendedEvents.Controls.Add(pagerPanel); } else { Label lab = new Label(); lab.CssClass = "EventBody"; lab.Text = "<br/>No Recommended events in this time frame."; RecommendedEvents.Controls.Clear(); RecommendedEvents.Controls.Add(lab); } }
public void DataBind2() { HttpCookie cookie = Request.Cookies["BrowserDate"]; if (venueDS != null) { int venueCount = 0; if (venueDS.Tables.Count > 0) venueCount = venueDS.Tables[0].Rows.Count; ArrayList a = new ArrayList(venueCount); Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); int searchTo = venueCount; if (dat.SearchCutOffNumber < venueCount) { searchTo = dat.SearchCutOffNumber; } int mapCount = 0; for (int i = 0; i < searchTo; i++) { ASP.controls_venuesearchelement_ascx searchElement = new ASP.controls_venuesearchelement_ascx(); searchElement.Venue_ID = int.Parse(venueDS.Tables[0].Rows[i]["VID"].ToString()); searchElement.SEARCH_LABEL = venueDS.Tables[0].Rows[i]["Name"].ToString(); searchElement.CITY = venueDS.Tables[0].Rows[i]["City"].ToString(); searchElement.STATE = venueDS.Tables[0].Rows[i]["State"].ToString(); searchElement.IS_WINDOW = windowT; searchElement.NUM_OF_ALL_RESULTS = searchTo; if (doMap) { searchElement.SEARCH_MAP_NUM = venueDS.Tables[0].Rows[i]["SearchNum"].ToString(); } if (i % 2 != 0) searchElement.COLOR = "#1b1b1b"; //if (i % num_of_pages == 0) //{ // //if (mapCount < mapStrings.Length) // //{ // searchElement.IMAGE_LITERAL += mapStrings[mapCount]; // mapCount++; // //} //} a.Add(searchElement); //pagerPanel.Add(searchElement); } ASP.controls_pager_test_ascx pagerPanel = new ASP.controls_pager_test_ascx(); pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = num_of_pages; if (Request.Url.AbsolutePath.ToLower() == "/searchresults.aspx") { pagerPanel.PANEL_NAME = "VenueSearchElements_ctl00_Panel"; pagerPanel.RUN_FUNCTION = "initialize"; } else if (Request.Url.AbsolutePath.ToLower() == "/venuecategorysearch.aspx") { pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_SearchElements_ctl00_Panel"; } pagerPanel.DATA = a; pagerPanel.WIDTH = 420; pagerPanel.DataBind2(); SearchElementsPanel.Controls.Add(pagerPanel); } }
protected void LoadControlsNotAJAX() { HttpCookie cookie = Request.Cookies["BrowserDate"]; try { Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); DataSet ds = dat.GetData("SELECT TOP 100 UM.MessageSubject, UM.ID, UM.From_UserID, UM.MessageContent, UM.[Read], UM.Date, U.UserName, UM.Mode FROM UserMessages UM, Users U WHERE UM.Live='True' AND UM.To_UserID=" + Session["User"].ToString() + " AND UM.From_UserID=U.User_ID AND UM.LIVE=1 ORDER BY Date DESC"); ASP.controls_pager_test_ascx pagerPanel = new ASP.controls_pager_test_ascx(); pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_ctl14_Panel"; pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 1; pagerPanel.WIDTH = 576; pagerPanel.NUMBER_OF_VISIBLE_PAGES = 4; ArrayList a = new ArrayList(ds.Tables[0].Rows.Count); if (ds.Tables[0].Rows.Count == 0) { Literal lit = new Literal(); lit.Text = "<div style=\"border: solid 3px #1b1b1b;" + "float: left; width: 570px;\"><div style=\"width: 560px; display: block; float: left; margin" + "-left: 5px;\"><table width=\"100%\"><tr><td><span style=\"font-family: Arial; font-size: 12px;" + "color: #cccccc; padding-left: 5px;\">(0 messages)</span></td></tr></table></div>" + "<div style=\"width: 560px; display: block; float: left; margin-left: 5px; padding-bottom: 5px;\">" + "</div></div>"; MessagesPanel.Controls.Add(lit); } else { int unreadCount = AddMessages(ds, ref a, false); pagerPanel.DATA = a; pagerPanel.DataBind2(); Label label = new Label(); string temp = "messages"; if (ds.Tables[0].Rows.Count == 1) temp = "message"; if (unreadCount > 0) { RadTabStrip3.Tabs[0].Text = "<div style=\"float: left;\">Inbox </div>" + "<div style=\"float: left;font-size: 12px; vertical-align: " + "middle; font-weight: normal; padding-bottom: 3px;\" id=\"InboxDiv\">" + "<div style=\"float: left;\"> (</div><div style=\"float: left;\" id=\"InboxInnerDiv\">" + unreadCount.ToString() + " </div><div style=\"float: left;\"> New)</div></div>"; //label.Text = "<span style=\"font-family: Arial; font-size: 20px; color: White;\">My Messages</span>" // + "<span style=\"font-family: Arial; font-size: 12px; color: #cccccc; padding-left: 5px;\">(" + unreadCount.ToString() // + " new " + temp + ")</span>"; RadTabStrip3.Tabs[0].Value = unreadCount.ToString(); } MessagesPanel.Controls.Clear(); //MessagesPanel.Controls.Add(label); MessagesPanel.Controls.Add(pagerPanel); } ds = dat.GetData("SELECT TOP 100 UM.MessageContent, UM.ID, UM.To_UserID AS From_UserID, UM.MessageSubject, UM.[Read], UM.Mode, UM.Date, U.UserName FROM UserMessages UM, Users U WHERE UM.From_UserID=" + Session["User"].ToString() + " AND U.User_ID=UM.To_UserID AND UM.SentLive=1 ORDER BY Date DESC"); pagerPanel = new ASP.controls_pager_test_ascx(); pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_ctl15_Panel"; pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 1; pagerPanel.WIDTH = 576; a = new ArrayList(ds.Tables[0].Rows.Count); if (ds.Tables[0].Rows.Count == 0) { Literal lit = new Literal(); lit.Text = "<div style=\"border: solid 3px #1b1b1b;" + "float: left; width: 570px;\"><div style=\"width: 560px; display: block; float: left; margin" + "-left: 5px;\"><table width=\"100%\"><tr><td><span style=\"font-family: Arial; font-size: 12px;" + "color: #cccccc; padding-left: 5px;\">(0 sent messages)</span></td></tr></table></div>" + "<div style=\"width: 560px; display: block; float: left; margin-left: 5px; padding-bottom: 5px;\">" + "</div></div>"; UsedMessagesPanel.Controls.Add(lit); } else { AddMessages(ds, ref a, true); pagerPanel.DATA = a; pagerPanel.DataBind2(); UsedMessagesPanel.Controls.Clear(); UsedMessagesPanel.Controls.Add(pagerPanel); } } catch (Exception ex) { UserErrorLabel.Text = ex.ToString(); } }
protected void LoadControls() { HttpCookie cookie = Request.Cookies["BrowserDate"]; TheDiv.InnerHtml = ""; Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); DataSet ds = dat.GetData("SELECT UM.MessageSubject, UM.MessageContent, U.UserName FROM UserMessages UM, Users U WHERE UM.Live='True' AND UM.To_UserID=" + Session["User"].ToString() + " AND UM.From_UserID=U.User_ID ORDER BY Date DESC"); System.Drawing.Color greyText = System.Drawing.Color.FromArgb(102, 102, 102); System.Drawing.Color greyBack = System.Drawing.Color.FromArgb(51, 51, 51); ASP.controls_pager_test_ascx pagerPanel = new ASP.controls_pager_test_ascx(); pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_ctl14_Panel"; pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 1; ArrayList a = new ArrayList(ds.Tables[0].Rows.Count); int unreadCount = 0; int count = 0; int times = 1; Panel ItemsPanel = new Panel(); ItemsPanel.ID = "PanelM1"; if (ds.Tables.Count > 0) if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (count == 10 * times) { a.Add(ItemsPanel); times++; ItemsPanel = new Panel(); ItemsPanel.ID = "PanelM" + times.ToString(); } count++; DataSet dsUsers = dat.GetData("SELECT * FROM Users WHERE User_ID=" + ds.Tables[0].Rows[i]["From_UserID"].ToString()); if (!bool.Parse(ds.Tables[0].Rows[i]["Read"].ToString())) unreadCount++; string boldOrNot = "font-size: 12px;"; if (!bool.Parse(ds.Tables[0].Rows[i]["Read"].ToString())) boldOrNot = "font-weight:bold;font-size: 14px;"; HtmlGenericControl thediv = new HtmlGenericControl(); thediv.Attributes.Add("class", "MailHeader"); thediv.Attributes.Add("style", boldOrNot); thediv.Attributes.Add("onclick", "OpenEmail('" + i.ToString() + "');"); //thediv.Attributes.Add("onserverclick", "MarkAsRead2"); thediv.ID = "header" + i.ToString(); string thedivsText = ""; //thedivsText = "<div class=\"MailHeader\" style=\""+boldOrNot+"\" "+ // "onclick=\"OpenEmail('"+i.ToString()+"');\" id=\"header"+i.ToString()+"\">"; //thedivsText += "<div style=\"display: none;\" id=\"readDiv"+i.ToString()+"\">"+ // ds.Tables[0].Rows[i]["Read"].ToString()+"</div>"; //thedivsText += "<div style=\"display: none;\" id=\"idDiv"+i.ToString()+"\">"+ // ds.Tables[0].Rows[i]["ID"].ToString()+"</div>"; //thedivsText += "<div style=\"display: none;\" id=\"userDiv" + i.ToString() + "\">" + // Session["User"].ToString() + "</div>"; //thedivsText += "<div style=\"display: none;\" id=\"fromDiv" + i.ToString() + "\">" + // ds.Tables[0].Rows[i]["From_UserID"].ToString() + "</div>"; string tempor2 = ""; string theUser = dsUsers.Tables[0].Rows[0]["UserName"].ToString(); if (ds.Tables[0].Rows[i]["Mode"].ToString() == "1") { theUser = "******"; tempor2 = " style=\"display:none;\" "; } string acceptHTML = ""; string tempor = ""; if (ds.Tables[0].Rows[i]["Mode"].ToString() == "2") { tempor2 = " style=\"display:none;\" "; tempor = "<a class=\"AddGreenLink\" href=\"javascript:AcceptFriend('" + i.ToString() + "');\">Accept Friend Request</a>"; DataSet isFirend = dat.GetData("SELECT * FROM User_Friends WHERE UserID="+Session["User"].ToString()+" AND FriendID="+ds.Tables[0].Rows[i]["From_UserID"].ToString()); if (isFirend.Tables.Count > 0) if (isFirend.Tables[0].Rows.Count > 0) tempor = "<span class=\"AddGreenLink\">You are already friends with "+theUser + "</span>"; acceptHTML = "<div class=\"AddGreenLink\" id=\"accept"+i.ToString()+"\">"+tempor+"</div><br/>"; } thedivsText += "<table width=\"560px\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><span style=\"padding-left:5px;font-family:Arial;color: #cccccc; " + "\">From: </span><span style=\"color: #1fb6e7; font-family: Arial;\">" + theUser + "</span></td><td ><span style=\"padding-top:10px;font-family:Arial;" + "color: #cccccc;float:right;padding-right:5px;\">" + ds.Tables[0].Rows[i]["Date"].ToString() + "</span></td></tr><tr><td colspan=\"3\"><span style=\"font-family:Arial;color: #cccccc;padding-left: 5px;\">Subject: <span id=\"subject" + i.ToString() + "\">" + ds.Tables[0].Rows[i]["MessageSubject"].ToString() + "</span></span></td></tr></table>"; thedivsText += "</div>"; thediv.InnerHtml = thedivsText; HtmlGenericControl messageDiv = new HtmlGenericControl(); messageDiv.Attributes.Add("style", "display: none;"); messageDiv.Attributes.Add("class", "MailContent EventBody"); messageDiv.ID = "contentDiv"; string messageDivsText = ""; //thedivsText += "<div style=\"display: none;\" class=\"MailContent EventBody\" id=\"contentDiv"+ // i.ToString()+"\">"; messageDivsText += "<table><tr><td width=\"285px\" valign=\"top\"><label>" + ds.Tables[0].Rows[i]["MessageContent"].ToString()+" <br/><br/><br/> " +acceptHTML + "</label></td>"; messageDivsText += "<td valign=\"top\"><table ><tr><td width=\"285px\" align=\"right\">" + "<img alt=\"Delete Message\" name=\"Delete Message\" style=\"cursor: pointer;\" "+ "onclick=\"DeleteEmail('" + i.ToString() + "');\" src=\"image/X.png\" "+ "onmouseover=\"this.src='image/XSelected.png'\" onmouseout=\"this.src='image/X.png'\" />"+ "</td></tr><tr><td " + tempor2 + "><textarea cols=\"30\" rows=\"10\" id=\"textDiv" + i.ToString() + "\"></textarea></td></tr>"; messageDivsText += "<tr><td " + tempor2 + "><img onclick=\"ReplyMessage('" + i.ToString() + "');\" src=\"image/ReplyButton.png\" onmouseout=\"this.src='image/ReplyButton.png'\""+ "onmouseover=\"this.src='image/ReplyButtonSelected.png'\" /></td></tr>"; messageDivsText += "<tr><td><div class=\"AddLink\" id=\"message" + i.ToString() + "\"></div></td></tr>"; messageDivsText += "</table></td></tr></table>"; //thedivsText += "</div>"; messageDiv.InnerHtml = messageDivsText; ItemsPanel.Controls.Add(thediv); //message.DATE = ds.Tables[0].Rows[i]["Date"].ToString(); //MessagePanel.Controls.Add(message); } if (ds.Tables[0].Rows.Count % 10 != 0 || ds.Tables[0].Rows.Count == 10) { a.Add(ItemsPanel); } } if (a.Count > 0) { pagerPanel.DATA = a; pagerPanel.DataBind2(); } Label label = new Label(); string temp = "messages"; if (ds.Tables[0].Rows.Count == 1) temp = "message"; label.Text = "<table width=\"570px\"><tr><td><span style=\"font-family: Arial; font-size: 20px; color: White;\">My Messages</span>" + "<span style=\"font-family: Arial; font-size: 12px; color: #cccccc; padding-left: 5px;\">(<span id=\"messagesCount\">" + unreadCount.ToString() + "</span> new " + temp + ")</span></td><td align=\"right\"><div class=\"AddGreenLink\" id=\"globalMessage\"></div></td></tr></table>"; Panel MessagesPanel = (Panel)Tab1.FindControl("MessagesPanel"); MessagesPanel.Controls.Clear(); MessagesPanel.Controls.Add(label); MessagesPanel.Controls.Add(pagerPanel); }
protected void FillVenues() { HttpCookie cookie = Request.Cookies["BrowserDate"]; Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); DataSet ds = dat.GetData("SELECT *, UV.VenueID AS VID FROM UserVenues UV, Venues V "+ "WHERE V.ID=UV.VenueID AND UV.UserID="+ Session["User"].ToString() + " ORDER BY V.Name"); bool noneExist = false; if (ds.Tables.Count > 0) if (ds.Tables[0].Rows.Count > 0) { ASP.controls_pager_test_ascx pagerPanel = new ASP.controls_pager_test_ascx(); pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_ctl10_Panel"; pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 5; pagerPanel.PANEL_CSSCLASS = "FavoritesPanel"; pagerPanel.WIDTH = 260; ArrayList a = new ArrayList(ds.Tables[0].Rows.Count * 2); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Literal lit = new Literal(); lit.Text = "<div class=\"topDiv\"><div class=\"topDiv\" style=\"padding-top: 20px;\">"; Literal lit2 = new Literal(); lit2.Text = "</div>"; ASP.controls_hipporating_ascx rating = new ASP.controls_hipporating_ascx(); rating.VENUE_ID = ds.Tables[0].Rows[i]["ID"].ToString(); Label label = new Label(); label.Text = "<div style=\"float:left; padding-top: 4px;\"><a class=\"AddLink\" href=\"" + dat.MakeNiceName(ds.Tables[0].Rows[i]["Name"].ToString()) +'_'+ ds.Tables[0].Rows[i]["ID"].ToString() + "_Venue\">" + ds.Tables[0].Rows[i]["Name"].ToString() + "</a></div>"; DataSet dsEvents = dat.GetData("SELECT * FROM Events E, Event_Occurance EO WHERE EO.EventID=E.ID AND "+ "DAY(EO.DateTimeStart) = DAY(GETDATE()) AND MONTH(EO.DateTimeStart) = MONTH(GETDATE()) AND YEAR"+ "(EO.DateTimeStart) = YEAR(GETDATE()) " + " AND E.Venue=" + ds.Tables[0].Rows[i]["VID"].ToString()); int count = 0; if (dsEvents.Tables.Count > 0) if (dsEvents.Tables[0].Rows.Count > 0) count = dsEvents.Tables[0].Rows.Count; string theColor = ""; if (count > 0) theColor = "color: #ff6b09;"; Label label2 = new Label(); label2.Text = "<div style=\"display: block; padding-top: 3px;" + theColor + "\">" + count + " event[s] going on today </div></div>"; Panel allP = new Panel(); allP.Controls.Add(lit); allP.Controls.Add(label); allP.Controls.Add(rating); allP.Controls.Add(lit2); allP.Controls.Add(label2); a.Add(allP); } pagerPanel.DATA = a; pagerPanel.DataBind2(); Literal newLit = new Literal(); newLit.Text = "<div class=\"topDiv\">"; FavoriteVenues.Controls.Add(newLit); FavoriteVenues.Controls.Add(pagerPanel); newLit = new Literal(); newLit.Text = "</div>"; FavoriteVenues.Controls.Add(newLit); } else noneExist = true; else noneExist = true; if (noneExist) { Label label = new Label(); label.Text = "You have not added any venues to your favorite's list. To search for some awesome venues and make them your favorite visit the <a class=\"AddGreenLink\" href=\"VenueSearch.aspx\">venue's page.</a>"; FavoriteVenues.Controls.Add(label); } }
protected void FillRecommendedEvents() { HttpCookie cookie = Request.Cookies["BrowserDate"]; Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); //only show top 10 int topCount = 10; //Put the sets together DataSet dsAll = dat.RetrieveRecommendedEvents(topCount, true); bool noneMessage = false; if (dsAll.Tables.Count > 0) if (dsAll.Tables[0].Rows.Count > 0) { //insert link to all recommended events Session["RecomDS"] = dsAll; Literal link = new Literal(); link.Text = "<h4 style=\"margin-bottom: 5px;\">Top 10 Recommended Events</h4><div><a class=\"AddLink\" onclick=\"OpenRadRecom();\">See All</a></div>"; RecommendedEvents.Controls.Add(link); Hashtable hash = new Hashtable(); ASP.controls_pager_test_ascx pagerPanel = new ASP.controls_pager_test_ascx(); pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_ctl13_Panel"; pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 3; pagerPanel.PANEL_CSSCLASS = "FavoritesPanel"; pagerPanel.WIDTH = 270; ArrayList a = new ArrayList(topCount); for (int i = 0; i < topCount; i++) { dat.InsertOneEvent(dsAll, i, ref a, false); } pagerPanel.DATA = a; pagerPanel.DataBind2(); RecommendedEvents.Controls.Add(pagerPanel); } else { noneMessage = true; } else noneMessage = true; if (noneMessage) { Label lab = new Label(); lab.Text = "There are no recommended events here this month. There are a few reasons for this. "+ "There simply is no events that fit your recommendation criteria, or you have selected not to "+ "recommend any events. To modify your preferences please visit the 'My Preferences' tab on this page."; RecommendedEvents.Controls.Add(lab); } }