public static ForumEstCommentbyUser getoneForumCommentbyID(string forumcommentID) { ForumEstCommentbyUser fu = new ForumEstCommentbyUser(); try { SqlCommand command = new SqlCommand("Select * from ForumEstCommentbyUser where forumcommentID=@forumcommentID"); command.Parameters.AddWithValue("@forumcommentID", forumcommentID); command.Connection = connection; connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { fu.forumcommentID = reader["forumcommentID"].ToString(); ForumEstablishments onef = ForumEstablishmentsDB.getForumEstbyID(reader["forumID"].ToString()); fu.forumID = onef; fu.comments = reader["comments"].ToString(); AUser u = AUserDB.getUserbyID(reader["commentby"].ToString()); fu.commentby = u; fu.date = Convert.ToDateTime(reader["date"]); fu.status = reader["status"].ToString(); } reader.Close(); } finally { connection.Close(); } return(fu); }
public static AForumUser getForumUserbyID(string id) { AForumUser fu = new AForumUser(); try { SqlCommand command = new SqlCommand("Select * from ForumUser where forumID=@forumID"); command.Parameters.AddWithValue("@forumID", id); command.Connection = connection; connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { fu.ForumID = reader["forumID"].ToString(); fu.title = reader["title"].ToString(); fu.message = reader["message"].ToString(); fu.date = Convert.ToDateTime(reader["date"]); fu.status = reader["status"].ToString(); AUser u = AUserDB.getUserbyID(reader["UserID"].ToString()); fu.userID = u; } reader.Close(); } finally { connection.Close(); } return(fu); }
public static List <ForumEstCommentbyUser> getalloneForumAllComment() { List <ForumEstCommentbyUser> fulists = new List <ForumEstCommentbyUser>(); try { SqlCommand command = new SqlCommand("Select * from ForumEstCommentbyUser"); command.Connection = connection; connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { ForumEstCommentbyUser fu = new ForumEstCommentbyUser(); fu.forumcommentID = reader["forumcommentID"].ToString(); ForumEstablishments onef = ForumEstablishmentsDB.getForumEstbyID(reader["forumID"].ToString()); fu.forumID = onef; fu.comments = reader["comments"].ToString(); AUser u = AUserDB.getUserbyID(reader["commentby"].ToString()); fu.commentby = u; fu.date = Convert.ToDateTime(reader["date"]); fu.status = reader["status"].ToString(); fulists.Add(fu); } reader.Close(); } finally { connection.Close(); } return(fulists); }
public static List <AForumUser> getAllForumUser() { List <AForumUser> forumlists = new List <AForumUser>(); try { SqlCommand command = new SqlCommand("Select * from ForumUser"); command.Connection = connection; connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { AForumUser fu = new AForumUser(); fu.ForumID = reader["forumID"].ToString(); fu.title = reader["title"].ToString(); fu.message = reader["message"].ToString(); fu.date = Convert.ToDateTime(reader["date"]); fu.status = reader["status"].ToString(); AUser u = AUserDB.getUserbyID(reader["UserID"].ToString()); fu.userID = u; forumlists.Add(fu); } reader.Close(); } finally { connection.Close(); } return(forumlists); }