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_NeiRong_TuPianCaiJi_WangZhan_XiuGai : System.Web.UI.Page
{
    private 访问 访问;
    private new 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("图片采集网站不存在");

        WangZhanMingChen.Text = Convert.ToString(文章采集["网站名称"]);
        WangZhanDiZhi.Text = Convert.ToString(文章采集["网站地址"]);
        ZiFuBianMa.Text = Convert.ToString(文章采集["字符编码"]);
    }

    private void 修改()
    {
        String 网站名称 = WangZhanMingChen.Text;
        String 网站地址 = WangZhanDiZhi.Text;
        int 字符编码 = Convert.ToInt32(ZiFuBianMa.Text);

        SqlCommand 语句 = new SqlCommand("UPDATE [" + 程序.数据表前缀 + "内容_图片采集_网站] SET " +
            "[网站名称]=@网站名称" +
            ",[网站地址]=@网站地址" +
            ",[字符编码]=@字符编码 WHERE [ID]=" + ID, 访问.连接);
        语句.Parameters.Add("@网站名称", SqlDbType.NVarChar).Value = 网站名称;
        语句.Parameters.Add("@网站地址", SqlDbType.NVarChar).Value = 网站地址;
        语句.Parameters.Add("@字符编码", SqlDbType.Int).Value = 字符编码;
        语句.ExecuteNonQuery();

        Response.Redirect(Request.QueryString["rurl"]);
    }
}
