private static List <KLNews> LoadListFromReader(IDataReader reader) { List <KLNews> KLNewList = new List <KLNews>(); try { while (reader.Read()) { KLNews KLNew = new KLNews(); KLNew.kLNewID = Convert.ToInt32(reader["KLNewID"]); KLNew.newsID = Convert.ToInt32(reader["NewsID"]); KLNew.authorID = Convert.ToInt32(reader["AuthorID"]); KLNew.viewCount = Convert.ToInt32(reader["ViewCount"]); KLNew.shareCount = Convert.ToInt32(reader["ShareCount"]); KLNew.commentCount = Convert.ToInt32(reader["CommentCount"]); KLNew.likeCount = Convert.ToInt32(reader["LikeCount"]); KLNew.approvedBy = reader["ApprovedBy"].ToString(); KLNew.newType = Convert.ToInt32(reader["NewType"]); KLNew.newlsevel = Convert.ToInt32(reader["Newlsevel"]); KLNew.newstotalpoint = Convert.ToInt32(reader["Newstotalpoint"]); KLNew.isdraft = Convert.ToBoolean(reader["Isdraft"]); // try { KLNew.isapproved = Convert.ToBoolean(reader["Isapproved"]); KLNew.Datepost = Convert.ToDateTime(reader["StartDate"]); KLNew.title = Convert.ToString(reader["KLTitle"]); KLNew.newapprovedBy = Convert.ToString(reader["NewsApprovedBy"]); } catch (Exception) { } KLNewList.Add(KLNew); } } finally { reader.Close(); } return(KLNewList); }
/// <summary> /// Compares 2 instances of KLNew. /// </summary> public static int CompareByNewstotalpoint(KLNews kLNew1, KLNews kLNew2) { return(kLNew1.Newstotalpoint.CompareTo(kLNew2.Newstotalpoint)); }
/// <summary> /// Compares 2 instances of KLNew. /// </summary> public static int CompareByNewlsevel(KLNews kLNew1, KLNews kLNew2) { return(kLNew1.Newlsevel.CompareTo(kLNew2.Newlsevel)); }
/// <summary> /// Compares 2 instances of KLNew. /// </summary> public static int CompareByNewType(KLNews kLNew1, KLNews kLNew2) { return(kLNew1.NewType.CompareTo(kLNew2.NewType)); }
/// <summary> /// Compares 2 instances of KLNew. /// </summary> public static int CompareByApprovedBy(KLNews kLNew1, KLNews kLNew2) { return(kLNew1.ApprovedBy.CompareTo(kLNew2.ApprovedBy)); }
/// <summary> /// Compares 2 instances of KLNew. /// </summary> public static int CompareByLikeCount(KLNews kLNew1, KLNews kLNew2) { return(kLNew1.LikeCount.CompareTo(kLNew2.LikeCount)); }
/// <summary> /// Compares 2 instances of KLNew. /// </summary> public static int CompareByCommentCount(KLNews kLNew1, KLNews kLNew2) { return(kLNew1.CommentCount.CompareTo(kLNew2.CommentCount)); }
/// <summary> /// Compares 2 instances of KLNew. /// </summary> public static int CompareByViewCount(KLNews kLNew1, KLNews kLNew2) { return(kLNew1.ViewCount.CompareTo(kLNew2.ViewCount)); }
/// <summary> /// Compares 2 instances of KLNew. /// </summary> public static int CompareByAuthorID(KLNews kLNew1, KLNews kLNew2) { return(kLNew1.AuthorID.CompareTo(kLNew2.AuthorID)); }
/// <summary> /// Compares 2 instances of KLNew. /// </summary> public static int CompareByNewsID(KLNews kLNew1, KLNews kLNew2) { return(kLNew1.NewsID.CompareTo(kLNew2.NewsID)); }