⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 publish.cs

📁 最好用的站点内容管理系统 全部源代码都有
💻 CS
📖 第 1 页 / 共 5 页
字号:
                sql = "select * from " + Pre + "news_class where ClassID=@ID";
            }
            else
            {
                sql = "select * from " + Pre + "news_special where SpecialID=@ID";
            }
            return DbHelper.ExecuteTable(CommandType.Text, sql, param);
        }



        public IDataReader GetNewsDetail(int id, string newsid)
        {
            SqlParameter Param = null;
            string Sql = "Select [Id],[NewsID],[NewsType],[OrderID],[NewsTitle],[sNewsTitle],[TitleColor],[TitleITF],[TitleBTF],[CommLinkTF],";
            Sql += "[SubNewsTF],[URLaddress],[PicURL],[SPicURL],[ClassID],[SpecialID],[Author],[Souce],[Tags],[NewsProperty],[NewsPicTopline],";
            Sql += "[Templet],[Content],[Metakeywords],[Metadesc],[naviContent],[Click],[CreatTime],[EditTime],[SavePath],[FileName],";
            Sql += "[FileEXName],[isDelPoint],[Gpoint],[iPoint],[GroupNumber],[ContentPicTF],[ContentPicURL],[ContentPicSize],[CommTF],";
            Sql += "[DiscussTF],[TopNum],[VoteTF],[CheckStat],[isLock],[isRecyle],[SiteID],[DataLib],[DefineID],[isVoteTF],[Editor],[isHtml],";
            Sql += "[isConstr],[isFiles],[vURL] From [" + Pre + "News]";
            if (id > 0)
            {
                Sql += " Where ID=" + id;
            }
            else
            {
                Sql += " Where [NewsID]=@NewsID";
                Param = new SqlParameter("@NewsID", newsid);
            }
            return DbHelper.ExecuteReader(CommandType.Text, Sql, Param);
        }

        public string GetClassIDByNewsID(string newsid)
        {
            string Sql = "Select [ClassID] From " + DBConfig.TableNamePrefix + "news Where [NewsID]=@NewsID";
            SqlParameter Param = new SqlParameter("@NewsID", newsid);
            return Convert.ToString(DbHelper.ExecuteScalar(CommandType.Text, Sql, Param));
        }

        public IDataReader GetTopUser(int topnum, string orderfld)
        {
            string Sql = "Select Top " + topnum + " [NickName],[UserName],[iPoint],[gPoint],[ePoint],[RegTime],(Select Count(*) From [" + Pre + "User_Constr] Where [" + Pre + "sys_User].UserNum=[" + Pre + "User_Constr].UserNum) Cnt From [" + Pre + "sys_User] Where [isLock]=0";
            switch (orderfld)
            {
                case "iPoint":
                    Sql += " Order By [iPoint] Desc,[ID] Desc";
                    break;
                case "gPoint":
                    Sql += " Order By [gPoint] Desc,[ID] Desc";
                    break;
                case "ePoint":
                    Sql += " Order By [ePoint] Desc,[ID] Desc";
                    break;
                case "Cnt":
                    Sql += "Order By [Cnt] Desc,[ID] Desc";
                    break;
                default:
                    Sql += " Order By [RegTime] Desc,[ID] Desc";
                    break;
            }
            return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
        }

        public DataTable GetUnRule(string UnID, string SiteID)
        {
            string Sql = string.Empty;
            if (UnID != "0")
            {
                Sql = "Select [unName],[TitleCSS],[SubCSS],[ONewsID],[Rows],[unTitle],[NewsTable] From [" + Pre + "news_unNews] Where [UnID]=@UnID And [SiteID]=@SiteID Order By [Rows] Asc,[ID] asc";
            }
            else
            {
                Sql = "Select [unName],[TitleCSS],[SubCSS],[ONewsID],[Rows],[unTitle],[NewsTable] From [" + Pre + "news_unNews] Where [UnID] in (select top 1 UnID from [" + Pre + "news_unNews] order by id desc) [SiteID]=@SiteID Order By [Rows] Asc,[ID] asc";
            }
            SqlParameter[] Param = new SqlParameter[] { new SqlParameter("@UnID", UnID), new SqlParameter("@SiteID", SiteID) };
            return DbHelper.ExecuteTable(CommandType.Text, Sql, Param);
        }

        public DataTable GetSubUnRule(string NewsID)
        {
            string Sql = "Select ID,getNewsID,NewsTitle,DataLib,TitleCSS,colsNum,SiteID,CreatTime From [" + Pre + "news_sub] Where [NewsID]=@NewsID Order By [colsNum] Asc,[ID] asc";
            SqlParameter[] Param = new SqlParameter[] { new SqlParameter("@NewsID", NewsID) };
            return DbHelper.ExecuteTable(CommandType.Text, Sql, Param);
        }

        public DataTable GetSubClass(string ClassID, int isParent, string OrderBy, string Desc)
        {
            SqlParameter Param = new SqlParameter("@ClassID", ClassID);
            string Sql = string.Empty;
            if (isParent == 1)
            {
                Sql = "Select ClassID From [" + Pre + "news_class] Where [ParentID]=@ClassID and isLock=0 and isRecyle=0 and isPage=0 order by " + OrderBy + " " + Desc + ",id " + Desc + "";
            }
            else
            {
                Sql = "Select ClassID,IsURL,URLaddress,SavePath,SaveClassframe,ClassSaveRule,ClassIndexRule From [" + Pre + "news_class] Where [ClassID]=@ClassID and isLock=0 and isRecyle=0 and isPage=0";
            }
            //SqlParameter[] Param = new SqlParameter[] { new SqlParameter("@NewsID", NewsID) };
            return DbHelper.ExecuteTable(CommandType.Text, Sql, Param);
        }
        public string GetDefinedValue(string dfid, string dfcolumn)
        {
            string Sql = "Select [definedvalue] From [" + Pre + "define_data] Where [defineInfoId]=@defineInfoId And [defineColumns]=@defineColumns";
            SqlParameter[] Param = new SqlParameter[]{
                new SqlParameter("@defineInfoId", dfid),
                new SqlParameter("@defineColumns", dfcolumn)
            };
            return Convert.ToString(DbHelper.ExecuteScalar(CommandType.Text, Sql, Param));
        }

        public string GetCHDefinedValue(int ID, string dfcolumn, string DTalbe)
        {
            string Sql = "Select " + dfcolumn + " From [" + DTalbe + "] Where ID=@ID";
            SqlParameter[] Param = new SqlParameter[]
            {
                new SqlParameter("@ID", ID),
                new SqlParameter("@defineColumns", dfcolumn)
            };
            string ReturnValue = Convert.ToString(DbHelper.ExecuteScalar(CommandType.Text, Sql, Param));
            return ReturnValue;
        }
        /// <summary>
        /// 文字副新闻
        /// </summary>
        /// <param name="TopNum"></param>
        /// <returns></returns>
        public DataTable GetTextSubNews(int TopNum)
        {
            string Sql = "select top " + TopNum + " NewsTitle,TitleColor,TitleITF,TitleBTF,NewsID,ClassID,SavePath,FileName,FileEXName,isDelPoint from " + Pre + "news where substring(NewsProperty,9,1)='1' and substring(NewsProperty,1,1)='1' and islock=0 and isRecyle=0 and NewsPicTopline=0 order by EditTime desc,id desc";
            return DbHelper.ExecuteTable(CommandType.Text, Sql, null);
        }

        #region 频道开始
        public string GetCHDatable(int ChID)
        {
            SqlParameter param = new SqlParameter("@ChID", ChID);
            string sql = "select DataLib from " + Pre + "sys_channel Where ID=@ChID";
            string ChTable = Convert.ToString(DbHelper.ExecuteScalar(CommandType.Text, sql, param));
            if (ChTable != string.Empty)
            {
                return ChTable;
            }
            else
            {
                return "#";
            }
        }


        public IDataReader GetCHDetail(int id, string DTable)
        {
            string Sql = "Select [Id],[OrderID],[Title],[TitleColor],[TitleITF],[TitleBTF],";
            Sql += "[PicURL],[ClassID],[SpecialID],[Author],[Souce],[Tags],[ContentProperty],";
            Sql += "[Templet],[Content],[Metakeywords],[Metadesc],[naviContent],[Click],[CreatTime],[SavePath],[FileName],";
            Sql += "[isDelPoint],[Gpoint],[iPoint],[GroupNumber],";
            Sql += "[isLock],[ChID],[Editor],[isHtml],[isConstr] From [" + DTable + "]";
            Sql += " Where [ID]=@ID";
            SqlParameter Param = new SqlParameter("@ID", id);
            return DbHelper.ExecuteReader(CommandType.Text, Sql, Param);
        }


        /// <summary>
        /// 选择发布频道所有新闻时,取得所有新闻
        /// </summary> 
        /// <param name="strParams">页面信息字符串</param>
        /// <returns>取得符合条件的所有新闻的查询结果</returns>
        public IDataReader GetPublishCHNewsAll(string DTable, out int ncount)
        {
            string Sql = "select ID,Templet,classID,SavePath,FileName from " + DTable + " where isLock=0 and isDelPoint=0";
            string SqlCount = "select count(ID) from " + DTable + " where isLock=0 and isDelPoint=0";
            ncount = Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, SqlCount, null));
            return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
        }

        /// <summary>
        /// 选择发布频道最新时,取得所有新闻
        /// </summary>
        /// <param name="strParams">页面信息字符串</param>
        /// <returns>取得符合条件的所有新闻的查询结果</returns>
        public IDataReader GetPublishCHNewsLast(string DTable, int topnum, bool unpublish, out int ncount)
        {
            string Sql = "select top " + topnum + " ID,Templet,classID,SavePath,FileName from " + DTable + " where isLock=0 and isDelPoint=0";
            string SqlCount = "select count(ID) from " + DTable + " where isLock=0 and isDelPoint=0";
            if (unpublish)
            {
                Sql += " and isHtml=0";
                SqlCount += " and isHtml=0";
            }
            Sql += " order by id desc";
            ncount = Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, SqlCount, null));
            return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
        }


        /// <summary>
        /// 根据栏目发布新闻
        /// </summary>
        /// <param name="classid"></param>
        /// <param name="unpublish"></param>
        /// <param name="isdesc"></param>
        /// <param name="condition"></param>
        /// <param name="ncount"></param>
        /// <returns></returns>
        public IDataReader GetPublishCHNewsByClass(string DTable, string classid, bool unpublish, bool isdesc, string condition, out int ncount)
        {
            string SqlCondition = " where isLock=0 and isDelPoint=0 and ClassID in (" + classid + ")";
            string SqlOrder = "";
            if (unpublish)
            {
                //只发布未发布的
                SqlCondition += " and isHtml=0 ";
            }
            string Sql = "select ID,Templet,classID,SavePath,FileName from " + DTable + " a " + SqlCondition + SqlOrder;
            string SqlCount = "select count(a.ID) from " + DTable + " a " + SqlCondition;
            ncount = Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, SqlCount, null));
            return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
        }


        /// <summary>
        /// 选择按照日期发布时,取得所有新闻
        /// </summary>
        /// <param name="starttime"></param>
        /// <param name="endtime"></param>
        /// <param name="ncount"></param>
        /// <returns></returns>
        public IDataReader GetPublishCHNewsByTime(string DTable, DateTime starttime, DateTime endtime, out int ncount)
        {
            string Sql = "select ID,Templet,classID,SavePath,FileName from " + DTable + " where creattime between '" + starttime + "' and '" + endtime + "' and isLock=0 and isDelPoint=0";
            string SqlCount = "select count(ID) from " + DTable + " where creattime between '" + starttime + "' and '" + endtime + "' and isLock=0 and isDelPoint=0";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -