BaseConfigSet.aspx.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using CB.Common;
  3. using CB.Config;
  4. using CB.Framework;
  5. namespace CB.Admin.DUCenter.Resources
  6. {
  7. public partial class BaseConfigSet : AdminPage
  8. {
  9. protected void Page_Load(object sender, EventArgs e)
  10. {
  11. if (!IsPostBack)
  12. {
  13. InitData();
  14. }
  15. }
  16. protected override void InitData()
  17. {
  18. var config = BaseConfigs.GetConfig();
  19. if (null == config) return;
  20. ddlPageType.SelectedValue = config.AuthorityPageType.ToString();
  21. txtTemplateRootPath.Text = config.TemplateRootPath;
  22. txtSynArticleUrl.Text = config.SynArticleUrl;
  23. txtSyncCacheServer.Text = config.SyncCacheServer;
  24. base.InitData();
  25. }
  26. protected void btnUpdate_Click(object sender, EventArgs e)
  27. {
  28. var config = new BaseConfigInfo()
  29. {
  30. AuthorityPageType = TypeConverter.StrToInt(this.ddlPageType.SelectedValue.Trim()),
  31. TemplateRootPath = this.txtTemplateRootPath.Text.Trim(),
  32. SynArticleUrl = txtSynArticleUrl.Text.Trim(),
  33. SyncCacheServer = txtSyncCacheServer.Text.Trim()
  34. };
  35. if (string.IsNullOrEmpty(config.TemplateRootPath))
  36. { ShowMessageBox("模板根目录为空!"); return; }
  37. if (string.IsNullOrEmpty(config.SynArticleUrl))
  38. { ShowMessageBox("调用55125文章地址为空!"); return; }
  39. BaseConfigs.SaveConfig(config);
  40. Logs("修改网站配置BaseConfigs.config", "修改网站配置BaseConfigs.config");
  41. ShowMessageBox("保存配置成功", string.Format("BaseConfigSet.aspx?authPage={0}", authPage));
  42. }
  43. }
  44. }