public static string GetComments(string id, Page p) { // Shows the comments section for the object. Also shows the replies to the comments. string sql = "Select * from Comments Inner Join Users on Users.ID = Comments.UserID where comments.ParentID = @id order by comments.added"; SqlCommand command = new SqlCommand(sql); command.Parameters.AddWithValue("@id", id); DataTable dt = gData.GetDataTable(command); string sHTML = "<div><h3>Comments:</h3><br>" + "<table style='padding:10px;' width=73%>" + "<tr><th width=14%>User<th width=10%>Added<th width=64%>Comment</tr>"; for (int i = 0; i < dt.Rows.Count; i++) { SavedObject s = RowToObject(dt.Rows[i]); string sUserPic = DataOps.GetAvatar(s.Props.Picture); string sUserName = NotNull(s.Props.UserName); if (sUserName == "") { sUserName = "******"; } string sBody = ReplaceURLs(s.Props.Body); string div = "<tr><td>" + sUserPic + "<br>" + sUserName + "</br></td><td>" + s.Props.Added.ToString() + "</td><td style='border:1px solid lightgrey'><br>" + sBody + "</td></tr>"; sHTML += div; } sHTML += "</table><table width=100%><tr><th colspan=2><h2>Add a Comment:</h2></tr>"; if (!gUser(p).LoggedIn) { sHTML += "<tr><td><font color=red>Sorry, you must be logged in to add a comment.</td></tr></table></div>"; return(sHTML); } string sButtons = "<tr><td>Comment:</td><td><textarea id='txtComment' name='txtComment' rows=10 style='width: 70%;' cols=70></textarea><br><br><button id='btnSaveComment' name='btnSaveComment' value='Save'>Save Comment</button></tr>"; sButtons += "</table></div>"; sHTML += sButtons; return(sHTML); }
public static string GetTweetList(string sUserId, int days, bool fExcludeUser = false) { if (sUserId == "" || sUserId == null) { sUserId = "BAF8C6FE-E1B2-42FB-0000-4A8289A90CA2"; // system user } string sql = "Select * from Tweet left Join Users on Users.ID = Tweet.UserID left join TweetRead on TweetRead.ParentID=Tweet.ID and TweetRead.UserID = '" + sUserId + "' where tweet.added > getdate()-" + days.ToString() + " order by Tweet.Added desc"; DataTable dt = gData.GetDataTable2(sql); string html = "<table class=saved><tr><th>Read?<th width=20%>User</th><th width=20%>Added<th width=50%>Subject"; if (fExcludeUser) { html = "<table class=saved><tr><th width=20%>User<th width=20%>Added<th width=50%>Subject"; } for (int y = 0; y < dt.Rows.Count; y++) { SavedObject s = RowToObject(dt.Rows[y]); string sUserName = NotNull(s.Props.UserName); if (sUserName == "") { sUserName = "******"; } string sAnchor = "<a href='https://foundation.biblepay.org/TweetView.aspx?id=" + s.Props.id.ToString() + "'>"; string sReadTime = dt.Rows[y]["ReadTime"].ToNonNullString(); bool fBold = sReadTime == "" ? false : true; string sCheckmark = sReadTime != "" ? "<i class='fa fa-check'></i> " : "<i class='fa fa-envelope'></i> "; string div = "<tr>"; if (!fExcludeUser) { div += GetTd2(dt.Rows[y], "ReadTime", sAnchor, sCheckmark, fBold); } div += "<td>" + DataOps.GetAvatar(s.Props.Picture) + " " + sUserName + "</td>"; div += UICommon.GetTd2(dt.Rows[y], "Added", sAnchor, sCheckmark, fBold) + UICommon.GetTd2(dt.Rows[y], "subject", sAnchor, sCheckmark, fBold) + "</tr>"; html += div + "\r\n"; } html += "</table>"; return(html); }