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

📄 publish.cs

📁 最好用的站点内容管理系统 全部源代码都有
💻 CS
📖 第 1 页 / 共 5 页
字号:
using System;
using System.Data;
using System.Data.SqlClient;
using NetCMS.DALFactory;
using NetCMS.Model;
using System.Text.RegularExpressions;
using System.Text;
using System.Collections.Generic;
using System.Reflection;
using NetCMS.DALProfile;
using NetCMS.Config;

namespace NetCMS.DALSQLServer
{
    public class Publish : DbBase, IPublish
    {
        public IDataReader GetSysParam()
        {
            string Sql = "select top 1 LinkType,SiteDomain,SaveIndexPage,SiteName,CopyRight from " + Pre + "sys_param order by id desc";
            return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
        }
        public IList<PubClassInfo> GetClassList()
        {
            IList<PubClassInfo> list = new List<PubClassInfo>();
            string Sql = "select Id,ClassID,ClassCName,ClassEName,ParentID,IsURL,URLaddress,ClassTemplet,SavePath,SaveClassframe,ClassSaveRule";
            Sql += ",ClassIndexRule,SiteID,NaviPIC,NaviContent,MetaKeywords,MetaDescript,isDelPoint,Gpoint,iPoint,GroupNumber,NaviShowtf,NaviPosition,NewsPosition,isPage";
            Sql += " from " + Pre + "news_Class where isRecyle=0 and isLock=0";
            IDataReader rd = DbHelper.ExecuteReader(CommandType.Text, Sql, null);
            while (rd.Read())
            {
                PubClassInfo info = new PubClassInfo();
                info.Id = (int)rd["Id"];
                info.ClassID = rd["ClassID"].ToString();
                if (rd["ClassCName"] != DBNull.Value) info.ClassCName = rd["ClassCName"].ToString();
                if (rd["ClassEName"] != DBNull.Value) info.ClassEName = rd["ClassEName"].ToString();
                if (rd["ParentID"] != DBNull.Value) info.ParentID = rd["ParentID"].ToString();
                if (rd["IsURL"] != DBNull.Value) info.IsURL = Convert.ToInt32(rd["IsURL"].ToString());
                if (rd["URLaddress"] != DBNull.Value) info.URLaddress = rd["URLaddress"].ToString();
                if (rd["ClassTemplet"] != DBNull.Value) info.ClassTemplet = rd["ClassTemplet"].ToString();
                if (rd["SavePath"] != DBNull.Value) info.SavePath = rd["SavePath"].ToString();
                if (rd["SaveClassframe"] != DBNull.Value) info.SaveClassframe = rd["SaveClassframe"].ToString();
                if (rd["ClassSaveRule"] != DBNull.Value) info.ClassSaveRule = rd["ClassSaveRule"].ToString();
                if (rd["ClassIndexRule"] != DBNull.Value) info.ClassIndexRule = rd["ClassIndexRule"].ToString();
                if (rd["SiteID"] != DBNull.Value) info.SiteID = rd["SiteID"].ToString();
                if (rd["NaviPIC"] != DBNull.Value) info.NaviPIC = rd["NaviPIC"].ToString();
                if (rd["NaviContent"] != DBNull.Value) info.NaviContent = rd["NaviContent"].ToString();
                if (rd["MetaKeywords"] != DBNull.Value) info.MetaKeywords = rd["MetaKeywords"].ToString();
                if (rd["MetaDescript"] != DBNull.Value) info.MetaDescript = rd["MetaDescript"].ToString();
                if (rd["isDelPoint"] != DBNull.Value) info.isDelPoint = Convert.ToInt32(rd["isDelPoint"].ToString());
                if (rd["Gpoint"] != DBNull.Value) info.Gpoint = Convert.ToInt32(rd["Gpoint"].ToString());
                if (rd["iPoint"] != DBNull.Value) info.iPoint = Convert.ToInt32(rd["iPoint"].ToString());
                if (rd["GroupNumber"] != DBNull.Value) info.GroupNumber = rd["GroupNumber"].ToString();
                if (rd["NaviPosition"] != DBNull.Value) info.NaviPosition = rd["NaviPosition"].ToString();
                if (rd["NewsPosition"] != DBNull.Value) info.NewsPosition = rd["NewsPosition"].ToString();
                if (rd["isPage"] != DBNull.Value) info.isPage = Convert.ToInt32(rd["isPage"].ToString());
                if (rd["NaviShowtf"] != DBNull.Value) info.NaviShowtf = Convert.ToInt32(rd["NaviShowtf"].ToString());
                list.Add(info);
            }
            rd.Close();
            return list;
        }

