using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using xabaraCOM;

public partial class webXabara_class_updateCache : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        admin a = new admin();
        sqlServer sql = new sqlServer();
        classify c = new classify();

        a.check("");

        if (!IsPostBack)
        {
            DataTable dt = sql.getDataTable("select Tid,fnID,TreeType,TreeName from newsTree order by Tid DESC");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                long cid = xabara.isNum(dt.Rows[i]["Tid"].ToString().Trim());
                c.updateClassName(cid);
                c.updateID(dt.Rows[i]["TreeType"].ToString().Trim(), cid);

                Response.Write("正在更新第 " + cid.ToString() + " 条 " + dt.Rows[i]["TreeName"].ToString().Trim() + "<br />");
                Response.Flush();
            }
            dt.Dispose();

            Response.Write("更新全站缓存完成！");
        }
    }
}