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

public partial class WTOSYSadmin_System_arearEdit : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["WtoRightName"] == null)
        {
            Response.Redirect("~/SYSADMIN/main/error.aspx?err=非法登陆!或系统超时，请刷新后重新登录");
        }
        if (!IsPostBack)
        {
            SqlConnection conn = CDatabase.wtoconn();
            conn.Open();
            SqlCommand smd = new SqlCommand("select * from ServiceArea where id=" + Request.QueryString["id"],conn);
            SqlDataReader sdr = smd.ExecuteReader();
            sdr.Read();
            this.AreaName.Text = sdr.GetString(1);
            this.sort.Text =Convert.ToString(sdr.GetInt32(2));
            sdr.Close();

            conn.Close();
        }
    }
    
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        if (Doadmin.Exec("update ServiceArea set AreaName='" + this.AreaName.Text.ToString().Trim() + "',sort=" + this.sort.Text + " where id="+Request.QueryString["id"]))
        {
            Response.Write("<script>alert('提交成功');window.location.href='arear.aspx'</script>");
        }
        else
        {
            Response.Write("<script>alert('此次操作不成功');window.location.href='arearadd.aspx'</script>");
        }
    }
}
