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

📄 recyle.cs

📁 最好用的站点内容管理系统 全部源代码都有
💻 CS
📖 第 1 页 / 共 3 页
字号:
                    string str_Sql = "Delete From " + tbname + " Where SiteID='" + SiteID + "' And isRecyle=1";
                    DbHelper.ExecuteNonQuery(CommandType.Text, str_Sql, null);
                }
                dt.Clear(); dt.Dispose();
            }
        }
        public void DallCList()
        {
            SqlConnection Conn = new SqlConnection(DBConfig.CmsConString);
            Conn.Open();
            SqlTransaction tran = Conn.BeginTransaction();
            try
            {
                DataTable dt = getNewsTable();
                if (dt != null)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        string tbname = dt.Rows[i][0].ToString();

                        string str_Sql = "Delete From " + Pre + "API_commentary Where InfoID In(" +
                                         "Select NewsID From " + tbname + " Where SiteID In(" +
                                         "Select ChannelID From " + Pre + " news_site Where isRecyle=1 And SiteID='" + SiteID + "'))";
                        DbHelper.ExecuteNonQuery(tran, CommandType.Text, str_Sql, null);

                        string str_Sql1 = "Delete From " + tbname + " Where SiteID In(" +
                                          "Select ChannelID From " + Pre + " news_site Where isRecyle=1 And SiteID='" + SiteID + "')";
                        DbHelper.ExecuteNonQuery(tran, CommandType.Text, str_Sql1, null);

                        string str_Sql2 = "Delete From " + Pre + "news_Class Where SiteID In(" +
                                          "Select ChannelID From " + Pre + " news_site Where isRecyle=1 And SiteID='" + SiteID + "')";
                        DbHelper.ExecuteNonQuery(tran, CommandType.Text, str_Sql2, null);

                        string str_Sql3 = "Delete From " + Pre + "news_special Where SiteID In(" +
                                          "Select ChannelID From " + Pre + " news_site Where isRecyle=1 And SiteID='" + SiteID + "')";
                        DbHelper.ExecuteNonQuery(tran, CommandType.Text, str_Sql3, null);

                        string str_Sql4 = "Delete From " + Pre + "news_site Where isRecyle=1 And SiteID='" + SiteID + "'";
                        DbHelper.ExecuteNonQuery(tran, CommandType.Text, str_Sql4, null);

                    }
                    tran.Commit();
                }
                Conn.Close();
            }
            catch (SqlException e)
            {
                tran.Rollback();
                Conn.Close();
                throw e;
            }
        }
        public void DallSList()
        {
            string Sql = "Delete From " + Pre + "special_news Where SpecialID In (Select SpecialID From " + Pre + "news_special Where isRecyle=1 And SiteID='" + SiteID + "')";
            DbHelper.ExecuteNonQuery(CommandType.Text, Sql, null);
            string str_Sql = "Delete From " + Pre + "news_special Where isRecyle=1 And SiteID='" + SiteID + "'";
            DbHelper.ExecuteNonQuery(CommandType.Text, str_Sql, null);
        }
        public void DallLCList()
        {
            SqlConnection Conn = new SqlConnection(DBConfig.CmsConString);
            Conn.Open();
            SqlTransaction tran = Conn.BeginTransaction();
            try
            {
                string str_Sql = "Delete From " + Pre + "sys_Label Where ClassID In (Select ClassID " +
                                 "From " + Pre + "sys_LabelClass Where SiteID='" + SiteID + "' And isRecyle=1)";
                DbHelper.ExecuteNonQuery(tran, CommandType.Text, str_Sql, null);
                string str_Sql1 = "Delete From " + Pre + "sys_LabelClass Where SiteID='" + SiteID + "' And isRecyle=1";
                DbHelper.ExecuteNonQuery(tran, CommandType.Text, str_Sql1, null);
                tran.Commit();
                Conn.Close();
            }
            catch (SqlException e)
            {
                tran.Rollback();
                Conn.Close();
                throw e;
            }
        }
        public void DallLList()
        {
            string str_Sql = "Delete From " + Pre + "sys_Label Where isRecyle=1 And SiteID='" + SiteID + "'";
            DbHelper.ExecuteNonQuery(CommandType.Text, str_Sql, null);
        }
        public void DallStCList()
        {
            SqlConnection Conn = new SqlConnection(DBConfig.CmsConString);
            Conn.Open();
            SqlTransaction tran = Conn.BeginTransaction();
            try
            {
                string str_Sql = "Delete From " + Pre + "sys_LabelStyle Where ClassID In (Select" +
                                 " ClassID From " + Pre + "sys_styleclass Where SiteID='" + SiteID + "' And isRecyle=1)";
                DbHelper.ExecuteNonQuery(tran, CommandType.Text, str_Sql, null);
                string str_Sql1 = "Delete From " + Pre + "sys_styleclass Where SiteID='" + SiteID + "' And isRecyle=1";
                DbHelper.ExecuteNonQuery(tran, CommandType.Text, str_Sql1, null);
                tran.Commit();
                Conn.Close();
            }
            catch (SqlException e)
            {
                tran.Rollback();
                Conn.Close();
                throw e;
            }
        }
        public void DallStList()
        {
            string str_Sql = "Delete From " + Pre + "sys_LabelStyle Where SiteID='" + SiteID + "' And isRecyle=1";
            DbHelper.ExecuteNonQuery(CommandType.Text, str_Sql, null);
        }
        public void DallPSFList()
        {
            string str_Sql = "Delete From " + Pre + "sys_PSF Where isRecyle=1 And SiteID='" + SiteID + "'";
            DbHelper.ExecuteNonQuery(CommandType.Text, str_Sql, null);
        }
        //---------------------------------------------------------------------------------------------------------------------------------------
        //---------------------------------------------------------------------------------------------------------------------------------------
        public void PRNCList(string idstr)
        {
            string[] arr_id = idstr.Split(',');
            for (int i = 0; i < arr_id.Length; i++)
            {
                string classid = arr_id[i].ToString().Replace("'", "");
                string str_Sql = "";

                if (checkParIsDel(classid, "news_Class") == true)
                    str_Sql = "Update " + Pre + "news_Class Set isRecyle=0,ParentID='0' Where SiteID='" + SiteID + "' and ClassID='" + classid + "'";
                else
                    str_Sql = "Update " + Pre + "news_Class Set isRecyle=0 Where SiteID='" + SiteID + "' and ClassID='" + classid + "'";

                DbHelper.ExecuteNonQuery(CommandType.Text, str_Sql, null);
            }
        }
        public void PRNList(string classid, string idstr)
        {
            DataTable dt = getNewsTable();
            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string tbname = dt.Rows[i][0].ToString();
                    string[] arr_id = idstr.Split(',');
                    for (int j = 0; j < arr_id.Length; j++)
                    {
                        string tempNewsID = arr_id[j].ToString().Replace("'", "");
                        string str_Sql = "Select NewsID,ClassID From " + tbname + " Where isRecyle=1 And " +
                                         "SiteID='" + SiteID + "' And NewsID='" + tempNewsID + "'";
                        DataTable dv = DbHelper.ExecuteTable(CommandType.Text, str_Sql, null);
                        if (dv != null)
                        {
                            if (dv.Rows.Count > 0)
                            {
                                string str_Sql1 = "";
                                string newsclassid = dv.Rows[0][1].ToString();
                                string newsid = dv.Rows[0][0].ToString();

                                if (checkParIsDel(newsclassid, "news_Class") == true)
                                    str_Sql1 = "Update " + tbname + " Set isRecyle=0,ClassID='" + classid + "' Where SiteID='" + SiteID + "' and NewsID='" + newsid + "'";
                                else
                                    str_Sql1 = "Update " + tbname + " Set isRecyle=0 Where SiteID='" + SiteID + "' and NewsID='" + newsid + "'";

                                DbHelper.ExecuteNonQuery(CommandType.Text, str_Sql1, null);
                            }
                            dv.Clear(); dv.Dispose();
                        }
                    }
                }
                dt.Clear(); dt.Dispose();
            }
        }
        public void PRCList(string idstr)
        {
            string str_Sql = "Update " + Pre + "news_site Set isRecyle=0 Where SiteID='" + SiteID + "' And ChannelID in(" + idstr + ")";
            DbHelper.ExecuteNonQuery(CommandType.Text, str_Sql, null);
        }
        public void PRSList(string idstr)
        {
            string[] arr_id = idstr.Split(',');
            string str_Sql = "";
            for (int i = 0; i < arr_id.Length; i++)
            {
                string Id = arr_id[i].Replace("'", "");
                if (getParentlockTf(Id, "news_special", "SpecialID") == false)
                    str_Sql = "Update " + Pre + "news_special Set isRecyle=0 Where SiteID='" + SiteID + "' And SpecialID='" + Id + "'";
                else
                    str_Sql = "Update " + Pre + "news_special Set isRecyle=0,ParentID='0' Where SiteID='" + SiteID + "' And SpecialID='" + Id + "'";

                DbHelper.ExecuteNonQuery(CommandType.Text, str_Sql, null);
            }
        }
        public void PRStCList(string idstr)
        {
            string str_Sql = "Update " + Pre + "sys_styleclass Set isRecyle=0 Where SiteID='" + SiteID + "' And ClassID In (" + idstr + ")";
            DbHelper.ExecuteNonQuery(CommandType.Text, str_Sql, null);
        }
        public void PRStList(string classid, string idstr)
        {
            string str_Sql = "Select ClassID From " + Pre + "sys_styleclass Where isRecyle=1 And " +
                             "SiteID='" + SiteID + "' And ClassID In (" + idstr + ")";
            DataTable dt = DbHelper.ExecuteTable(CommandType.Text, str_Sql, null);
            if (dt != null)
            {
                string str_Sql1 = "";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string styleclassid = dt.Rows[i]["ClassID"].ToString();
                    string styleid = dt.Rows[i]["styleID"].ToString();

                    if (checkParIsDel(styleclassid, "sys_styleclass") == true)
                        str_Sql1 = "Update " + Pre + "sys_LabelStyle Set isRecyle=0,ClassID='" + styleclassid + "' Where SiteID='" + SiteID + "' And styleID='" + styleid + "'";
                    else
                        str_Sql1 = "Update " + Pre + "sys_LabelStyle Set isRecyle=0 Where SiteID='" + SiteID + "' And styleID='" + styleid + "'";

                    DbHelper.ExecuteNonQuery(CommandType.Text, str_Sql1, null);
                }
                dt.Clear(); dt.Dispose();
            }
        }
        public void PRLCList(string idstr)
        {
            string str_Sql = "Update " + Pre + "sys_LabelClass Set isRecyle=0 Where SiteID='" + SiteID + "' And ClassID In (" + idstr + ")";
            DbHelper.ExecuteNonQuery(CommandType.Text, str_Sql, null);
        }
        public void PRLList(string classid, string idstr)
        {
            string str_Sql = "Select LabelID,ClassID From " + Pre + "sys_Label Where isRecyle=1 " +
                             "And SiteID='" + SiteID + "' And LabelID In (" + idstr + ")";
            DataTable dt = DbHelper.ExecuteTable(CommandType.Text, str_Sql, null);
            if (dt != null)
            {
                string str_Sql1 = "";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string strclassid = dt.Rows[i]["ClassID"].ToString();
                    string strlabelid = dt.Rows[i]["LabelID"].ToString();

                    if (checkParIsDel(strclassid, "sys_LabelClass") == true)
                        str_Sql1 = "Update " + Pre + "sys_Label Set isRecyle=0,ClassID='" + classid + "' Where SiteID='" + SiteID + "' And LabelID='" + strlabelid + "'";
                    else
                        str_Sql1 = "Update " + Pre + "sys_Label Set isRecyle=0 Where SiteID='" + SiteID + "' And LabelID='" + strlabelid + "'";

                    DbHelper.ExecuteNonQuery(CommandType.Text, str_Sql1, null);
                }
                dt.Clear(); dt.Dispose();
            }
        }
        public void PRPSFList(string idstr)
        {
            string str_Sql = "Update " + Pre + "sys_PSF Set isRecyle=0 Where SiteID='" + SiteID + "' And psfID In (" + idstr + ")";
            DbHelper.ExecuteNonQuery(CommandType.Text, str_Sql, null);
        }
        //---------------------------------------------------------------------------------------------------------------------------------------
        //---------------------------------------------------------------------------------------------------------------------------------------
        public void PDNCList(string idstr)
        {
            idstr = getIDStr(idstr, "ClassID,ParentID", "news_Class");
            SqlConnection Conn = new SqlConnection(DBConfig.CmsConString);
            Conn.Open();
            SqlTransaction tran = Conn.BeginTransaction();
            try
            {
                DataTable dt = getNewsTable();
                if (dt != null)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        string tbname = dt.Rows[i][0].ToString();
                        string str_Sql = "Delete From " + tbname + " Where ClassID In (Select ClassID From " + Pre + "news_Class" +
                                         " Where SiteID='" + SiteID + "' And isRecyle=1 And ClassID In(" + idstr + "))";
                        DbHelper.ExecuteNonQuery(tran, CommandType.Text, str_Sql, null);
                        string str_Sql1 = "Delete From " + Pre + "news_Class Where SiteID='" + SiteID + "' And isRecyle=1 And ClassID In(" + idstr + ")";
                        DbHelper.ExecuteNonQuery(tran, CommandType.Text, str_Sql1, null);
                    }
                    tran.Commit();
                    dt.Clear(); dt.Dispose();
                }
                Conn.Close();
            }
            catch (SqlException e)
            {
                tran.Rollback();
                Conn.Close();
                throw e;
            }
        }
        public void PDNList(string idstr)

⌨️ 快捷键说明

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