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 System.IO;
using SysDoor;

public partial class Root_Other_Config : 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)
        {
                XmlDocument doc = new XmlDocument();
                doc.Load(path);
                string site_url = doc.GetElementsByTagName("site_url")[0].InnerText;

                txt_site_url.Text = site_url;
 
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        XmlDocument doc = new XmlDocument();
        doc.Load(path);
        doc.GetElementsByTagName("site_url").Item(0).InnerText = txt_site_url.Text; ;
        doc.Save(path);
        CreateQRCode();
        lbl_msg.Text = "保存成功！";
    }
    /// <summary>
    /// 生成二维码
    /// </summary>
    void CreateQRCode()
    {
        string filename = "qrcode_phone_site.jpg";
        string path = HttpContext.Current.Server.MapPath("~/App_Data/site.xml");
        XmlDocument doc = new XmlDocument();
        doc.Load(path);
        string site_url = doc.GetElementsByTagName("site_url")[0].InnerText;
        QRCodeMaker qrc = new QRCodeMaker();
        qrc.CreatePhoneSiteQRCode(site_url + "/M/Default.aspx");
    }
}