示例#1
0
文件: JpArticle.cs 项目: wjszxli/xdjb
        //����
        public void PubAll(String ids, String pubtime, String endtime)
        {
            DAO db = new DAO();
            String sql = "update JpArticle set status='����',pubtime=@pubtime,endtime=@endtime where @aids like '%,'+cast(aid as varchar(12))+',%'";
            SqlParameter[] prams ={
                db.MakeInParam("@aids", SqlDbType.VarChar, ids),
                db.MakeInParam("@pubtime", SqlDbType.DateTime, pubtime),
                db.MakeInParam("@endtime", SqlDbType.DateTime, endtime),
            };

            db.Execute(sql, prams);

            sql = "select aid, cid from JpArticle where @aids like '%,'+cast(aid as varchar(12))+',%'";
            prams = new SqlParameter[]{
                db.MakeInParam("@aids", SqlDbType.VarChar, ids)
            };
            DataTable dt = db.GetDataTable(sql, prams);
            db.Close();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                String l_cid = "";
                int l_aid = 0;
                l_cid = dt.Rows[i]["cid"].ToString();
                l_aid = Int32.Parse(dt.Rows[i]["aid"].ToString());
                JpColumns col = new JpColumns(l_cid);

                //map_add(pubtime, endtime, l_cid, l_aid);

                if (col.shtml.Equals("1"))// ��ǰ������Ŀ�Ǵ���̬�����������Զ�ˢ�£���վ��ҳ��������Ŀ��ҳ����ǰ����ҳ
                {
                    shtmlpublish(true, l_cid, l_aid);
                    col.shtmlpublish(0, 0);
                    //�����ǰ��Ŀ����һ����Ŀ����������е��ϼ�Ŀ¼
                    if (l_cid.Length > 3)
                    {
                        for (int j = 0; j < (l_cid.Length / 3 - 1); j++)
                        {
                            JpColumns col_sj = new JpColumns(l_cid.Substring(0, 3 * (j + 1)));
                            col_sj.shtmlpublish(0, 0);
                        }
                    }
                }
                if (col.shtml.Equals("0"))// ��ʱ�������߶�̬����������ˢ�������Ŀ
                {
                    col.shtmlRelation();// ������Ŀ��صľ�̬��Ŀ����
                }

                col.RssFlush(true);// RSS����
            }
            //���·���ʱͬʱ������ҳ�����õĶ���ҳ
            PubHtml_Config();
        }
示例#2
0
文件: JpColumns.cs 项目: wjszxli/xdjb
        /// <summary>
        /// RSS��̬����
        /// </summary>
        /// <param name="nest"></param>
        public void RssFlush(bool nest)
        {
            if (cid.Length > 3 && nest)
            {
                String id = cid.Substring(0, cid.Length - 3);
                JpColumns col = new JpColumns(id);
                col.RssFlush(true);
            }

            if (this.rss <= 0)
                return;
            // ������Ŀ��ҳ
            JpSite site = new JpSite();
            //System.IO.Directory.CreateDirectory(site.root + "/rss/");
            try
            {
                //JpRSS RSS = new JpRSS(cname, site.root + "/rss/" + this.cid + ".xml");
                // ��һ����������ҳ
                String sql = "SELECT * FROM v_article_url WHERE cid LIKE @cid ORDER BY pubtime DESC";// ��������

                DAO db = new DAO();

                SqlParameter[] sqlparam = {
                    db.MakeInParam("@cid",SqlDbType.VarChar,cid),
            };
                DataTable dt = db.GetDataTable(sql, sqlparam);
                int rows = 0;

                if (rss >= dt.Rows.Count)
                {
                    rows = dt.Rows.Count;
                }
                else
                {
                    rows = rss;
                }

                for (int i = 0; i < rows; i++)
                {
                    int ld_aid = Int32.Parse(dt.Rows[i]["aid"].ToString());
                    String url = "http://" + site.host + this.tmp_art + "?aid=" + ld_aid;
                    //if (this.shtml.Equals("1"))
                    //url = "http://" + site.host + "/" + site.cidPath(cid) + ld_aid + ".html";
                    JpArticle art = new JpArticle(ld_aid);
                    //JpRSSItem item = new JpRSSItem(this.cid, art.title, url, art.get("content"), 100);
                    //item.pubDate = art.pubtime;
                    //item.author = "TPortal";
                    //RSS.additem(item);
                }
                //RSS.close();
            }
            catch { }
        }
示例#3
0
文件: JpArticle.cs 项目: wjszxli/xdjb
        //ɾ��
        public void DeleteAll(String ids)
        {
            DAO db = new DAO();
            String sql = "";
            sql = "select aid, cid from JpArticle where @aids like '%,'+cast(aid as varchar(12))+',%'";
            SqlParameter[] prams = new SqlParameter[]{
                db.MakeInParam("@aids", SqlDbType.VarChar, ids)
            };
            DataTable dt = db.GetDataTable(sql, prams);
            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
            //    shtmlpublish(false, dt.Rows[i]["cid"].ToString(), Int32.Parse(dt.Rows[i]["aid"].ToString()));
            //}
            sql = "Delete FROM JpArticle where @aids like '%,'+cast(aid as varchar(12))+',%'";
            prams = new SqlParameter[]{
                db.MakeInParam("@aids", SqlDbType.VarChar, ids)
            };
            db.Execute(sql, prams);

            db.Close();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                String l_cid = "";
                int l_aid = 0;
                l_cid = dt.Rows[i]["cid"].ToString();
                l_aid = Int32.Parse(dt.Rows[i]["aid"].ToString());
                JpColumns col = new JpColumns(l_cid);

                //map_add(pubtime, endtime, l_cid, l_aid);

                if (col.shtml.Equals("1"))// ��ǰ������Ŀ�Ǵ���̬�����������Զ�ˢ�£���վ��ҳ��������Ŀ��ҳ����ǰ����ҳ
                {
                    shtmlpublish(false, l_cid, l_aid);
                    col.shtmlpublish(0, 0);
                    //�����ǰ��Ŀ����һ����Ŀ����������е��ϼ�Ŀ¼
                    if (l_cid.Length > 3)
                    {
                        for (int j = 0; j < (l_cid.Length / 3 - 1); j++)
                        {
                            JpColumns col_sj = new JpColumns(l_cid.Substring(0, 3 * (j + 1)));
                            col_sj.shtmlpublish(0, 0);
                        }
                    }
                }
                col.RssFlush(false);// RSS����
            }
            //���·���ʱͬʱ������ҳ�����õĶ���ҳ
            PubHtml_Config();
        }