Example #1
0
        /// <summary>
        /// Gets an IList with page of instances of KLAuthor.
        /// </summary>
        /// <param name="pageNumber">The page number.</param>
        /// <param name="pageSize">Size of the page.</param>
        /// <param name="totalPages">total pages</param>
        public static List <KLAuthor> GetPage(int pageNumber, int pageSize, out int totalPages)
        {
            totalPages = 1;
            IDataReader reader = DBKLAuthor.GetPage(pageNumber, pageSize, out totalPages);

            return(LoadListFromReader(reader));
        }
Example #2
0
        public static KLAuthor GetKLAuthorByUserID(
            int UserID)
        {
            KLAuthor author = new KLAuthor();

            using (IDataReader reader = DBKLAuthor.GetOneByUserID(
                       UserID))
            {
                if (reader.Read())
                {
                    author.authorID      = Convert.ToInt32(reader["AuthorID"]);
                    author.userID        = Convert.ToInt32(reader["UserID"]);
                    author.name          = reader["Name"].ToString();
                    author.avatar        = reader["Avatar"].ToString();
                    author.levelAuthor   = reader["LevelAuthor"].ToString();
                    author.linkFacebook  = reader["LinkFacebook"].ToString();
                    author.linkTwitter   = reader["LinkTwitter"].ToString();
                    author.linkPinterest = reader["LinkPinterest"].ToString();
                    author.linkInstagram = reader["LinkInstagram"].ToString();
                    author.joinDate      = Convert.ToDateTime(reader["JoinDate"]);
                    author.articleCount  = Convert.ToInt32(reader["ArticleCount"]);
                    author.isDel         = Convert.ToBoolean(reader["IsDel"]);
                    author.isActive      = Convert.ToBoolean(reader["IsActive"]);
                }
            }
            return(author);
        }
Example #3
0
 /// <summary>
 /// Updates this instance of KLAuthor. Returns true on success.
 /// </summary>
 /// <returns>bool</returns>
 private bool Update()
 {
     return(DBKLAuthor.Update(
                this.authorID,
                this.userID,
                this.name,
                this.avatar,
                this.levelAuthor,
                this.linkFacebook,
                this.linkTwitter,
                this.linkPinterest,
                this.linkInstagram,
                this.joinDate,
                this.articleCount,
                this.isDel,
                this.isActive));
 }
Example #4
0
        /// <summary>
        /// Persists a new instance of KLAuthor. Returns true on success.
        /// </summary>
        /// <returns></returns>
        private bool Create()
        {
            int newID = 0;

            newID = DBKLAuthor.Create(
                this.userID,
                this.name,
                this.avatar,
                this.levelAuthor,
                this.linkFacebook,
                this.linkTwitter,
                this.linkPinterest,
                this.linkInstagram,
                this.joinDate,
                this.articleCount,
                this.isDel,
                this.isActive);

            this.authorID = newID;

            return(newID > 0);
        }
Example #5
0
 /// <summary>
 /// Gets an instance of KLAuthor.
 /// </summary>
 /// <param name="authorID"> authorID </param>
 private void GetKLAuthor(
     int authorID)
 {
     using (IDataReader reader = DBKLAuthor.GetOne(
                authorID))
     {
         if (reader.Read())
         {
             this.authorID      = Convert.ToInt32(reader["AuthorID"]);
             this.userID        = Convert.ToInt32(reader["UserID"]);
             this.name          = reader["Name"].ToString();
             this.avatar        = reader["Avatar"].ToString();
             this.levelAuthor   = reader["LevelAuthor"].ToString();
             this.linkFacebook  = reader["LinkFacebook"].ToString();
             this.linkTwitter   = reader["LinkTwitter"].ToString();
             this.linkPinterest = reader["LinkPinterest"].ToString();
             this.linkInstagram = reader["LinkInstagram"].ToString();
             this.joinDate      = Convert.ToDateTime(reader["JoinDate"]);
             this.articleCount  = Convert.ToInt32(reader["ArticleCount"]);
             this.isDel         = Convert.ToBoolean(reader["IsDel"]);
             this.isActive      = Convert.ToBoolean(reader["IsActive"]);
         }
     }
 }
Example #6
0
        /// <summary>
        /// Gets an IList with all instances of KLAuthor.
        /// </summary>
        public static List <KLAuthor> GetAll()
        {
            IDataReader reader = DBKLAuthor.GetAll();

            return(LoadListFromReader(reader));
        }
Example #7
0
 /// <summary>
 /// Gets a count of KLAuthor.
 /// </summary>
 public static int GetCount()
 {
     return(DBKLAuthor.GetCount());
 }
Example #8
0
 /// <summary>
 /// Deletes an instance of KLAuthor. Returns true on success.
 /// </summary>
 /// <param name="authorID"> authorID </param>
 /// <returns>bool</returns>
 public static bool Delete(
     int authorID)
 {
     return(DBKLAuthor.Delete(
                authorID));
 }