        public IList<PubCHClassInfo> GetCHClassList()
        {
            IList<PubCHClassInfo> list = new List<PubCHClassInfo>();
            string Sql = "select Id,ClassCName,ClassEName,ParentID,Templet,SavePath,FileName";
            Sql += ",ChID,PicURL,NaviContent,KeyMeta,DescMeta,isDelPoint,Gpoint,iPoint,GroupNumber,ClassNavi,ContentNavi,isPage";
            Sql += " from " + Pre + "sys_channelclass where isLock=0";
            IDataReader rd = DbHelper.ExecuteReader(CommandType.Text, Sql, null);
            while (rd.Read())
            {
                PubCHClassInfo info = new PubCHClassInfo();
                info.Id = (int)rd["Id"];
                if (rd["classCName"] != DBNull.Value) info.classCName = rd["classCName"].ToString();
                if (rd["classEName"] != DBNull.Value) info.classEName = rd["classEName"].ToString();
                if (rd["ParentID"] != DBNull.Value) info.ParentID = Convert.ToInt32(rd["ParentID"].ToString());
                if (rd["Templet"] != DBNull.Value) info.Templet = rd["Templet"].ToString();
                if (rd["SavePath"] != DBNull.Value) info.SavePath = rd["SavePath"].ToString();
                if (rd["FileName"] != DBNull.Value) info.FileName = rd["FileName"].ToString();
                if (rd["ChID"] != DBNull.Value) info.ChID = Convert.ToInt32(rd["ChID"].ToString());
                if (rd["PicURL"] != DBNull.Value) info.PicURL = rd["PicURL"].ToString();
                if (rd["NaviContent"] != DBNull.Value) info.NaviContent = rd["NaviContent"].ToString();
                if (rd["KeyMeta"] != DBNull.Value) info.MetaKeywords = rd["KeyMeta"].ToString();
                if (rd["DescMeta"] != DBNull.Value) info.MetaDescript = rd["DescMeta"].ToString();
                if (rd["isDelPoint"] != DBNull.Value) info.isDelPoint = Convert.ToInt32(rd["isDelPoint"].ToString());
                if (rd["Gpoint"] != DBNull.Value) info.Gpoint = Convert.ToInt32(rd["Gpoint"].ToString());
                if (rd["iPoint"] != DBNull.Value) info.iPoint = Convert.ToInt32(rd["iPoint"].ToString());
                if (rd["GroupNumber"] != DBNull.Value) info.GroupNumber = rd["GroupNumber"].ToString();
                if (rd["ClassNavi"] != DBNull.Value) info.ClassNavi = rd["ClassNavi"].ToString();
                if (rd["ContentNavi"] != DBNull.Value) info.ContentNavi = rd["ContentNavi"].ToString();
                if (rd["isPage"] != DBNull.Value) info.isPage = Convert.ToInt32(rd["isPage"].ToString());
                list.Add(info);
            }
            rd.Close();
            return list;
        }

