//protected void GetBadges() //{ // HttpCookie cookie = Request.Cookies["BrowserDate"]; // DateTime isNow = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")); // Data dat = new Data(isNow); // DataView dv = dat.GetDataDV("SELECT * FROM Mayors WHERE UserID=" + Session["User"].ToString()); // Literal lit; // int num = 0; // int remainder = 0; // if (dv.Count == 0) // { // lit = new Literal(); // lit.Text = "<div>You do not have any badges to display. To find out how to get badges " + // "visit our <a class=\"NavyLink12\" href=\"hippo-points\">Hippo Points Page</a>.</div>"; // BadgesPanel.Controls.Add(lit); // } // else // { // lit = new Literal(); // if (dv.Count != 0) // { // lit.Text += "<div style=\"position: relative;float: left;\"><div id=\"div1\" style=\"z-index: 10000;left: 55px; top: -50px;" + // "padding: 10px;position: absolute;display: " + // "none;background-color: white; width: 150px; border: solid 3px #09718F;\"><b>The Hippo:</b> " + // "You received this badge because you have won the Hippo Boss award at least once." + // "</div><div onmouseout=\"var theDiv = document.getElementById('div1');theDiv.style.display " + // "= 'none';\" onmouseover=\"var theDiv = document.getElementById('div1');theDiv.style.display " + // "= 'block';\" style=\"margin-right: 10px;margin-bottom: 10px;width: 72px; height: 50px; float: " + // "left;background-image: url('NewImages/HippoBadge.png');\">" + dv.Count.ToString() + "</div></div>"; // } // if (dv.Count >= 5) // { // num = dv.Count / 5; // remainder = dv.Count - num * 5; // lit.Text += "<div style=\"position: relative;float: left;\"><div id=\"div5\" style=\"z-index: 10000;left: 55px; top: -50px;" + // "padding: 10px;position: absolute;display: " + // "none;background-color: white; width: 150px; border: solid 3px #09718F;\"><b>The Bronze Hippo:</b> " + // "You received this badge because you have won the Hippo Boss award 5 or more times." + // "</div><div onmouseout=\"var theDiv = document.getElementById('div5');theDiv.style.display " + // "= 'none';\" onmouseover=\"var theDiv = document.getElementById('div5');theDiv.style.display " + // "= 'block';\" style=\"margin-right: 10px;margin-bottom: 10px;width: 72px; height: 50px; float: " + // "left;background-image: url('NewImages/HippoBronzeBadge.png');\">" + num.ToString() + "</div></div>"; // } // if (dv.Count >= 10) // { // num = dv.Count / 10; // remainder = dv.Count - num * 10; // lit.Text += "<div style=\"position: relative;float: left;\"><div id=\"div10\" style=\"z-index: 10000;left: 55px; top: -50px;" + // "padding: 10px;position: absolute;display: " + // "none;background-color: white; width: 150px; border: solid 3px #09718F;\"><b>The Silver Hippo:</b> " + // "You received this badge because you have won the Hippo Boss award 10 or more times." + // "</div><div onmouseout=\"var theDiv = document.getElementById('div10');theDiv.style.display " + // "= 'none';\" onmouseover=\"var theDiv = document.getElementById('div10');theDiv.style.display " + // "= 'block';\" style=\"margin-right: 10px;margin-bottom: 10px;width: 72px; height: 50px; float: " + // "left;background-image: url('NewImages/HippoSilverBadge.png');\">" + num.ToString() + "</div></div>"; // } // if (dv.Count >= 20) // { // num = dv.Count / 20; // remainder = dv.Count - num * 20; // lit.Text += "<div style=\"position: relative;float: left;\"><div id=\"div20\" style=\"z-index: 10000;left: 55px; top: -50px;" + // "padding: 10px;position: absolute;display: "+ // "none;background-color: white; width: 150px; border: solid 3px #09718F;\"><b>The Golden Hippo:</b> " + // "You received this badge because you have won the Hippo Boss award 20 or more times."+ // "</div><div onmouseout=\"var theDiv = document.getElementById('div20');theDiv.style.display "+ // "= 'none';\" onmouseover=\"var theDiv = document.getElementById('div20');theDiv.style.display "+ // "= 'block';\" style=\"margin-right: 10px;margin-bottom: 10px;width: 72px; height: 50px; float: "+ // "left;background-image: url('NewImages/HippoGoldBadge.png');\">" + num.ToString() + "</div></div>"; // } // dv.RowFilter = "IsGlobal = 'True'"; // if (dv.Count != 0) // { // lit.Text += "<div style=\"position: relative;float: left;\"><div id=\"divG\" style=\"z-index: 10000;left: 55px; top: -50px;" + // "padding: 10px;position: absolute;display: " + // "none;background-color: white; width: 150px; border: solid 3px #09718F;\"><b>The Global Hippo:</b> " + // "You received this badge because you have won the Hippo Boss award globally, not just in your location." + // "</div><div onmouseout=\"var theDiv = document.getElementById('divG');theDiv.style.display " + // "= 'none';\" onmouseover=\"var theDiv = document.getElementById('divG');theDiv.style.display " + // "= 'block';\" style=\"margin-right: 10px;margin-bottom: 10px;width: 72px; height: 50px; float: " + // "left;background-image: url('NewImages/HippoGlobalBadge.png');\">" + dv.Count.ToString() + "</div></div>"; // } // BadgesPanel.Controls.Add(lit); // } //} protected int AddMessages(DataSet ds, ref ArrayList a, bool areSent) { //Mode 4,5: venue,event changes request //Mode 2: Friend request HttpCookie cookie = Request.Cookies["BrowserDate"]; string message = ""; try { int itemCount = 0; int times = 1; int unreadCount = 0; Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); Panel barAllPanel = new Panel(); barAllPanel.ID = "barAllPanel"; barAllPanel.Width = 532; Telerik.Web.UI.RadPanelBar bar = new Telerik.Web.UI.RadPanelBar(); bar.CssClass = "MessagesRadPanel"; bar.ExpandAnimation.Type = Telerik.Web.UI.AnimationType.Linear; bar.ExpandAnimation.Duration = 50; bar.AllowCollapseAllItems = true; bar.ExpandMode = Telerik.Web.UI.PanelBarExpandMode.SingleExpandedItem; bar.Width = 532; Panel checksPanel = new Panel(); int replyMessagesCount = 0; Literal barLit; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { message = ds.Tables[0].Rows[i]["ID"].ToString(); if (itemCount == 20 * times) { barLit = new Literal(); barLit.Text = "<div>"; barAllPanel.Controls.AddAt(0, barLit); barLit = new Literal(); barLit.Text = "</div>"; barAllPanel.Controls.Add(barLit); a.Add(barAllPanel); barAllPanel = new Panel(); barAllPanel.Width = 532; times++; } itemCount++; bar = new Telerik.Web.UI.RadPanelBar(); bar.CollapseAnimation.Duration = 50; bar.CollapseAnimation.Type = Telerik.Web.UI.AnimationType.None; bar.ExpandAnimation.Duration = 50; bar.ExpandAnimation.Type = Telerik.Web.UI.AnimationType.None; bar.ID = "B" + ds.Tables[0].Rows[i]["ID"].ToString(); bar.CssClass = "MessagesRadPanel"; bar.AllowCollapseAllItems = true; bar.ExpandMode = Telerik.Web.UI.PanelBarExpandMode.SingleExpandedItem; bar.Width = 510; if (!areSent) { bar.ItemClick += new Telerik.Web.UI.RadPanelBarEventHandler(ServerMarkRead); } Telerik.Web.UI.RadPanelItem item = new Telerik.Web.UI.RadPanelItem(); item.BackColor = System.Drawing.Color.White; item.CssClass = "OneMessage"; item.SelectedCssClass = "OneMessageSelected"; CheckBox check = new CheckBox(); if (!areSent) check.ID = "X" + ds.Tables[0].Rows[i]["ID"].ToString(); else check.ID = "XS" + ds.Tables[0].Rows[i]["ID"].ToString(); check.AutoPostBack = true; //check.CheckedChanged += new EventHandler(check_CheckedChanged); Literal lit32 = new Literal(); #region Mark If Read if (!areSent) { if (!bool.Parse(ds.Tables[0].Rows[i]["Read"].ToString())) { bar.Attributes.Add("onclick", "MakeUnBold('divID" + i.ToString() + "')"); item.Text = "<div id=\"divID" + i.ToString() + "\" style=\"font-weight: bold; " + "background-color: white;\"><div style=\"float: left;\">From: <span class=\"NavyLink12\">" + ds.Tables[0].Rows[i]["UserName"].ToString() + "</span> Subject: </div><div style=\"" + "width: 180px; text-wrap: true; float: left;\">" + ds.Tables[0].Rows[i]["MessageSubject"].ToString() + "</div><div style=\"float: right; margin-right: 8px;\">" + DateTime.Parse(ds.Tables[0].Rows[i]["Date"].ToString()).ToShortDateString() + " " + DateTime.Parse(ds.Tables[0].Rows[i]["Date"].ToString()).ToShortTimeString() + "</div></div>"; item.Value = ds.Tables[0].Rows[i]["ID"].ToString(); } else { item.Text = "<div style=\"float: left;background-color: white;\">" + "From: <span class=\"NavyLink12\">" + ds.Tables[0].Rows[i]["UserName"].ToString() + "</span> Subject: </div><div style=\"" + "width: 180px; text-wrap: true; float: left;\">" + ds.Tables[0].Rows[i]["MessageSubject"].ToString() + "</div><div style=\"float: right; margin-right: 8px;\">" + DateTime.Parse(ds.Tables[0].Rows[i]["Date"].ToString()).ToShortDateString() + " " + DateTime.Parse(ds.Tables[0].Rows[i]["Date"].ToString()).ToShortTimeString() + "</div>"; item.Value = ds.Tables[0].Rows[i]["ID"].ToString(); } } else { item.Text = "<div style=\"float: left;background-color: white;\">" + "To: <span class=\"NavyLink12\">" + ds.Tables[0].Rows[i]["UserName"].ToString() + "</span> Subject: </div><div style=\"width: 180px;text-wrap: true; float: left;\">" + ds.Tables[0].Rows[i]["MessageSubject"].ToString() + "</div><div style=\"float: right; margin-right: 8px;\">" + DateTime.Parse(ds.Tables[0].Rows[i]["Date"].ToString()).ToShortDateString() + " " + DateTime.Parse(ds.Tables[0].Rows[i]["Date"].ToString()).ToShortTimeString() + "</div>"; item.Value = ds.Tables[0].Rows[i]["ID"].ToString(); } #endregion #region Create Delete Button item.Expanded = false; Telerik.Web.UI.RadPanelItem item2 = new Telerik.Web.UI.RadPanelItem(); item2.BackColor = System.Drawing.Color.White; item2.CssClass = "OneMessageContent"; Panel panel = new Panel(); panel.ID = "RadPanel" + ds.Tables[0].Rows[i]["ID"].ToString(); Literal wrapLit = new Literal(); wrapLit.Text = "<div class=\"topDiv\" style=\"background-color: white;min-height: 180px; overflow:hidden;\">" + "<div style=\"width: 100%;\"><div align=\"right\" style=\" padding-bottom: 10px;padding-right: 22px; display: block;\">"; panel.Controls.Add(wrapLit); #endregion #region Construct Message Content wrapLit = new Literal(); wrapLit.Text = "</div></div><div class=\"topDiv\" style=\"width: 100%; display: block;\"><div style=\"float: left;\"> "; panel.Controls.Add(wrapLit); Label theMessage = new Label(); theMessage.BackColor = System.Drawing.Color.White; theMessage.CssClass = "OneMessageContent"; theMessage.Width = 280; theMessage.Text = ds.Tables[0].Rows[i]["MessageContent"].ToString(); string groupID = ""; DataSet dsEvent = new DataSet(); DataSet dsSentUser = new DataSet(); //if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4") //{ // string abc = ds.Tables[0].Rows[i]["MessageContent"].ToString(); // string [] delimeter = {",UserID:"}; // string[] thetokens = abc.Replace("EventID:", "").Split(delimeter, StringSplitOptions.None); // string[] delimeter2 = { ",RevisionID:" }; // string[] thetokens2 = thetokens[1].Split(delimeter2, StringSplitOptions.None); // dsSentUser = dat.GetData("SELECT * FROM Users WHERE User_ID="+thetokens2[0]); // dsEvent = dat.GetData("SELECT * FROM Events WHERE ID="+thetokens[0]); // theMessage.Text = "Hello from HippoHappenings,<br/><br/> The user <a href=\"" + dat.MakeNiceName(dsSentUser.Tables[0].Rows[0]["UserName"].ToString()) + "_Friend\" class=\"Green12LinkNF\">" + // dsSentUser.Tables[0].Rows[0]["UserName"].ToString() + "</a> has requested to make a " + // "change to the event '" + dsEvent.Tables[0].Rows[0]["Header"].ToString() + // "'.<br/>Click <a class=\"NavyLink12\" href=\"" + dat.MakeNiceName(dsEvent.Tables[0].Rows[0]["Header"].ToString()) + // "_" + thetokens[0] + "_Event\">here</a> to view this event. <br/> <br/> We must fully stress that if you do not either accept or reject ALL the requested chanes " + // "within <span class=\"NavyLink\" style=\"font-weight: bold;\">4 days</span>, your ownership of this event will be waived and taken over by someone else willing to be the moderator for this event." + // "<br/>For each one of the changes which you accept, please select 'Accept Changes' on the right. If no changes are listed on the right, this means " + // "the user chose to only add media (songs/videos/pictues) or add new categories which have been automatically added to the event."; //} //else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "5") //{ // //VenueID:90,UserID:40,RevisionID:90 // string abc = ds.Tables[0].Rows[i]["MessageContent"].ToString(); // string[] delimeter = { ",UserID:" }; // string[] thetokens = abc.Replace("VenueID:", "").Split(delimeter, StringSplitOptions.None); // string[] delimeter2 = { ",RevisionID:" }; // string[] thetokens2 = thetokens[1].Split(delimeter2, StringSplitOptions.None); // dsSentUser = dat.GetData("SELECT * FROM Users WHERE User_ID=" + thetokens2[0]); // string fromUserName = dsSentUser.Tables[0].Rows[0]["UserName"].ToString(); // dsEvent = dat.GetData("SELECT * FROM Venues WHERE ID=" + thetokens[0]); // string eventName = dsEvent.Tables[0].Rows[0]["Name"].ToString(); // theMessage.Text = "Hello from HippoHappenings,<br/><br/> The user <a href=\"" + dat.MakeNiceName(fromUserName) + "_Friend\" class=\"Green12LinkNF\">" + // fromUserName + "</a> has requested to make a " + // "change to the venue '" + eventName + // "'.<br/>Click <a class=\"NavyLink12\" href=\"" + dat.MakeNiceName(eventName) + "_" + thetokens[0] + "_Venue\">here</a> to view this venue.<br/> <br/> We must fully stress that if you do not either accept or reject ALL the requested chanes " + // "within <span class=\"NavyLink\" style=\"font-weight: bold;\">7 days</span>, your ownership of this event will be waived and taken over by someone else willing to be the moderator for this event." + // "<br/>For each one of the changes, please select 'Accept' or 'Reject'. If no changes are listed on the right, this means " + // "the user chose to only add media (videos/pictues) which have been automatically added to the venue."; //} if (ds.Tables[0].Rows[i]["From_UserID"].ToString() == dat.HIPPOHAPP_USERID.ToString() && theMessage.Text.Contains("My Preferences")) { theMessage.Text = theMessage.Text.Replace("<a class=\"NavyLink12\" href=\"UserPreferences.aspx\">My Preferences</a>.", ""); Literal theLit = new Literal(); theLit.Text = "<div class=\"OneMessageContent\">" + theMessage.Text + "<div style=\"cursor: pointer;\" onclick=\"SelectPreferences();\" class=\"NavyLink12\">My Preferences</div></div>"; panel.Controls.Add(theLit); } else { panel.Controls.Add(theMessage); } wrapLit = new Literal(); wrapLit.Text = "</div>"; panel.Controls.Add(wrapLit); if (!bool.Parse(ds.Tables[0].Rows[i]["Read"].ToString())) unreadCount++; if (ds.Tables[0].Rows[i]["Mode"].ToString() == "2") { DataSet ds3 = dat.GetData("SELECT * FROM User_Friends WHERE UserID=" + Session["User"].ToString() + " AND FriendID=" + ds.Tables[0].Rows[i]["From_UserID"].ToString()); bool hasFriend = false; if (ds3.Tables.Count > 0) if (ds3.Tables[0].Rows.Count > 0) hasFriend = true; else hasFriend = false; else hasFriend = false; if (!areSent) { if (!hasFriend) { lit32 = new Literal(); lit32.Text = "<div style=\"float: left;\">"; panel.Controls.Add(lit32); Panel wrapPanel = new Panel(); wrapPanel.ID = "acceptWrap" + ds.Tables[0].Rows[i]["ID"].ToString(); ASP.controls_bluebutton_ascx img = new ASP.controls_bluebutton_ascx(); img.BUTTON_TEXT = "Accept Friend"; img.COMMAND_ARGS = ds.Tables[0].Rows[i]["ID"].ToString() + "accept" + ds.Tables[0].Rows[i]["From_UserID"].ToString(); img.WIDTH = "100px"; wrapPanel.Controls.Add(img); panel.Controls.Add(wrapPanel); img.CLIENT_LINK_CLICK = "setWait(event);"; img.SERVER_CLICK += ServerAcceptFriend; lit32 = new Literal(); lit32.Text = "</div>"; panel.Controls.Add(lit32); } else { Literal lit = new Literal(); lit.Text = "<div style=\"float: right; width: 220px;height: 30px; margin: 5px;\" class=\"Green12LinkNF\">You have accepted this gal/guy as a friend! Good luck, you two!</div>"; panel.Controls.Add(lit); } } else { if (!hasFriend) { Literal lit = new Literal(); lit.Text = "<div style=\"float: right; width: 220px;height: 30px; margin: 5px;\" class=\"Green12LinkNF\">You are still waiting for a response from this user!</div>"; panel.Controls.Add(lit); } else { Literal lit = new Literal(); lit.Text = "<div style=\"float: right; width: 220px;height: 30px; margin: 5px;\" class=\"Green12LinkNF\">Your friend has already accepted your invitation!</div>"; panel.Controls.Add(lit); } } } //else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4" || // ds.Tables[0].Rows[i]["Mode"].ToString() == "5") //{ // string abc = ds.Tables[0].Rows[i]["MessageContent"].ToString(); // string [] delimeter = {",UserID:"}; // string temp = "VenueID:"; // if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4") // temp = "EventID:"; // string [] thetokens = abc.Replace(temp, "").Split(delimeter, StringSplitOptions.None); // string[] delimeter2 = { ",RevisionID:" }; // string[] thetokens2 = thetokens[1].Split(delimeter2, StringSplitOptions.None); // string temp2 = ""; // if (thetokens2[1].Trim() != "") // { // temp = "VenueRevisions"; // if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4") // temp = "EventRevisions"; // DataSet dsChanges = dat.GetData("SELECT * FROM " + temp + " WHERE ID=" + thetokens2[1]); // if (dsChanges.Tables[0].Rows.Count > 0) // { // temp = "Venues"; // if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4") // temp = "Events"; // temp2 = "VenueID"; // if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4") // temp2 = "EventID"; // DataSet dsEvent2 = dat.GetData("SELECT * FROM " + temp + " WHERE ID=" + dsChanges.Tables[0].Rows[0][temp2].ToString()); // Literal theLit = new Literal(); // theLit.Text = "<table style=\"margin-right: 10px;margin-bottom: 20px;border: solid 1px #dedbdb;\"><tr><td>"; // panel.Controls.Add(theLit); // int count = 1; // string tempstr = "<div class=\"topDiv\"><hr color=\"#dedbdb\" size=\"1\" width=\"100%\"/></div></td></tr><tr><td>"; // int tempInt = 9; // if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4") // tempInt = 12; // for (int n = 0; n < tempInt; n++) // { // InsertRevision(ref item2, dsChanges, n, tempstr, ref count, ds, i); // } // if (ds.Tables[0].Rows[i]["Mode"].ToString() == "5") // { // CategoryChanges(ref item2, thetokens2, ref count, tempstr, true); // } // if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4") // { // EventOccuranceChanges(ref item2, ref count, thetokens2, tempstr); // CategoryChanges(ref item2, thetokens2, ref count, tempstr, false); // } // theLit = new Literal(); // theLit.Text = "</td></tr></table>"; // panel.Controls.Add(theLit); // } // } //} else { if (!areSent) { if (ds.Tables[0].Rows[i]["From_UserID"].ToString() == dat.HIPPOHAPP_USERID.ToString()) { } else { //Insert ability to reply to message Literal lit = new Literal(); lit.Text = "<div style=\"width: 220px; float: right;\" >"; panel.Controls.Add(lit); TextBox textbox = new TextBox(); textbox.ID = ds.Tables[0].Rows[i]["From_UserID"].ToString() + "textbox" + ds.Tables[0].Rows[i]["ID"].ToString(); textbox.Width = 200; textbox.Height = 100; textbox.TextMode = TextBoxMode.MultiLine; panel.Controls.Add(textbox); lit = new Literal(); lit.Text = "<div style=\"float: left;\">"; panel.Controls.Add(lit); ASP.controls_bluebutton_ascx img = new ASP.controls_bluebutton_ascx(); img.BUTTON_TEXT = "Reply"; img.WIDTH = "57px"; img.COMMAND_ARGS = ds.Tables[0].Rows[i]["From_UserID"].ToString() + "reply" + ds.Tables[0].Rows[i]["ID"].ToString(); panel.Controls.Add(img); img.CLIENT_LINK_CLICK = "setWait(event);"; img.SERVER_CLICK += ServerReply; lit = new Literal(); lit.Text = "</div></div>"; panel.Controls.Add(lit); replyMessagesCount++; } } } wrapLit = new Literal(); wrapLit.Text = "</div></div>"; panel.Controls.Add(wrapLit); UpdatePanel theUpdate = new UpdatePanel(); theUpdate.UpdateMode = UpdatePanelUpdateMode.Conditional; theUpdate.ContentTemplateContainer.Controls.Add(panel); item2.Controls.Add(theUpdate); item.Items.Add(item2); bar.Items.Add(item); barLit = new Literal(); barLit.Text = "<div class=\"topDiv\" style=\"clear: both;border-left: solid 1px #dedbdb;\"><div style=\"float: left;border-top: solid 1px #dedbdb;\">"; barAllPanel.Controls.Add(barLit); barAllPanel.Controls.Add(check); barLit = new Literal(); barLit.Text = "</div><div style=\"float: left;\">"; barAllPanel.Controls.Add(barLit); barAllPanel.Controls.Add(bar); barLit = new Literal(); barLit.Text = "</div></div>"; barAllPanel.Controls.Add(barLit); #endregion } if (ds.Tables[0].Rows.Count % 20 != 0 || ds.Tables[0].Rows.Count == 20) { if (!areSent) { bar.ItemClick += new Telerik.Web.UI.RadPanelBarEventHandler(ServerMarkRead); } barLit = new Literal(); barLit.Text = "<div>"; barAllPanel.Controls.AddAt(0, barLit); barLit = new Literal(); barLit.Text = "</div>"; barAllPanel.Controls.Add(barLit); a.Add(barAllPanel); } return unreadCount; } catch (Exception ex) { UserErrorLabel.Text = ex.ToString() + "<br/>" + message; return 0; } }
//protected void LoadControls_OLD() //{ // Telerik.Web.UI.RadPanelBar MessagePanelBar = new Telerik.Web.UI.RadPanelBar(); // MessagePanelBar.CausesValidation = false; // MessagePanelBar.Width = 560; // MessagePanelBar.ExpandMode = Telerik.Web.UI.PanelBarExpandMode.MultipleExpandedItems; // MessagePanelBar.EnableEmbeddedSkins = false; // MessagePanelBar.ID = "MessagePanelBar1"; // MessagePanelBar.ItemClick += new Telerik.Web.UI.RadPanelBarEventHandler(MarkAsRead); // ClearMessage(); // Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); // DataSet ds = dat.GetData("SELECT * FROM UserMessages WHERE Live='True' AND To_UserID="+ // Session["User"].ToString()+" 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_ascx pagerPanel = new ASP.controls_pager_ascx(); // 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; // 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(MessagePanelBar); // times++; // MessagePanelBar = new Telerik.Web.UI.RadPanelBar(); // MessagePanelBar.CausesValidation = false; // MessagePanelBar.Width = 560; // MessagePanelBar.ExpandMode = Telerik.Web.UI.PanelBarExpandMode.MultipleExpandedItems; // MessagePanelBar.EnableEmbeddedSkins = false; // MessagePanelBar.ID = "MessagePanelBar"+times.ToString(); // MessagePanelBar.ItemClick += new Telerik.Web.UI.RadPanelBarEventHandler(MarkAsRead); // } // 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++; // Telerik.Web.UI.RadPanelItem messageItem = new Telerik.Web.UI.RadPanelItem(); // messageItem.Expanded = false; // messageItem.Height = 45; // messageItem.BorderColor = greyBack; // messageItem.BorderWidth = 1; // messageItem.Attributes.Add("CommandArgument", ds.Tables[0].Rows[i]["ID"].ToString()); // messageItem.Attributes.Add("Read", ds.Tables[0].Rows[i]["Read"].ToString()); // messageItem.BorderStyle = BorderStyle.Solid; // messageItem.BackColor = greyBack; // string theUser = dsUsers.Tables[0].Rows[0]["UserName"].ToString(); // if (ds.Tables[0].Rows[i]["Mode"].ToString() == "1") // { // theUser = "******"; // } // string boldOrNot = "font-size: 12px;"; // if (!bool.Parse(ds.Tables[0].Rows[i]["Read"].ToString())) // boldOrNot = "font-weight:bold;font-size: 14px;"; // messageItem.Text = "<table width=\"560px\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><span style=\"padding-left:5px;font-family:Arial;color: #cccccc; " + // boldOrNot + "\">From: </span><span style=\"" + boldOrNot + "color: #1fb6e7; font-family: Arial;\">" + theUser // + "</span></td><td><span style=\"padding-top:10px;font-family:Arial;" + // boldOrNot + "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;" + boldOrNot + "color: #cccccc;padding-left: 5px;\">Subject: " // + ds.Tables[0].Rows[i]["MessageSubject"].ToString() + // "</span></td></tr></table>"; // messageItem.ForeColor = greyText; // ASP.controls_usermessage_ascx message = new ASP.controls_usermessage_ascx(); // message.myEvent += new ASP.controls_usermessage_ascx.EventDelegate(this_OnProgress); // message.ID = "message" + i.ToString(); // message.MESSAGE_TEXT = ds.Tables[0].Rows[i]["MessageContent"].ToString(); // message.SUBJECT_TEXT = ds.Tables[0].Rows[i]["MessageSubject"].ToString(); // message.TO_ID = int.Parse(ds.Tables[0].Rows[i]["To_UserID"].ToString()); // message.FROM_ID = int.Parse(ds.Tables[0].Rows[i]["From_UserID"].ToString()); // message.DATE = ds.Tables[0].Rows[i]["Date"].ToString(); // message.MESSAGE_ID = int.Parse(ds.Tables[0].Rows[i]["ID"].ToString()); // message.CONTROL_ID = i; // if (ds.Tables[0].Rows[i]["Mode"].ToString() == "1") // message.MODE = Controls_UserMessage.Mode.HippoRequest; // else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "2") // message.MODE = Controls_UserMessage.Mode.HippoReply; // Telerik.Web.UI.RadPanelItem subItem = new Telerik.Web.UI.RadPanelItem(); // subItem.Controls.Add(message); // messageItem.Items.Add(subItem); // MessagePanelBar.Items.Add(messageItem); // //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(MessagePanelBar); // } // } // pagerPanel.DATA = a; // pagerPanel.DataBind2(); // Label label = new Label(); // string temp = "messages"; // if (ds.Tables[0].Rows.Count == 1) // temp = "message"; // 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>"; // MessagesPanel.Controls.Clear(); // MessagesPanel.Controls.Add(label); // MessagesPanel.Controls.Add(pagerPanel); //} protected int AddMessages(DataSet ds, ref ArrayList a, bool areSent) { //Mode 4,5: venue,event changes request //Mode 2: Friend request HttpCookie cookie = Request.Cookies["BrowserDate"]; string message = ""; try { int itemCount = 0; int times = 1; int unreadCount = 0; Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); Telerik.Web.UI.RadPanelBar bar = new Telerik.Web.UI.RadPanelBar(); bar.BorderColor = greyBorder; bar.BorderWidth = 3; bar.ExpandAnimation.Type = Telerik.Web.UI.AnimationType.Linear; bar.ExpandAnimation.Duration = 50; bar.AllowCollapseAllItems = true; bar.ExpandMode = Telerik.Web.UI.PanelBarExpandMode.SingleExpandedItem; bar.Width = 570; int replyMessagesCount = 0; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { message = ds.Tables[0].Rows[i]["ID"].ToString(); if (itemCount == 20 * times) { if (!areSent) { bar.ItemClick += new Telerik.Web.UI.RadPanelBarEventHandler(ServerMarkRead); } a.Add(bar); bar = new Telerik.Web.UI.RadPanelBar(); bar.BorderColor = greyBorder; bar.BorderWidth = 3; bar.ExpandAnimation.Type = Telerik.Web.UI.AnimationType.Linear; bar.ExpandAnimation.Duration = 50; bar.AllowCollapseAllItems = true; bar.ExpandMode = Telerik.Web.UI.PanelBarExpandMode.SingleExpandedItem; bar.Width = 570; times++; } itemCount++; Telerik.Web.UI.RadPanelItem item = new Telerik.Web.UI.RadPanelItem(); item.BackColor = greyDark; item.CssClass = "OneMessage"; item.SelectedCssClass = "OneMessageSelected"; #region Mark If Read if (!areSent) { if (!bool.Parse(ds.Tables[0].Rows[i]["Read"].ToString())) { item.Text = "<div id=\"divID" + i.ToString() + "\" style=\"font-weight: bold; color: White;\"><div style=\"float: left;\">From: <span class=\"AddLinkNotBold\">" + ds.Tables[0].Rows[i]["UserName"].ToString() + "</span> Subject: </div><div style=\"" + "width: 200px; text-wrap: true; float: left;\">" + ds.Tables[0].Rows[i]["MessageSubject"].ToString() + "</div><div style=\"float: right; margin-right: 8px;\">" + ds.Tables[0].Rows[i]["Date"].ToString() + "</div></div>"; item.Value = ds.Tables[0].Rows[i]["ID"].ToString(); } else { item.Text = "<div style=\"float: left; color: #cccccc;\">From: <span class=\"AddLinkNotBold\">" + ds.Tables[0].Rows[i]["UserName"].ToString() + "</span> Subject: </div><div style=\"" + "width: 200px; color: #cccccc; text-wrap: true; float: left;\">" + ds.Tables[0].Rows[i]["MessageSubject"].ToString() + "</div><div style=\"float: right; margin-right: 8px; color: #cccccc;\">" + ds.Tables[0].Rows[i]["Date"].ToString() + "</div>"; item.Value = ds.Tables[0].Rows[i]["ID"].ToString(); } } else { item.Text = "<div style=\"float: left; color: #cccccc;\">To: <span class=\"AddLinkNotBold\">" + ds.Tables[0].Rows[i]["UserName"].ToString() + "</span> Subject: </div><div style=\"width: 200px; color: #cccccc;text-wrap: true; float: left;\">" + ds.Tables[0].Rows[i]["MessageSubject"].ToString() + "</div><div style=\"float: right; margin-right: 8px; color: #cccccc;\">" + ds.Tables[0].Rows[i]["Date"].ToString() + "</div>"; item.Value = ds.Tables[0].Rows[i]["ID"].ToString(); } #endregion #region Create Delete Button item.Expanded = false; Telerik.Web.UI.RadPanelItem item2 = new Telerik.Web.UI.RadPanelItem(); item2.BackColor = greyDark; item2.CssClass = "OneMessageContent"; Literal wrapLit = new Literal(); wrapLit.Text = "<div class=\"topDiv\" style=\"min-height: 200px; overflow:hidden;\">" + "<div style=\"width: 100%;\"><div align=\"right\" style=\" padding-bottom: 10px;padding-right: 22px; display: block;\">"; item2.Controls.Add(wrapLit); ImageButton xIt = new ImageButton(); xIt.ID = ds.Tables[0].Rows[i]["From_UserID"].ToString() + "X" + i.ToString(); xIt.Width = 16; xIt.Height = 16; xIt.ImageUrl = "~/image/X.png"; xIt.AlternateText = "Delete Message"; xIt.ToolTip = "Delete Message"; xIt.CommandArgument = ds.Tables[0].Rows[i]["ID"].ToString(); xIt.Click += new ImageClickEventHandler(ServerDeleteMessage); //xIt.Attributes.Add("onserverclick", "ServerDeleteMessage"); xIt.Attributes.Add("onmouseover", "this.src = 'image/XSelected.png';"); xIt.Attributes.Add("onmouseout", "this.src = 'image/X.png';"); xIt.OnClientClick = "return confirm('Do you want to delete this message?');"; item2.Controls.Add(xIt); #endregion #region Construct Message Content wrapLit = new Literal(); wrapLit.Text = "</div></div><div style=\"width: 100%; display: block;\"><div style=\"float: left;\"> "; item2.Controls.Add(wrapLit); Label theMessage = new Label(); theMessage.BackColor = greyDark; theMessage.CssClass = "OneMessageContent"; theMessage.Width = 300; theMessage.Text = ds.Tables[0].Rows[i]["MessageContent"].ToString(); string groupID = ""; DataSet dsEvent = new DataSet(); DataSet dsSentUser = new DataSet(); if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4") { string abc = ds.Tables[0].Rows[i]["MessageContent"].ToString(); string [] delimeter = {",UserID:"}; string[] thetokens = abc.Replace("EventID:", "").Split(delimeter, StringSplitOptions.None); string[] delimeter2 = { ",RevisionID:" }; string[] thetokens2 = thetokens[1].Split(delimeter2, StringSplitOptions.None); dsSentUser = dat.GetData("SELECT * FROM Users WHERE User_ID="+thetokens2[0]); dsEvent = dat.GetData("SELECT * FROM Events WHERE ID="+thetokens[0]); theMessage.Text = "Hello from HippoHappenings,<br/><br/> The user <a href=\"" + dat.MakeNiceName(dsSentUser.Tables[0].Rows[0]["UserName"].ToString()) + "_Friend\" class=\"AddGreenLink\">" + dsSentUser.Tables[0].Rows[0]["UserName"].ToString() + "</a> has requested to make a " + "change to the event '" + dsEvent.Tables[0].Rows[0]["Header"].ToString() + "'.<br/>Click <a class=\"AddLink\" href=\"" + dat.MakeNiceName(dsEvent.Tables[0].Rows[0]["Header"].ToString()) + "_" + thetokens[0] + "_Event\">here</a> to view this event. <br/> <br/> We must fully stress that if you do not either accept or reject ALL the requested chanes " + "within <span style=\"color: #ff7704; font-weight: bold;\">4 days</span>, your ownership of this event will be waived and taken over by someone else willing to be the moderator for this event." + "<br/>For each one of the changes which you accept, please select 'Accept Changes' on the right. If no changes are listed on the right, this means " + "the user chose to only add media (songs/videos/pictues) or add new categories which have been automatically added to the event."; } else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "5") { //VenueID:90,UserID:40,RevisionID:90 string abc = ds.Tables[0].Rows[i]["MessageContent"].ToString(); string[] delimeter = { ",UserID:" }; string[] thetokens = abc.Replace("VenueID:", "").Split(delimeter, StringSplitOptions.None); string[] delimeter2 = { ",RevisionID:" }; string[] thetokens2 = thetokens[1].Split(delimeter2, StringSplitOptions.None); dsSentUser = dat.GetData("SELECT * FROM Users WHERE User_ID=" + thetokens2[0]); string fromUserName = dsSentUser.Tables[0].Rows[0]["UserName"].ToString(); dsEvent = dat.GetData("SELECT * FROM Venues WHERE ID=" + thetokens[0]); string eventName = dsEvent.Tables[0].Rows[0]["Name"].ToString(); theMessage.Text = "Hello from HippoHappenings,<br/><br/> The user <a href=\"" + dat.MakeNiceName(fromUserName) + "_Friend\" class=\"AddGreenLink\">" + fromUserName + "</a> has requested to make a " + "change to the venue '" + eventName + "'.<br/>Click <a class=\"AddLink\" href=\"" + dat.MakeNiceName(eventName) + "_" + thetokens[0] + "_Venue\">here</a> to view this venue.<br/> <br/> We must fully stress that if you do not either accept or reject ALL the requested chanes " + "within <span style=\"color: #ff7704; font-weight: bold;\">7 days</span>, your ownership of this event will be waived and taken over by someone else willing to be the moderator for this event." + "<br/>For each one of the changes, please select 'Accept' or 'Reject'. If no changes are listed on the right, this means " + "the user chose to only add media (videos/pictues) which have been automatically added to the venue."; } else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "7" || ds.Tables[0].Rows[i]["Mode"].ToString() == "9") { string usethis = ds.Tables[0].Rows[i]["MessageContent"].ToString(); char ab = usethis[0]; groupID = ab.ToString(); int next = 1; ab = usethis[next]; groupID += ab.ToString(); while(ab != ' ') { ab = usethis[++next]; groupID += ab.ToString(); } theMessage.Text = usethis.Substring(next); } else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "8") { string usethis = ds.Tables[0].Rows[i]["MessageContent"].ToString(); char ab = usethis[0]; groupID = ab.ToString(); int next = 1; ab = usethis[next]; groupID += ab.ToString(); while (ab != ' ') { ab = usethis[++next]; groupID += ab.ToString(); } DataView dvU = dat.GetDataDV("SELECT * FROM Users WHERE User_ID=" + ds.Tables[0].Rows[i]["From_UserID"].ToString()); DataView dvG = dat.GetDataDV("SELECT * FROM Groups WHERE ID=" + groupID); theMessage.Text = "The user <a class=\"AddLink\" href=\"" + dvU[0]["UserName"].ToString() + "_Friend\">" + dvU[0]["UserName"].ToString() + "</a> has requested to join the group '" + dvG[0]["Header"].ToString() + "'. Here is their message: <br/>" + usethis.Substring(next); } if (ds.Tables[0].Rows[i]["From_UserID"].ToString() == dat.HIPPOHAPP_USERID.ToString() && theMessage.Text.Contains("My Preferences")) { theMessage.Text = theMessage.Text.Replace("<a class=\"AddLink\" href=\"UserPreferences.aspx\">My Preferences</a>.", ""); Literal theLit = new Literal(); theLit.Text = "<div class=\"OneMessageContent\">" + theMessage.Text + "<div style=\"cursor: pointer;\" onclick=\"SelectPreferences();\" class=\"AddLink\">My Preferences</div></div>"; item2.Controls.Add(theLit); } else { item2.Controls.Add(theMessage); } wrapLit = new Literal(); wrapLit.Text = "</div>"; item2.Controls.Add(wrapLit); if (!bool.Parse(ds.Tables[0].Rows[i]["Read"].ToString())) unreadCount++; if (ds.Tables[0].Rows[i]["Mode"].ToString() == "2") { DataSet ds3 = dat.GetData("SELECT * FROM User_Friends WHERE UserID=" + Session["User"].ToString() + " AND FriendID=" + ds.Tables[0].Rows[i]["From_UserID"].ToString()); bool hasFriend = false; if (ds3.Tables.Count > 0) if (ds3.Tables[0].Rows.Count > 0) hasFriend = true; else hasFriend = false; else hasFriend = false; if (!areSent) { if (!hasFriend) { HtmlButton img = new HtmlButton(); img.ID = ds.Tables[0].Rows[i]["From_UserID"].ToString() + "accept" + i.ToString(); img.Style.Value = "margin-top: 20px; margin-left: 50px;padding-bottom: 4px;height: 30px; width: 112px;background-color: transparent; " + "color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat: " + "no-repeat; border: 0;"; img.ServerClick += new EventHandler(ServerAcceptFriend); img.Attributes.Add("onmouseover", "this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';"); img.Attributes.Add("onmouseout", "this.style.backgroundImage = 'url(image/PostButtonNoPost.png)';"); img.Attributes.Add("onclick", "this.innerHTML = 'Working...';this.disabled=true;this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';"); img.InnerText = "Accept Friend"; item2.Controls.Add(img); } else { Literal lit = new Literal(); lit.Text = "<div style=\"float: right; width: 220px;height: 30px; margin: 5px;\" class=\"AddGreenLink\">You have accepted this gal/guy as a friend! Good luck, you two!</div>"; item2.Controls.Add(lit); } } else { if (!hasFriend) { Literal lit = new Literal(); lit.Text = "<div style=\"float: right; width: 220px;height: 30px; margin: 5px;\" class=\"AddGreenLink\">You are still waiting for a response from this user!</div>"; item2.Controls.Add(lit); } else { Literal lit = new Literal(); lit.Text = "<div style=\"float: right; width: 220px;height: 30px; margin: 5px;\" class=\"AddGreenLink\">Your friend has already accepted your invitation!</div>"; item2.Controls.Add(lit); } } } else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4" || ds.Tables[0].Rows[i]["Mode"].ToString() == "5") { string abc = ds.Tables[0].Rows[i]["MessageContent"].ToString(); string [] delimeter = {",UserID:"}; string temp = "VenueID:"; if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4") temp = "EventID:"; string [] thetokens = abc.Replace(temp, "").Split(delimeter, StringSplitOptions.None); string[] delimeter2 = { ",RevisionID:" }; string[] thetokens2 = thetokens[1].Split(delimeter2, StringSplitOptions.None); string temp2 = ""; if (thetokens2[1].Trim() != "") { temp = "VenueRevisions"; if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4") temp = "EventRevisions"; DataSet dsChanges = dat.GetData("SELECT * FROM " + temp + " WHERE ID=" + thetokens2[1]); if (dsChanges.Tables[0].Rows.Count > 0) { temp = "Venues"; if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4") temp = "Events"; temp2 = "VenueID"; if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4") temp2 = "EventID"; DataSet dsEvent2 = dat.GetData("SELECT * FROM " + temp + " WHERE ID=" + dsChanges.Tables[0].Rows[0][temp2].ToString()); Literal theLit = new Literal(); theLit.Text = "<table style=\"margin-right: 10px;margin-bottom: 20px;color: #cccccc;border: solid 1px #1fb6e7;\"><tr><td>"; item2.Controls.Add(theLit); int count = 1; string tempstr = "<div class=\"topDiv\"><hr color=\"#1fb6e7\" size=\"1\" width=\"100%\"/></div></td></tr><tr><td>"; int tempInt = 9; if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4") tempInt = 12; for (int n = 0; n < tempInt; n++) { InsertRevision(ref item2, dsChanges, n, tempstr, ref count, ds, i); } if (ds.Tables[0].Rows[i]["Mode"].ToString() == "5") { CategoryChanges(ref item2, thetokens2, ref count, tempstr, true); } if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4") { EventOccuranceChanges(ref item2, ref count, thetokens2, tempstr); CategoryChanges(ref item2, thetokens2, ref count, tempstr, false); } theLit = new Literal(); theLit.Text = "</td></tr></table>"; item2.Controls.Add(theLit); } } } else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "7") { Literal lit = new Literal(); lit.Text = "<div style=\"width: 220px; float: right;\" >"; item2.Controls.Add(lit); message = "SELECT * FROM Group_Members WHERE MemberID=" + Session["User"].ToString() + " AND GroupID=" + groupID; DataView dvMember = dat.GetDataDV(message); if (dvMember.Count > 0) { if (bool.Parse(dvMember[0]["Accepted"].ToString())) { lit = new Literal(); lit.Text = "<label class=\"AddGreenLink\">You have accepted this membership.</label>"; item2.Controls.Add(lit); } else { HtmlButton img = new HtmlButton(); img.ID = "acceptMembership" + groupID; img.Style.Value = "cursor: pointer;padding-bottom: 4px;height: 30px; width: 112px;background-color: transparent; " + "color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat: " + "no-repeat; border: 0;"; img.ServerClick += new EventHandler(AcceptMembership); img.Attributes.Add("onmouseover", "this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';"); img.Attributes.Add("onmouseout", "this.style.backgroundImage = 'url(image/PostButtonNoPost.png)';"); img.Attributes.Add("onclick", "this.innerHTML = 'Working...';this.disabled=true;this.style.backgroundImage='url(image/PostButtonNoPostHover.png)';"); img.InnerText = "Accept"; item2.Controls.Add(img); } } else { lit = new Literal(); lit.Text = "<label class=\"AddGreenLink\">The invitation no longer stands.</label>"; item2.Controls.Add(lit); } lit = new Literal(); lit.Text = "</div>"; item2.Controls.Add(lit); } else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "8") { Literal lit = new Literal(); lit.Text = "<div style=\"width: 220px; float: right;\" >"; item2.Controls.Add(lit); DataView dvMember = dat.GetDataDV("SELECT * FROM Group_Members WHERE MemberID=" + ds.Tables[0].Rows[i]["From_UserID"].ToString() + " AND GroupID=" + groupID); bool getIt = false; if (dvMember.Count > 0) { if (bool.Parse(dvMember[0]["Accepted"].ToString())) { lit = new Literal(); lit.Text = "<label class=\"AddGreenLink\">You have approved this membership.</label>"; item2.Controls.Add(lit); } else { getIt = true; } } else getIt = true; if(getIt) { HtmlButton img = new HtmlButton(); img.ID = ds.Tables[0].Rows[i]["From_UserID"].ToString() + "acceptMembership" + groupID; img.Style.Value = "cursor: pointer;padding-bottom: 4px;height: 30px; width: 112px;background-color: transparent; " + "color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat: " + "no-repeat; border: 0;"; img.ServerClick += new EventHandler(ApproveMembership); img.Attributes.Add("onmouseover", "this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';"); img.Attributes.Add("onmouseout", "this.style.backgroundImage = 'url(image/PostButtonNoPost.png)';"); img.Attributes.Add("onclick", "this.innerHTML = 'Working...';this.disabled=true;this.style.backgroundImage='url(image/PostButtonNoPostHover.png)';"); img.InnerText = "Approve"; item2.Controls.Add(img); } lit = new Literal(); lit.Text = "</div>"; item2.Controls.Add(lit); } else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "9") { Literal lit = new Literal(); lit.Text = "<div style=\"width: 220px; float: right;\" >"; item2.Controls.Add(lit); DataView dvReoccurr = dat.GetDataDV("SELECT * FROM GroupEvent_Occurance WHERE GroupEventID=" + groupID); string reoccurrID = dvReoccurr[0]["ID"].ToString(); DataView dvMember = dat.GetDataDV("SELECT * FROM GroupEvent_Members WHERE UserID=" + Session["User"].ToString() + " AND GroupEventID=" + groupID + " AND ReoccurrID=" + reoccurrID); bool getIt = false; if (dvMember.Count > 0) { if (dvMember[0]["Accepted"] != null) { if (dvMember[0]["Accepted"].ToString() != "") { if (bool.Parse(dvMember[0]["Accepted"].ToString())) { lit = new Literal(); lit.Text = "<label class=\"AddGreenLink\">You have accepted this invitation.</label>"; item2.Controls.Add(lit); } else { getIt = true; } } else getIt = true; } else getIt = true; } else getIt = true; bool regEnded = HasRegistrationEnded(groupID, reoccurrID); if(getIt) { if (regEnded) { lit = new Literal(); lit.Text = "<label class=\"AddGreenLink\">Registration for this events has ended.</label>"; item2.Controls.Add(lit); } else { HtmlButton img = new HtmlButton(); img.ID = groupID + "acceptInvitation" + reoccurrID; img.Style.Value = "cursor: pointer;padding-bottom: 4px;height: 30px; width: 112px;background-color: transparent; " + "color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat: " + "no-repeat; border: 0;"; img.ServerClick += new EventHandler(AcceptInvitation); img.Attributes.Add("onmouseover", "this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';"); img.Attributes.Add("onmouseout", "this.style.backgroundImage = 'url(image/PostButtonNoPost.png)';"); img.Attributes.Add("onclick", "this.innerHTML = 'Working...';this.disabled=true;this.style.backgroundImage='url(image/PostButtonNoPostHover.png)';"); img.InnerText = "Accept"; item2.Controls.Add(img); } } lit = new Literal(); lit.Text = "</div>"; item2.Controls.Add(lit); } else { if (!areSent) { if (ds.Tables[0].Rows[i]["From_UserID"].ToString() == dat.HIPPOHAPP_USERID.ToString()) { } else { //Insert ability to reply to message Literal lit = new Literal(); lit.Text = "<div style=\"width: 220px; float: right;\" >"; item2.Controls.Add(lit); TextBox textbox = new TextBox(); textbox.ID = ds.Tables[0].Rows[i]["From_UserID"].ToString() + "textbox" + ds.Tables[0].Rows[i]["ID"].ToString(); textbox.Width = 200; textbox.Height = 100; textbox.TextMode = TextBoxMode.MultiLine; item2.Controls.Add(textbox); lit = new Literal(); lit.Text = "<br/><br/><br/>"; item2.Controls.Add(lit); HtmlButton img = new HtmlButton(); img.ID = ds.Tables[0].Rows[i]["From_UserID"].ToString() + "reply" + ds.Tables[0].Rows[i]["ID"].ToString(); img.Style.Value = "cursor: pointer;padding-bottom: 4px;height: 30px; width: 112px;background-color: transparent; " + "color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat: " + "no-repeat; border: 0;"; img.ServerClick += new EventHandler(ServerReply); img.Attributes.Add("onmouseover", "this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';"); img.Attributes.Add("onmouseout", "this.style.backgroundImage = 'url(image/PostButtonNoPost.png)';"); img.Attributes.Add("onclick", "this.innerHTML = 'Working...';this.disabled=true;this.style.backgroundImage='url(image/PostButtonNoPostHover.png)';"); img.InnerText = "Reply"; item2.Controls.Add(img); lit = new Literal(); lit.Text = "</div>"; item2.Controls.Add(lit); replyMessagesCount++; } } } wrapLit = new Literal(); wrapLit.Text = "</div></div>"; item2.Controls.Add(wrapLit); item.Items.Add(item2); bar.Items.Add(item); #endregion } if (ds.Tables[0].Rows.Count % 20 != 0 || ds.Tables[0].Rows.Count == 20) { if (!areSent) { bar.ItemClick += new Telerik.Web.UI.RadPanelBarEventHandler(ServerMarkRead); } a.Add(bar); } return unreadCount; } catch (Exception ex) { UserErrorLabel.Text = ex.ToString() + "<br/>" + message; return 0; } }