public static programComponents.forumNeeds.Comment GetCommentFromTemplate( programComponents.forumNeeds.Comment commentTemplate) { programComponents.forumNeeds.Comment toReturn = null; var row = staticSource.SelectOneRow("ID FROM " + MysqlHandler.tblForumComments + $" WHERE userID = '{commentTemplate.ownerId}'" + $" AND time = '{commentTemplate.postedAt}'"); long id = Convert.ToInt64(row[0]); toReturn = new programComponents.forumNeeds.Comment(id, commentTemplate.ownerId, commentTemplate.forumPostId, commentTemplate.content, commentTemplate.postedAt); return(toReturn); }
static internal bool PushNewForumProblemComment(programComponents.forumNeeds.Comment comment) { //local id skipped. It is fake or equal to 0 var ownerId = comment.ownerId; var forumId = comment.forumPostId; string content = comment.content; string contentHolder = "■content"; var qParams = MysqlHandler.ConstructQueryParams(new string[] { contentHolder }, new string[] { content }); return(staticSource.InsertInto(MysqlHandler.tblForumComments + " (userID, forumID, comment, time) VALUES " + $"('{ownerId}', '{forumId}', '{contentHolder}', '{comment.postedAt}')", qParams)); }
public static List <programComponents.forumNeeds.Comment> GetCommentsAsList(long chosenForumId) { var rows = staticSource.Select("ID, forumID, userID, comment, time FROM " + MysqlHandler.tblForumComments + " WHERE forumID = " + chosenForumId); var toReturn = new List <programComponents.forumNeeds.Comment>(); foreach (var row in rows) { long id = Convert.ToInt32(row[0]); int ownerId = Convert.ToInt32(row[1]); long forumId = Convert.ToInt64(row[2]); string content = row[3]; long unix = Convert.ToInt64(row[4]); var temp = new programComponents.forumNeeds.Comment(id, ownerId, forumId, content, unix); toReturn.Add(temp); } return(toReturn); }