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 WebAdmin_eWebTop : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        admin a = new admin();
        sqlServer sql = new sqlServer();
        javasrcipt js = new javasrcipt();

        a.check("|news|");

        long id = xabara.isNum(Request.QueryString["id"]);
        string[] strValue = new string[1];
        strValue[0] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

        DataTable dt = sql.getDataTable("select TopDate,PostDate from NewsXabara where Nid=" + id.ToString());
        if (Convert.ToDateTime(dt.Rows[0]["TopDate"]) > Convert.ToDateTime(dt.Rows[0]["PostDate"])) //取消置顶
        {
            strValue[0] = dt.Rows[0]["PostDate"].ToString();
        }
        dt.Dispose();

        sql.log(a.uid, "admin", "新闻置顶");

        string returnStr = sql.update("NewsXabara", "@TopDate", strValue, "Nid=" + id.ToString());

        js.div(false, "", "text", returnStr, 300, 0, "default.aspx?ifPass=" + Request.QueryString["ifPass"] + "&cType=" + Request.QueryString["cType"], "goto");
    }
}