        public IList<PubSpecialInfo> GetSpecialList()
        {
            IList<PubSpecialInfo> list = new List<PubSpecialInfo>();
            string Sql = "select Id,SpecialID,SpecialCName,specialEName,ParentID,isDelPoint,saveDirPath,SavePath,FileName,FileEXName,NaviPicURL,";
            Sql += "NaviContent,SiteID,Templet,NaviPosition,Gpoint,iPoint,GroupNumber";
            Sql += " from " + Pre + "news_special where isRecyle=0 and isLock=0";
            IDataReader rd = DbHelper.ExecuteReader(CommandType.Text, Sql, null);
            while (rd.Read())
            {
                PubSpecialInfo info = new PubSpecialInfo();
                info.Id = (int)rd["Id"];
                info.SpecialID = rd["SpecialID"].ToString();
                if (rd["SpecialCName"] != DBNull.Value) info.SpecialCName = rd["SpecialCName"].ToString();
                if (rd["specialEName"] != DBNull.Value) info.specialEName = rd["specialEName"].ToString();
                if (rd["ParentID"] != DBNull.Value) info.ParentID = rd["ParentID"].ToString();
                if (rd["isDelPoint"] != DBNull.Value) info.isDelPoint = Convert.ToInt32(rd["isDelPoint"].ToString());
                if (rd["Gpoint"] != DBNull.Value) info.Gpoint = Convert.ToInt32(rd["Gpoint"].ToString());
                if (rd["iPoint"] != DBNull.Value) info.iPoint = Convert.ToInt32(rd["iPoint"].ToString());
                if (rd["GroupNumber"] != DBNull.Value) info.GroupNumber = rd["GroupNumber"].ToString();
                if (rd["saveDirPath"] != DBNull.Value) info.saveDirPath = rd["saveDirPath"].ToString();
                if (rd["SavePath"] != DBNull.Value) info.SavePath = rd["SavePath"].ToString();
                if (rd["FileName"] != DBNull.Value) info.FileName = rd["FileName"].ToString();
                if (rd["FileEXName"] != DBNull.Value) info.FileEXName = rd["FileEXName"].ToString();
                if (rd["NaviPicURL"] != DBNull.Value) info.NaviPicURL = rd["NaviPicURL"].ToString();
                if (rd["NaviContent"] != DBNull.Value) info.NaviContent = rd["NaviContent"].ToString();
                if (rd["SiteID"] != DBNull.Value) info.SiteID = rd["SiteID"].ToString();
                if (rd["Templet"] != DBNull.Value) info.Templet = rd["Templet"].ToString();
                if (rd["NaviPosition"] != DBNull.Value) info.NaviPosition = rd["NaviPosition"].ToString();
                list.Add(info);
            }
            rd.Close();
            return list;
        }

        public IList<PubCHSpecialInfo> GetCHSpecialList()
        {
            IList<PubCHSpecialInfo> list = new List<PubCHSpecialInfo>();
            string Sql = "select Id,ChID,specialCName,specialEName,ParentID,binddomain,navicontent,savePath,filename,templet,";
            Sql += "islock,isRec,PicURL,OrderID,SiteID";
            Sql += " from " + Pre + "sys_channelspecial where isLock=0";
            IDataReader rd = DbHelper.ExecuteReader(CommandType.Text, Sql, null);
            while (rd.Read())
            {
                PubCHSpecialInfo info = new PubCHSpecialInfo();
                info.Id = (int)rd["Id"];
                info.ChID = Convert.ToInt32(rd["ChID"].ToString());
                if (rd["specialCName"] != DBNull.Value) info.specialCName = rd["specialCName"].ToString();
                if (rd["specialEName"] != DBNull.Value) info.specialEName = rd["specialEName"].ToString();
                if (rd["ParentID"] != DBNull.Value) info.ParentID = Convert.ToInt32(rd["ParentID"].ToString());
                if (rd["binddomain"] != DBNull.Value) info.binddomain = rd["binddomain"].ToString();
                if (rd["navicontent"] != DBNull.Value) info.navicontent = rd["navicontent"].ToString();
                if (rd["savePath"] != DBNull.Value) info.savePath = rd["savePath"].ToString();
                if (rd["filename"] != DBNull.Value) info.filename = rd["filename"].ToString();
                if (rd["templet"] != DBNull.Value) info.templet = rd["templet"].ToString();
                if (rd["islock"] != DBNull.Value) info.islock = Convert.ToInt32(rd["islock"].ToString());
                if (rd["isRec"] != DBNull.Value) info.isRec = Convert.ToInt32(rd["isRec"].ToString());
                if (rd["PicURL"] != DBNull.Value) info.PicURL = rd["PicURL"].ToString();
                if (rd["OrderID"] != DBNull.Value) info.OrderID = Convert.ToInt32(rd["OrderID"].ToString());
                if (rd["SiteID"] != DBNull.Value) info.SiteID = rd["SiteID"].ToString();
                list.Add(info);
            }
            rd.Close();
            return list;
        }

