Пример #1
0
        //--------------------------------------------------------------------------------------------------------------------
        public Articles Get(string LogFilePath, string LogFileName, int ArticleId)
        {
            Articles RetVal = new Articles(db.ConnectionString);

            try
            {
                List <Articles> list = GetListByArticleId(LogFilePath, LogFileName, ArticleId);
                if (list.Count > 0)
                {
                    RetVal = (Articles)list[0];
                }
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
        //-------------------------------------------------------------------------------------------------------------------------------
        public string GetArticleLink(string LogFilePath, string LogFileName, string ROOT_PATH, string FILE_EXTEND, string CategoryName)
        {
            string RetVal = "";

            try
            {
                Articles m_Articles = new Articles(this.db.ConnectionString);
                m_Articles = m_Articles.Get(LogFilePath, LogFileName, this.ArticleId);
                if (m_Articles.ArticleId > 0)
                {
                    RetVal = m_Articles.GetArticleLink(LogFilePath, LogFileName, ROOT_PATH, FILE_EXTEND, CategoryName);
                }
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
Пример #3
0
        //-------------------------------------------------------------------------------------------------------------------
        private List <Articles> Init(string LogFilePath, string LogFileName, SqlCommand cmd)
        {
            SqlConnection con = db.getConnection();

            cmd.Connection = con;
            List <Articles> l_Articles = new List <Articles>();

            try
            {
                con.Open();
                SqlDataReader   reader      = cmd.ExecuteReader();
                SmartDataReader smartReader = new SmartDataReader(reader);
                while (smartReader.Read())
                {
                    Articles m_Articles = new Articles(db.ConnectionString);
                    m_Articles.ArticleId       = smartReader.GetInt32("ArticleId");
                    m_Articles.ArticleTitle    = smartReader.GetString("ArticleTitle");
                    m_Articles.ArticleLead     = smartReader.GetString("ArticleLead");
                    m_Articles.EditorStatusId  = smartReader.GetByte("EditorStatusId");
                    m_Articles.CategoryId      = smartReader.GetInt16("CategoryId");
                    m_Articles.AuthorUserId    = smartReader.GetInt32("AuthorUserId");
                    m_Articles.AuthorDateTime  = smartReader.GetDateTime("AuthorDateTime");
                    m_Articles.PublishDateTime = smartReader.GetDateTime("PublishDateTime");
                    m_Articles.ArticleSource   = smartReader.GetString("ArticleSource");
                    m_Articles.MediaItemId     = smartReader.GetInt32("MediaItemId");
                    m_Articles.CrUserId        = smartReader.GetInt32("CrUserId");
                    m_Articles.CrDateTime      = smartReader.GetDateTime("CrDateTime");
                    l_Articles.Add(m_Articles);
                }
                smartReader.disposeReader(reader);
                db.closeConnection(con);
            }
            catch (SqlException ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(l_Articles);
        }