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

📄 contentmanage.cs

📁 最好用的站点内容管理系统 全部源代码都有
💻 CS
📖 第 1 页 / 共 5 页
字号:
//======================================================
//==     (c)2008 aspxcms inc by NeTCMS v1.0              ==
//==          Forum:bbs.aspxcms.com                   ==
//==         Website:www.aspxcms.com                  ==
//======================================================
using System;
using System.Data;
using System.Data.SqlClient;
using NetCMS.DALFactory;
using NetCMS.Model;
using System.Text.RegularExpressions;
using System.Text;
using System.Reflection;
using NetCMS.DALProfile;
using NetCMS.Config;

namespace NetCMS.DALSQLServer
{
    public class ContentManage : DbBase, IContentManage
    {

        /// <summary>
        /// 得到站点栏目列表结果  
        /// </summary>
        /// <returns></returns>
        public IDataReader GetClassSitenewsstr(string ParentID, string SiteID)
        {
            string Sql = "Select ClassID,[Domain],DataLib,SiteID,ClassCName,(Select Count(id) from " + Pre + "news_Class where ParentID=a.ClassID and isRecyle=0 and isUrl=0 and islock=0 and isPage=0) as HasSub from " + Pre + "news_Class a where ParentID='" + ParentID + "' and isRecyle=0 and isUrl=0 and islock=0 and SiteID='" + SiteID + "' and isPage=0 order by OrderID desc,id desc";
            return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
        }

        #region 内容管理开始
        #region 新闻
        public void updateClassStat(int Num, string ID, int flag)
        {
            #region
            string str_sql = null;
            if (flag == 0)// 更新栏目状态:1为已生成,0表示未生成
            {
                str_sql = "update " + Pre + "news_Class set isunHTML=" + Num + " where ClassId='" + ID + "' " + NetCMS.Common.Public.getSessionStr() + "";
            }
            else if (flag == 1)// 更新新闻状态:1为已生成,0表示未生成
            {
                str_sql = "update " + Pre + "news set isHtml=" + Num + " where NewsID='" + ID + "' " + NetCMS.Common.Public.getSessionStr() + "";
            }
            else if (flag == 2)
            {
                str_sql = "Update " + Pre + "news_Class Set OrderID=" + Num + " Where ClassID='" + ID + "' and SiteID = '" + NetCMS.Global.Current.SiteID + "'";
            }
            DbHelper.ExecuteNonQuery(CommandType.Text, str_sql, null);
            #endregion
        }

        /// <summary>
        /// 新闻内容管理.得到站点表
        /// </summary>
        /// <returns></returns>

        public DataTable sel_newsInfo(int flag)
        {
            #region
            string Sql = null;
            if (flag == 0)
            {
                Sql = "select top 15 CName from " + Pre + "news_Gen where gType=0 and islock=0 order by id desc";
            }
            else if (flag == 1)
            {
                Sql = "select * from " + Pre + "sys_param";
            }
            else if (flag == 2)//// 得到内部连接地址
            {
                Sql = "select Cname,URL from " + Pre + "news_Gen where gType=3";
            }
            else if (flag == 3)// 得到自定义类型
            {
                Sql = "Select id,defineInfoId,defineCname From " + Pre + "Define_Data where 1=1 " + NetCMS.Common.Public.getSessionStr() + "";
            }
            else if (flag == 4)//得到栏目源
            {
                Sql = "Select ClassID,ClassCName,ParentID From " + Pre + "news_Class where SiteID='" + NetCMS.Global.Current.SiteID + "' and IsURL=0";
            }
            else if (flag == 5)//得到栏目
            {
                Sql = "Select ClassID,ClassCname,ParentID From " + Pre + "News_Class where SiteID='" + NetCMS.Global.Current.SiteID + "'";
            }
            else if (flag == 6)//得到站点列表
            {
                Sql = "select ID,ChannelID,CName from " + Pre + "news_site where IsURL=0 and isRecyle=0 and isLock=0 order by id";
            }
            else if (flag == 7)//得到归档新闻
            {
                Sql = "select top 1 * from " + Pre + "old_News order by id desc";
            }
            else if (flag == 8)
            {
                Sql = "select JsID,JSName from " + Pre + "News_JS where SiteID='" + NetCMS.Global.Current.SiteID + "' and jsType=1";
            }
            else if (flag == 9)
            {
                Sql = "select ClassID,ClassCName,ParentID from " + Pre + "News_Class where isURL=0 and isLock=0 and isRecyle=0 and SiteID='" + NetCMS.Global.Current.SiteID + "'";
            }
            else if (flag == 10)
            {
                Sql = "select top 1 * from " + Pre + "old_News";
            }
            else if (flag == 11)//从临时表中获取记录
            {
                Sql = "select id,NewsID,DataLib,NewsType from " + Pre + "news where islock=0 and isRecyle=0 and siteID='" + NetCMS.Global.Current.SiteID + "' order by CreatTime desc,id desc";
            }
            return DbHelper.ExecuteTable(CommandType.Text, Sql, null);
            #endregion
        }

        /// <summary>
        /// 新闻内容管理.得到索引表
        /// </summary>
        /// <returns></returns>

        public IDataReader GetNewsIndex()
        {
            string Sql = "select TableName,id from " + Pre + "sys_NewsIndex order by Id asc";
            return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
        }

