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;
using UUN;
using System.Data.SqlClient;

public partial class Admin_GuangGao_GuangGaoFenLei_XiuGai : System.Web.UI.Page
{
    private 访问 访问;
    protected int ID;
    protected void Page_Load(object sender, EventArgs e)
    {
        访问 = new 访问(this.Context);
        访问.开始处理("修改广告分类", "网站后台", "修改广告分类", new 访问.回调委托(ZhiXing));
        访问.关闭连接();
    }

    private void ZhiXing()
    {
        访问.验证管理员();

        ID = Convert.ToInt32(Request.QueryString["ID"]);
        if (this.IsPostBack)
            修改分类();
        else
            初始化();
    }

    private void 初始化()
    {
        Hashtable 广告分类=常用.SQL_获取(new SqlCommand("SELECT [分类名称] FROM [" + 程序.数据表前缀 + "其它_广告_分类] WHERE [ID]=" + ID, 访问.连接));

        if (广告分类 == null)
            throw new Exception("广告分类不存在");

        FenLeiMingChen.Text = 广告分类["分类名称"].ToString();
    }

    private void 修改分类()
    {
        String 分类名称 = FenLeiMingChen.Text;
        SqlCommand 语句 = new SqlCommand("UPDATE [" + 程序.数据表前缀 + "其它_广告_分类] SET [分类名称]=@分类名称 WHERE [ID]=" + ID, 访问.连接);
        语句.Parameters.Add("@分类名称", SqlDbType.NVarChar).Value = 分类名称;
        语句.ExecuteNonQuery();

        Response.Redirect("GuangGaoFenLei.aspx");
    }
}