        public DataTable GetLastNews(int topnum, string classid)
        {
            SqlParameter Param = null;
            string Sql = "select top " + topnum + " a.NewsTitle,a.sNewsTitle,a.URLaddress,a.Content,a.CreatTime,a.SavePath,a.FileName,a.FileEXName,";
            Sql += "b.savepath as savepath1,b.SaveClassframe,b.ClassEName,b.ClassCName,b.ClassSaveRule from " + Pre + "news a," + Pre + "news_class b";
            Sql += " where a.islock=0  and a.ClassID=b.ClassID and a.isRecyle=0 and b.isPage!=1 and b.islock=0";
            if (classid != "0")
            {
                Sql += " and b.ClassID=@ClassID";
                Param = new SqlParameter("@ClassID", classid);
            }
            Sql += " order by a.id desc";
            return DbHelper.ExecuteTable(CommandType.Text, Sql, Param);
        }
        public DataTable GetTodayNews(string siteid, string classid)
        {
            string Sql = "select NewsType,NewsTitle,URLaddress,SavePath,FileName,FileEXName from " + Pre + "news where ClassID=@ClassID";
            Sql += " And DateDiff(Day,[creatTime] ,Getdate()) = 0 and islock=0 and isRecyle=0 and SiteID=@SiteID order by id desc";
            SqlParameter[] Param = new SqlParameter[]{
                new SqlParameter("@ClassID",classid),
            new SqlParameter("@SiteID",siteid)};
            return DbHelper.ExecuteTable(CommandType.Text, Sql, Param);
        }
        public IDataReader GetSinglePageClass(string classid)
        {
            string Sql = "select ClassTemplet,ClassCName,SavePath,PageContent,MetaKeywords,MetaDescript from " + Pre + "news_class";
            Sql += " where ClassID=@ClassID and isLock=0 and isRecyle=0 and isPage=1";
            SqlParameter Param = new SqlParameter("@ClassID", classid);
            return DbHelper.ExecuteReader(CommandType.Text, Sql, Param);
        }
        public IDataReader GetNewsSavePath(string newsid)
        {
            string Sql = "select a.templet,a.classid,a.datalib,a.SavePath,a.FileName,a.FileEXName,b.SavePath as SavePath1,b.SaveClassframe,a.NewsID,a.isDelPoint,a.Tags,a.NewsTitle from " + Pre + "news a, ";
            Sql += Pre + "news_class b where a.classid=b.classid and a.newsid=@newsid";
            SqlParameter Param = new SqlParameter("@newsid", newsid);
            return DbHelper.ExecuteReader(CommandType.Text, Sql, Param);
        }
        public string GetSysLabelContent(string labelname)
        {
            string Sql = "select Label_Content from " + Pre + "sys_Label where Label_Name=@Label_Name and isBack=0 and isRecyle=0";
            SqlParameter Param = new SqlParameter("@Label_Name", labelname);
            return Convert.ToString(DbHelper.ExecuteScalar(CommandType.Text, Sql, Param));
        }

        /// <summary>
        ///从频道标签库中获取数据
        /// </summary>
        /// <param name="labelname"></param>
        /// <returns></returns>
        public string GetChannelSysLabelContent(string labelname)
        {
            string Sql = "select LabelContent from " + Pre + "sys_channellabel where LabelName=@LabelName and isLock=0";
            SqlParameter Param = new SqlParameter("@LabelName", labelname);
            return Convert.ToString(DbHelper.ExecuteScalar(CommandType.Text, Sql, Param));
        }

        public IDataReader GetFreeLabelContent(string labelname)
        {
            string Sql = "select LabelSQL,StyleContent from " + Pre + "sys_LabelFree where LabelName=@LabelName";
            SqlParameter Param = new SqlParameter("@LabelName", labelname);
            return DbHelper.ExecuteReader(CommandType.Text, Sql, Param);
        }

        public DataTable ExecuteSql(string sql)
        {
            return DbHelper.ExecuteTable(CommandType.Text, sql, null);
        }
        public IDataReader GetTemplatePath()
        {

⌨️ 快捷键说明

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