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

📄 publish.cs

📁 最好用的站点内容管理系统 全部源代码都有
💻 CS
📖 第 1 页 / 共 5 页
字号:
            string Sql = "select IndexTemplet,IndexFileName,ReadNewsTemplet,ClassListTemplet,SpecialTemplet from " + Pre + "sys_param";
            return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
        }
        #region 选择发布选项部分
        public IDataReader GetPublishSpecial(string spid, out int ncount)
        {
            string SqlCondition = " where isLock=0 and isRecyle=0";
            if (spid != null && spid.Trim() != "")
            {
                SqlCondition = " where specialID in (" + spid + ")";
            }
            string SqlCount = "select count(id) from " + Pre + "news_special" + SqlCondition;
            ncount = Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, SqlCount, null));
            string Sql = "select specialID,Templet,SavePath,saveDirPath,FileName,FileEXName from " + Pre + "news_special" + SqlCondition;
            return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
        }
        public IDataReader GetPublishClass(string siteid, string classid, bool isflag, out int ncount)
        {
            string SqlCondition = "";
            if (classid.Trim() == "")
            {
                if (isflag)
                {
                    SqlCondition = " where isunHTML !=1 and isPage!=1 and isLock=0 and isRecyle=0 and IsURL=0 and SiteID='" + siteid + "'";
                }
                else
                {
                    SqlCondition = " where isLock=0 and isRecyle=0 and IsURL=0 and isPage!=1 and isLock=0 and SiteID='" + siteid + "'";
                }
            }
            else
            {
                SqlCondition = " where classID in (" + classid + ")";
            }
            string SqlCount = "select count(id) from " + Pre + "news_class" + SqlCondition;
            ncount = Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, SqlCount, null));
            string Sql = "select Datalib,classtemplet,classid,SavePath,SaveClassframe,ClassSaveRule from " + Pre + "news_class" + SqlCondition;
            return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
        }
        #region 发布新闻
        /// <summary>
        /// 选择发布所有新闻时,取得所有新闻
        /// </summary> 
        /// <param name="strParams">页面信息字符串</param>
        /// <returns>取得符合条件的所有新闻的查询结果</returns>
        public IDataReader GetPublishNewsAll(out int ncount)
        {
            string TopParam = "";
            int refreshNum = int.Parse(NetCMS.Common.Public.readparamConfig("infoNumber", "refresh"));
            if (refreshNum != 0)
            {
                TopParam = "top " + NetCMS.Common.Public.readparamConfig("infoNumber", "refresh") + "";
            }
            string Sql = "select " + TopParam + " NewsID,templet,datalib,classID,SavePath,FileName,FileEXName from " + Pre + "news where isRecyle=0 and isLock=0 and isDelPoint=0 and NewsType!=2";
            string SqlCount = "select count(ID) from " + Pre + "news where isRecyle=0 and isLock=0 and isDelPoint=0 and NewsType!=2";
            ncount = Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, SqlCount, null));
            if (refreshNum != 0)
            {
                if (refreshNum < ncount)
                {
                    ncount = refreshNum;
                }
            }
            return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
        }
        /// <summary>
        /// 选择发布最新时,取得所有新闻
        /// </summary>
        /// <param name="strParams">页面信息字符串</param>
        /// <returns>取得符合条件的所有新闻的查询结果</returns>
        public IDataReader GetPublishNewsLast(int topnum, bool unpublish, out int ncount)
        {
            string Sql = "select top " + topnum + " NewsID,templet,datalib,classID,SavePath,FileName,FileEXName from " + Pre + "news where isRecyle=0 and isLock=0 and isDelPoint=0 and NewsType!=2";
            string SqlCount = "select count(ID) from " + Pre + "news where isRecyle=0 and isLock=0 and isDelPoint=0 and NewsType!=2";
            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);
        }
        #region 根据栏目选择发布的新闻
        /// <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 GetPublishNewsByClass(string classid, bool unpublish, bool isdesc, string condition, out int ncount)
        {
            string SqlCondition = " where isRecyle=0 and isLock=0 and isDelPoint=0 and NewsType!=2 and ClassID in (" + classid + ")";
            string SqlOrder = "";
            if (unpublish)
            {
                //只发布未发布的
                SqlCondition += " and isHtml=0 ";
            }
            switch (condition)
            {
                #region 条件判断
                case "0":
                    SqlOrder = " order by newsID ";
                    break;
                case "1":
                    SqlOrder = " order by Click ";
                    break;
                case "2":
                    SqlOrder = " order by OrderID ";
                    break;
                case "3":
                    SqlOrder = " order by CreatTime ";
                    break;
                case "4":
                    SqlCondition += " and substring(NewsProperty,1,1)='1'";
                    SqlOrder = " order by newsID ";
                    break;
                case "5":
                    SqlCondition += " and substring(NewsProperty,3,1)='1'";
                    SqlOrder = " order by newsID ";
                    break;
                case "6":
                    SqlCondition += " and substring(NewsProperty,5,1)='1'";
                    SqlOrder = " order by newsID ";
                    break;
                case "7":
                    SqlCondition += " and substring(NewsProperty,7,1)='1'";
                    SqlOrder = " order by newsID ";
                    break;
                case "8":
                    SqlCondition += " and substring(NewsProperty,9,1)='1'";
                    SqlOrder = " order by newsID ";
                    break;
                case "9":
                    SqlCondition += " and substring(NewsProperty,11,1)='1'";
                    SqlOrder = " order by newsID ";
                    break;
                case "10":
                    SqlCondition += " and substring(NewsProperty,15,1)='1'";
                    SqlOrder = " order by newsID ";
                    break;
                case "11":
                    SqlCondition += " and author!=''";
                    SqlOrder = " order by newsID ";
                    break;
                case "12":
                    SqlCondition += " and Souce!=''";
                    SqlOrder = " order by newsID ";
                    break;
                case "13":
                    SqlCondition += " and tags!=''";
                    SqlOrder = " order by newsID ";
                    break;
                case "14":
                    SqlCondition += " and newstype=1";
                    SqlOrder = " order by newsID ";
                    break;
                case "15":
                    SqlCondition += " and isFiles=1";
                    SqlOrder = " order by newsID ";
                    break;
                case "16":
                    SqlCondition += " and vURL!=''";
                    SqlOrder = " order by newsID ";
                    break;
                case "17":
                    SqlCondition += " and ContentPicTF=1";
                    SqlOrder = " order by newsID ";
                    break;
                case "18":
                    SqlCondition += " and VoteTF=1";
                    SqlOrder = " order by newsID ";
                    break;
                case "19":
                    SqlCondition += " and (select count(b.id) from " + Pre + "api_commentary b where b.InfoID=a.newsid)>0";
                    SqlOrder = " order by newsID";
                    break;
                default:
                    break;
                #endregion 条件判断
            }
            if (isdesc)
            {
                //倒序
                SqlOrder += " desc ";
            }
            string Sql = "select newsid,templet,datalib,classID,SavePath,FileName,FileEXName from " + Pre + "news a " + SqlCondition + SqlOrder;
            string SqlCount = "select count(a.ID) from " + Pre + "news a " + SqlCondition;
            ncount = Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, SqlCount, null));
            return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
        }
        #endregion 根据栏目选择发布的新闻
        /// <summary>
        /// 选择按照日期发布时,取得所有新闻
        /// </summary>
        /// <param name="starttime"></param>
        /// <param name="endtime"></param>
        /// <param name="ncount"></param>
        /// <returns></returns>
        public IDataReader GetPublishNewsByTime(DateTime starttime, DateTime endtime, out int ncount)
        {
            string Sql = "select newsID,templet,datalib,classID,SavePath,FileName,FileEXName from " + Pre + "news where creattime between '" + starttime + "' and '" + endtime + "' and isRecyle=0 and isLock=0 and isDelPoint=0 and NewsType!=2";
            string SqlCount = "select count(ID) from " + Pre + "news where creattime between '" + starttime + "' and '" + endtime + "' and isRecyle=0 and isLock=0 and isDelPoint=0 and NewsType!=2";
            ncount = Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, SqlCount, null));
            return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
        }
        /// <summary>
        /// 选择按照ID发布时,取得所有新闻
        /// </summary>
        /// <param name="minid"></param>
        /// <param name="maxid"></param>
        /// <param name="ncount"></param>
        /// <returns></returns>
        public IDataReader GetPublishNewsByID(int minid, int maxid, out int ncount)
        {
            string Sql = "select newsid,templet,datalib,classID,SavePath,FileName,FileEXName from " + Pre + "news where isRecyle=0 and isLock=0 and isDelPoint=0 and NewsType!=2 and id between " + minid + " and " + maxid;
            string SqlCount = "select count(id) from " + Pre + "news where isRecyle=0 and isLock=0 and isDelPoint=0 and NewsType!=2 and id between " + minid + " and " + maxid;
            ncount = Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, SqlCount, null));
            return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
        }
        #endregion 发布新闻
        #endregion 选择发布选项部分

        public IDataReader GetJsPath(string jsid)
        {
            string Sql = "Select [jssavepath],[jsfilename] From [" + Pre + "news_js] Where [JsID]=@JsID";
            SqlParameter Param = new SqlParameter("@JsID", jsid);

⌨️ 快捷键说明

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