using System; using CB.Common; using CB.Config; using CB.Framework; namespace CB.Admin.DUCenter.Resources { public partial class BaseConfigSet : AdminPage { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { InitData(); } } protected override void InitData() { var config = BaseConfigs.GetConfig(); if (null == config) return; ddlPageType.SelectedValue = config.AuthorityPageType.ToString(); txtTemplateRootPath.Text = config.TemplateRootPath; txtSynArticleUrl.Text = config.SynArticleUrl; txtSyncCacheServer.Text = config.SyncCacheServer; base.InitData(); } protected void btnUpdate_Click(object sender, EventArgs e) { var config = new BaseConfigInfo() { AuthorityPageType = TypeConverter.StrToInt(this.ddlPageType.SelectedValue.Trim()), TemplateRootPath = this.txtTemplateRootPath.Text.Trim(), SynArticleUrl = txtSynArticleUrl.Text.Trim(), SyncCacheServer = txtSyncCacheServer.Text.Trim() }; if (string.IsNullOrEmpty(config.TemplateRootPath)) { ShowMessageBox("模板根目录为空!"); return; } if (string.IsNullOrEmpty(config.SynArticleUrl)) { ShowMessageBox("调用55125文章地址为空!"); return; } BaseConfigs.SaveConfig(config); Logs("修改网站配置BaseConfigs.config", "修改网站配置BaseConfigs.config"); ShowMessageBox("保存配置成功", string.Format("BaseConfigSet.aspx?authPage={0}", authPage)); } } }