using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Tool_liuyanNew : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["admin"] != null)
        {
            if (Session["admin"].ToString() != "admin")
                return;
            else
            {
                string d = Request.QueryString["t"];
                string s = Request.QueryString["s"];
                string index = Request.QueryString["index"];
                switch (d)
                {
                    case "del": DelData(s); break;
                    case "rdel": rDelData(s); break;
                    case "huifu": huifu(s, index); break;
                }
            }
        }
        else
        {
            Response.Write("-1");
            Response.Flush();
            Response.End();
        }
        
    }
    void DelData(string s)
    {
        string sql = "update message set ustatus = false where id = "+int.Parse(s);
        int k = SqlHelper.ExecuteSql(sql);
        if (k > 0)
        {
            Response.Write("1");
        }
        else
            Response.Write("0");
        Response.Flush();
        Response.End();
    }

    void rDelData(string s)
    {
        string sql = "update message set ustatus = true where id = " + int.Parse(s);
        int k = SqlHelper.ExecuteSql(sql);
        if (k > 0)
        {
            Response.Write("1");
        }
        else
            Response.Write("0");
        Response.Flush();
        Response.End();
    }


    void huifu(string s,string index)
    {
        string sql = "update message set uhuifu='" + s + "' where id = " + int.Parse(index);
        int k = SqlHelper.ExecuteSql(sql);
        if (k > 0)
        {
            Response.Write("1"); WebClass.ReMoveCacheByKey("NewTop10");
        }
        else
            Response.Write("0");
        Response.Flush();
        Response.End();
    }
}
