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

📄 publish.cs

📁 最好用的站点内容管理系统 全部源代码都有
💻 CS
📖 第 1 页 / 共 5 页
字号:
            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 GetPublishCHNewsByID(string DTable, int minid, int maxid, out int ncount)
        {
            string Sql = "select ID,Templet,classID,SavePath,FileName from " + DTable + " where isLock=0 and isDelPoint=0 and id between " + minid + " and " + maxid;
            string SqlCount = "select count(id) from " + DTable + " where isLock=0 and isDelPoint=0 and id between " + minid + " and " + maxid;
            ncount = Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, SqlCount, null));
            return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
        }


        public IDataReader GetPublishCHClass(string classid, int ChID, out int ncount)
        {
            string SqlCondition = string.Empty;
            if (classid.Trim() == "")
            {
                SqlCondition = " where isLock=0 and isPage!=1 and isDelPoint=0 and ChID=" + ChID + "";
            }
            else
            {
                SqlCondition = " where  isLock=0 and isPage!=1 and isDelPoint=0 classID in (" + classid + ")";
            }
            string SqlCount = "select count(id) from " + Pre + "sys_channelclass" + SqlCondition;
            ncount = Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, SqlCount, null));
            string Sql = "select id,Templet,SavePath,FileName from " + Pre + "sys_channelclass" + SqlCondition;
            return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
        }

        public IDataReader GetPublishCHSpecial(int ChID, string spid, out int ncount)
        {
            string SqlCondition = " where isLock=0 and ChID=" + ChID + "";
            if (spid != null && spid.Trim() != "")
            {
                SqlCondition = " where isLock=0 and id in (" + spid + ")  and ChID=" + ChID + "";
            }
            string SqlCount = "select count(id) from " + Pre + "sys_channelspecial" + SqlCondition;
            ncount = Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, SqlCount, null));
            string Sql = "select id,templet,savePath,filename from " + Pre + "sys_channelspecial" + SqlCondition;
            return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
        }

        public string GetCHPageTitle(int id, string Str, int ChID)
        {
            string Sql = string.Empty;
            switch (Str)
            {
                case "ChIndex":
                    Sql = "select channelName from " + Pre + "sys_channel where id=@ID";
                    break;
                case "ChNews":
                    Sql = "select Title from " + GetCHDatable(ChID) + " where id=@ID";
                    break;
                case "ChClass":
                    Sql = "select classCName from " + Pre + "sys_channelclass where id=@ID and ChID=" + ChID + "";
                    break;
                case "ChSpecial":
                    Sql = "select specialCName from " + Pre + "sys_channelspecial where id=@ID and ChID=" + ChID + "";
                    break;
                default:
                    return string.Empty;
            }
            SqlParameter Param = null;
            if (Str == "ChIndex")
            {
                Param = new SqlParameter("@ID", ChID);
            }
            else
            {
                Param = new SqlParameter("@ID", id);
            }
            return Convert.ToString(DbHelper.ExecuteScalar(CommandType.Text, Sql, Param));
        }

        public IDataReader GetPositionNavi(int id, string Str, int ChID)
        {
            string Sql = "select id,channelName,htmldir,indexFileName,ParentID from " + Pre + "sys_channel where id=@ChID";
            SqlParameter param = new SqlParameter("@ChID", ChID);
            return DbHelper.ExecuteReader(CommandType.Text, Sql, param);
        }

        public IDataReader GetParentPositionNavi(int ChId)
        {
            string Sql = "select id,channelName,htmldir,indexFileName,ParentID from " + Pre + "sys_channel where ID=@ChID";
            SqlParameter param = new SqlParameter("@ChID", ChId);
            return DbHelper.ExecuteReader(CommandType.Text, Sql, param);
        }
        

        public IDataReader GetFieldName(int ChID)
        {
            string sql = "select CName,EName from " + Pre + "sys_channelvalue where ChID=@ChID and isLock=0 and isSearch=1";
            SqlParameter param = new SqlParameter("@ChID", ChID);
            return DbHelper.ExecuteReader(CommandType.Text, sql, param);
        }

        public string GetCHMeta(int id, int Num, int ChID, string Str)
        {
            string sql = string.Empty;
            SqlParameter[] param = new SqlParameter[2];
            param[0] = new SqlParameter("@ID", SqlDbType.Int, 4);
            param[0].Value = id;
            param[1] = new SqlParameter("@ChID", SqlDbType.Int, 4);
            param[1].Value = ChID;
            switch (Str)
            {
                case "ChIndex":
                    sql = "select channelName from " + Pre + "sys_channel where ID=" + ChID + "";
                    return Convert.ToString(DbHelper.ExecuteScalar(CommandType.Text, sql, null));
                case "ChClass":
                    if (Num == 0)
                    {
                        sql = "select KeyMeta from " + Pre + "sys_channelclass where ID=@ID and ChID=@ChID";
                    }
                    else
                    {
                        sql = "select DescMeta from " + Pre + "sys_channelclass where ID=@ID and ChID=@ChID";
                    }
                    return Convert.ToString(DbHelper.ExecuteScalar(CommandType.Text, sql, param));
                case "ChNews":
                    if (Num == 0)
                    {
                        sql = "select Metakeywords from " + GetCHDatable(ChID) + " where ID=@ID and ChID=@ChID";
                    }
                    else
                    {
                        sql = "select Metadesc from " + GetCHDatable(ChID) + " where ID=@ID and ChID=@ChID";
                    }
                    return Convert.ToString(DbHelper.ExecuteScalar(CommandType.Text, sql, param));
                case "ChSpecial":
                    if (Num == 0)
                    {
                        sql = "select specialCName from " + Pre + "sys_channelspecial where ID=@ID and ChID=@ChID";
                    }
                    else
                    {
                        sql = "select navicontent from " + Pre + "sys_channelspecial where ID=@ID and ChID=@ChID";
                    }
                    return Convert.ToString(DbHelper.ExecuteScalar(CommandType.Text, sql, param));
                default:
                    return string.Empty;
            }
        }

        public IDataReader GetCHPosition(int ID, int Num, int ChID)
        {
            SqlParameter param = new SqlParameter("@ID", ID);
            string sql = string.Empty;
            switch (Num)
            {
                case 0:
                    sql = "select id,SavePath,FileName,isDelPoint,classCName,ParentID from " + Pre + "sys_channelclass where id=@ID and ChID=" + ChID + "";
                    break;
                case 1:
                    sql = "select b.id,b.SavePath,b.FileName,b.isDelPoint,classCName,b.ParentID from " + GetCHDatable(ChID) + " a," + Pre + "sys_channelclass b where a.id=@ID and a.ClssID=b.ID";
                    break;
                case 2:
                    sql = "select id,parentID,SavePath,filename,specialCName from " + Pre + "sys_channelspecial where id=@ID and ChID=" + ChID + "";
                    break;
            }
            return DbHelper.ExecuteReader(CommandType.Text, sql, param);
        }

        public IDataReader GetSingleCHPageClass(int classid)
        {
            string Sql = "select Templet,classCName,SavePath,PageContent,MetaKeywords,MetaDescript,FileName from " + Pre + "syschannelclass";
            Sql += " where ID=@ClassID and isLock=0 and isPage=1";
            SqlParameter Param = new SqlParameter("@ClassID", classid);
            return DbHelper.ExecuteReader(CommandType.Text, Sql, Param);
        }

        public IDataReader GetCHNewsSavePath(int newsid, int ChID)
        {
            string Sql = "select a.templet,a.classid,a.SavePath,a.FileName,b.SavePath as SavePath1,b.FileName as FileName1,a.id,a.isDelPoint from " + GetCHDatable(ChID) + " a, ";
            Sql += Pre + "sys_channelclass b where a.classid=b.id and a.id=@newsid";
            SqlParameter Param = new SqlParameter("@newsid", newsid);
            return DbHelper.ExecuteReader(CommandType.Text, Sql, Param);
        }


        public DataTable GetLastCHNews(int topnum, int classid, int ChID)
        {
            SqlParameter Param = null;
            string Sql = "select top " + topnum + " a.Title,a.Content,a.CreatTime,a.SavePath,a.FileName,";
            Sql += "b.savepath as savepath1,b.ClassEName,b.ClassCName,b.id as id1 from " + GetCHDatable(ChID) + " a," + Pre + "sys_channelclass b";
            Sql += " where a.islock=0  and a.ClassID=b.id and b.isPage!=1 and b.islock=0";
            if (classid != 0)
            {
                Sql += " and b.id=@ClassID";
                Param = new SqlParameter("@ClassID", classid);
            }
            Sql += " order by a.id desc";
            return DbHelper.ExecuteTable(CommandType.Text, Sql, Param);
        }

        public IDataReader GetFriend(int Type, int Number, int IsAdmin)
        {
            string sql = string.Empty;
            SqlParameter[] param = new SqlParameter[3];
            param[0] = new SqlParameter("@Type", SqlDbType.Int, 4);
            param[0].Value = Type;
            param[1] = new SqlParameter("@Number", SqlDbType.Int, 4);
            param[1].Value = Number;
            param[2] = new SqlParameter("@IsAdmin", SqlDbType.Int, 4);
            param[2].Value = IsAdmin;
            if (IsAdmin == 3)
            {
                sql = "select top " + Number + " Name,Url,PicUrl,Content from " + Pre + "friend_link where Type=@Type and Lock=0 order by id desc";
            }
            else
            {
                sql = "select top " + Number + " Name,Url,PicUrl,Content from " + Pre + "friend_link where Type=@Type and isUser=@IsAdmin and Lock=0 order by id desc";
            }
            return DbHelper.ExecuteReader(CommandType.Text, sql, param);
        }
        #endregion
    }
}

⌨️ 快捷键说明

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