using System;
using System.Web.UI;

    public partial class SysConfig : AdminBase
    {
        public int _Id=0;

        protected void Page_Load(object sender, EventArgs e)
        {

            Response.CacheControl = "no-cache";


            if (!Page.IsPostBack) 
            {
                sysset = new SysSet().loadCacheConfig(Utils.GetMapPath("~/App_Data/WebSet.config"));
             //   myhelp = myhelp.getXml("../config/sysparm2.xml");

            txtWebName.Text = sysset.WebName;
            txtWebTel.Text = sysset.WebTel;
            txtWebEmail.Text = sysset.WebEmail;
            txtWebCrod.Text = sysset.WebCrod;
            txtWebKeywords.Text = sysset.WebKeywords.ToString();
            txtWebDescription.Text = sysset.WebDescription.ToString();
            Textfuj.Text = sysset.WebFileType.ToString();
            //logo
            txtImgUrl.Text = sysset.WebPath;

            //if (sysset..FLock == "1")
            this.CBLog.Checked = sysset.WebLog;
            this.CBNews.Checked = sysset.NewsRule;

            }
        }

        //保存
        protected void btnSave_Click(object sender, EventArgs e)
        {


            try
            {
                //赋值给MODEL
              
                SysSet model = new SysSet().loadCacheConfig(Utils.GetMapPath("~/App_Data/WebSet.config"));
                model.WebName = txtWebName.Text;
       
                model.WebTel = txtWebTel.Text;
        
                model.WebEmail = txtWebEmail.Text;
                model.WebCrod = txtWebCrod.Text;       
                model.WebKeywords = txtWebKeywords.Text.Trim();
                model.WebDescription = txtWebDescription.Text.Trim();
                model.WebFileType = Textfuj.Text.Trim();

            //标志
                model.WaterFont = txtImgUrl.Text;
                model.WebLog = CBLog.Checked;
                model.NewsRule=CBNews.Checked;
                ////修改配置信息

                model.saveConifg(model, Server.MapPath("~/App_Data/WebSet.config"));
                //保存日志
                SaveLogs("[系统管理]修改系统配置文件");
     
           Response.Write("<script> var success=1;</script>");
        }
        catch
            {

            Response.Write("<script> var myError=1;var Msg='<b>文件写入失败！</b>请检查是否有写入权限，如果没有，请联系管理员开启写入该文件的权限！'</script>");
           }
    }

    
    }