        public void updateNewsPro(string str, string ID, int num)
        {
            #region
            string Sql = "";
            if (num == 0)
            {
                Sql = "Update " + Pre + "news Set NewsProperty='" + str + "' Where Id In (" + ID + ")";
            }
            else if (num == 1)
            {
                Sql = "Update " + Pre + "news Set NewsProperty='" + str + "' Where ClassID In (" + ID + ")";
            }
            else if (num == 2)
            {
                Sql = "Update " + Pre + "news Set Templet='" + str + "' Where Id In (" + ID + ")";
            }
            else if (num == 3)
            {
                Sql = "Update " + Pre + "news Set Templet='" + str + "' Where ClassID In (" + ID + ")";
            }
            else if (num == 4)
            {
                Sql = "Update " + Pre + "news Set OrderID=" + int.Parse(str) + " Where Id In (" + ID + ")";
            }
            else if (num == 5)
            {
                Sql = "Update " + Pre + "news Set OrderID=" + int.Parse(str) + " Where ClassID In (" + ID + ")";
            }
            else if (num == 6)
            {
                Sql = "Update " + Pre + "news Set CommLinkTF=" + int.Parse(str) + " Where Id In (" + ID + ")";
            }
            else if (num == 7)
            {
                Sql = "Update " + Pre + "news Set CommLinkTF=" + int.Parse(str) + " Where ClassID In (" + ID + ")";
            }
            else if (num == 8)
            {
                Sql = "Update " + Pre + "news Set Tags='" + str + "' Where Id In (" + ID + ")";
            }
            else if (num == 9)
            {
                Sql = "Update " + Pre + "news Set Tags='" + str + "' Where ClassID In (" + ID + ")";
            }
            else if (num == 10)
            {
                Sql = "Update " + Pre + "news Set Click=" + int.Parse(str) + " Where Id In (" + ID + ")";
            }
            else if (num == 11)
            {
                Sql = "Update " + Pre + "news Set Click=" + int.Parse(str) + " Where ClassID In (" + ID + ")";
            }
            else if (num == 12)
            {
                Sql = "Update " + Pre + "news Set Souce='" + str + "' Where Id In (" + ID + ")";
            }
            else if (num == 13)
            {
                Sql = "Update " + Pre + "news Set Souce='" + str + "' Where ClassID In (" + ID + ")";
            }
            else if (num == 14)
            {
                Sql = "Update " + Pre + "news Set FileEXName='" + str + "' Where Id In (" + ID + ")";
            }
            else if (num == 15)
            {
                Sql = "Update " + Pre + "news Set FileEXName='" + str + "' Where ClassID In (" + ID + ")";
            }
            else if (num == 16)//更新目标栏目
            {
                string usql = "update " + Pre + "news_class set ParentID='" + ID + "' where ParentID='" + str + "'";
                DbHelper.ExecuteNonQuery(CommandType.Text, usql, null);
                Sql = "Update " + Pre + "News Set ClassID='" + ID + "' Where ClassID='" + str + "' and SiteID = '" + NetCMS.Global.Current.SiteID + "'";
            }
            else if (num == 17)// 更新目标下新闻
            {
                Sql = "Update " + Pre + "News Set ClassID='" + ID + "' Where ClassID='" + str + "'  and SiteID = '" + NetCMS.Global.Current.SiteID + "'";
            }
            else if (num == 18)//更新栏目
            {
                Sql = "update " + Pre + "News_Class Set " + str + " where ClassID in (" + ID + ") " + NetCMS.Common.Public.getSessionStr() + "";
            }
            else if (num == 19)//更新目标下栏目
            {
                string gSQL = "select ID,ParentID from " + Pre + "News_Class where ClassID='" + str + "'";
                IDataReader dr = DbHelper.ExecuteReader(CommandType.Text, gSQL, null);
                if (dr.Read())
                {
                    string uSQL = "update " + Pre + "News_Class set ParentID='" + dr["ParentID"].ToString() + "' where ParentID='" + dr["ID"].ToString() + "'";
                    DbHelper.ExecuteNonQuery(CommandType.Text, uSQL, null);
                }
                dr.Close();
                Sql = "Update " + Pre + "News_Class Set ParentID='" + ID + "' Where ClassID='" + str + "'  and SiteID = '" + NetCMS.Global.Current.SiteID + "'";
            }
            else if (num == 20)//更新所有表
            {
                Sql = "update " + Pre + "news Set Templet = '" + str + "' where ClassID in (" + ID + ") " + NetCMS.Common.Public.getSessionStr() + "";
            }
            DbHelper.ExecuteNonQuery(CommandType.Text, Sql, null);
            #endregion
        }
        // by Simplt.Xie
        /// <summary>
        /// 得到指定新闻的DataTable
        /// </summary>
        /// <param name="NewsID"></param>
        /// <param name="DataLib"></param>
        /// <returns></returns>
        public IDataReader sel_NameID(string NewsID, int flag)
        {
            SqlParameter param = new SqlParameter("@ID", NewsID);
            string Sql = null;
            if (flag == 0)
            {
                Sql = "select a.*,b.ClassCName from " + Pre + "News a left join " + Pre + "news_Class b ";
                Sql += " on a.ClassID=b.ClassID  where a.NewsID=@ID";
            }
            else if (flag == 1)
            {
                Sql = "select ClassCName,ClassEName,ParentID,ClassID,DataLib,SavePath,SaveClassframe,ClassSaveRule from " + Pre + "news_class where ClassID=@ID " + NetCMS.Common.Public.getSessionStr() + "";
            }
            return DbHelper.ExecuteReader(CommandType.Text, Sql, param);
        }
        /// <summary>
        /// 检查新闻标题
        /// </summary>

⌨️ 快捷键说明

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