private void SaveInfo_Click(object sender, EventArgs e) { #region 保存信息 if (this.CheckCookie()) { SpaceActiveConfigInfo __configinfo = SpaceActiveConfigs.GetConfig(); __configinfo.SpaceFooterInfo = spacefooterinfo.Text; __configinfo.Spacegreeting = greeting.Text; __configinfo.Enablespacerewrite = Utils.StrToInt(enablerewrite.SelectedValue, 0); SpaceActiveConfigs.SaveConfig(__configinfo); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "空间其它信息设置", ""); if (!Utils.IsNumeric(topictoblog.Text) || Convert.ToInt32(topictoblog.Text) > 10 || Convert.ToInt32(topictoblog.Text) < 0) { base.RegisterStartupScript("PAGE", "alert('自动加入日志数量取值必须在0~10之间');window.location='space_spacefooterinfo.aspx';"); return; } config.Topictoblog = Convert.ToInt32(topictoblog.Text); GeneralConfigs.Serialiaze(config, Server.MapPath("../../config/general.config")); base.RegisterStartupScript("PAGE", "window.location='space_spacefooterinfo.aspx';"); } #endregion }
/// <summary> /// 保存配置类实例 /// </summary> /// <returns></returns> public static bool SaveConfig(SpaceActiveConfigInfo spaceconfiginfo) { SpaceActiveConfigFileManager sfm = new SpaceActiveConfigFileManager(); SpaceActiveConfigFileManager.ConfigInfo = spaceconfiginfo; return(sfm.SaveConfig()); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { SpaceActiveConfigInfo __configinfo = SpaceActiveConfigs.GetConfig(); spacefooterinfo.Text = __configinfo.SpaceFooterInfo; greeting.Text = __configinfo.Spacegreeting; topictoblog.Text = config.Topictoblog.ToString(); enablerewrite.SelectedValue = __configinfo.Enablespacerewrite.ToString(); } }