using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Web.Configuration;
using System.Xml;
using SysDoor;

public partial class Root_Key_SetKey : System.Web.UI.Page
{
    string path = HttpContext.Current.Server.MapPath("~/App_Data/site.xml");
    protected void Page_Load(object sender, EventArgs e)
    {
        new RootControl().CheckRootLogin();
        if (!Page.IsPostBack)
        {
           
                XCenter xc = new XCenter();
                string mac_code = xc.CreateMachineCode();
                txt_machine_code.Text = mac_code;

                XmlDocument doc = new XmlDocument();
                doc.Load(path);
                string serial_number = doc.GetElementsByTagName("serial_number")[0].InnerText;

                txt_serial_number.Text = serial_number;
 
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        XmlDocument doc = new XmlDocument();
        doc.Load(path);
        doc.GetElementsByTagName("serial_number").Item(0).InnerText = txt_serial_number.Text; ;
        doc.Save(path);
        lbl_msg.Text = "保存成功！";
    }
}