// Select Unidentified People Comment public List <CommentObjects> SelectCommentOfUnidentifiedPeople(int Unidentified) { List <CommentObjects> ls = new List <CommentObjects>(); connection(); SqlCommand SelectData = new SqlCommand("SelectCommentsForUnidentifiedPeople", con); SelectData.CommandType = CommandType.StoredProcedure; SelectData.Parameters.AddWithValue("@Unidentified", Unidentified); SqlDataReader reader = SelectData.ExecuteReader(); while (reader.Read()) { CommentObjects ob = new CommentObjects(); ob.CommentID = Convert.ToInt32(reader["CommentID"]); ob.UnidentifiedID = Convert.ToInt32(reader["UnidentifiedID"]); ob.RegistrationID = Convert.ToInt32(reader["RegistrationID"]); ob.FullName = reader["FullName"].ToString(); ob.Message = reader["Message"].ToString(); ob.Image = reader["Image"].ToString(); ls.Add(ob); } reader.Close(); con.Close(); return(ls); }
// Select Total Number of Comments From Comments Table For Admin Panel. public List <CommentObjects> TotalComments() { List <CommentObjects> ls = new List <CommentObjects>(); connection(); SqlCommand SelectData = new SqlCommand("SelectCommentsCountPosts", con); SelectData.CommandType = CommandType.StoredProcedure; SqlDataReader reader = SelectData.ExecuteReader(); if (reader.Read()) { CommentObjects ob = new CommentObjects(); ob.CommentID = Convert.ToInt32(reader["CommentID"]); ls.Add(ob); } con.Close(); reader.Close(); return(ls); }
// Select ALL Comments public List <CommentObjects> SelectAllComments() { List <CommentObjects> ls = new List <CommentObjects>(); connection(); SqlCommand SelectData = new SqlCommand("SelectAllCommentsForAdmin", con); SelectData.CommandType = CommandType.StoredProcedure; SqlDataReader reader = SelectData.ExecuteReader(); while (reader.Read()) { CommentObjects ob = new CommentObjects(); ob.CommentID = Convert.ToInt32(reader["CommentID"]); ob.RegistrationID = Convert.ToInt32(reader["RegistrationID"]); if (reader["PeopleID"] == DBNull.Value) { result = string.Empty; } else { ob.PeopleID = Convert.ToInt32(reader["PeopleID"]); } if (reader["AutoMobile"] == DBNull.Value) { result = string.Empty; } else { ob.AutoMobileID = Convert.ToInt32(reader["AutoMobile"]); } if (reader["Mobile"] == DBNull.Value) { result = string.Empty; } else { ob.MobileID = Convert.ToInt32(reader["Mobile"]); } if (reader["CNIC"] == DBNull.Value) { result = string.Empty; } else { ob.CnicID = Convert.ToInt32(reader["CNIC"]); } if (reader["UnidentifiedID"] == DBNull.Value) { result = string.Empty; } else { ob.UnidentifiedID = Convert.ToInt32(reader["UnidentifiedID"]); } ob.FullName = reader["FullName"].ToString(); ob.Message = reader["Message"].ToString(); ob.Image = reader["Image"].ToString(); ls.Add(ob); } con.Close(); reader.Close(); return(ls); }