/// <summary> /// 保存配置类实例 /// </summary> /// <returns></returns> public static bool SaveConfig(AggregationConfigInfo aggregationconfiginfo) { AggregationConfigFileManager acfm = new AggregationConfigFileManager(); AggregationConfigFileManager.ConfigInfo = aggregationconfiginfo; return(acfm.SaveConfig()); }
/// <summary> /// 静态构造函数初始化相应实例和定时器 /// </summary> static AggregationConfig() { m_configinfo = AggregationConfigFileManager.LoadConfig(); aggregationConfigTimer.AutoReset = true; aggregationConfigTimer.Enabled = true; aggregationConfigTimer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed); aggregationConfigTimer.Start(); }
protected void Page_Load(object sender, EventArgs e) { #region 装载信息 if (!IsPostBack) { AggregationConfigInfo aci = AggregationConfig.GetConfig(); newcommentcount.Text = aci.SpaceTopNewCommentsCount.ToString(); newcommentcounttimeout.Text = aci.SpaceTopNewCommentsTimeout.ToString(); maxarticlecommentcount.Text = aci.TopcommentcountPostListCount.ToString(); maxarticlecommentcounttimeout.Text = aci.TopcommentcountPostListTimeout.ToString(); maxarticleviewcount.Text = aci.TopviewsPostListCount.ToString(); maxarticleviewcounttimeout.Text = aci.TopviewsPostListTimeout.ToString(); maxcommentcount.Text = aci.TopcommentcountSpaceListCount.ToString(); maxcommentcounttimeout.Text = aci.TopcommentcountSpaceListTimeout.ToString(); maxspaceviewcount.Text = aci.TopvisitedtimesSpaceListCount.ToString(); maxspaceviewcounttimeout.Text = aci.TopvisitedtimesSpaceListTimeout.ToString(); maxpostarticlespacecount.Text = aci.ToppostcountSpaceListCount.ToString(); maxpostarticlespacecounttimeout.Text = aci.ToppostcountSpaceListTimeout.ToString(); updatespacecount.Text = aci.RecentUpdateSpaceAggregationListCount.ToString(); updatespacetimeout.Text = aci.RecentUpdateSpaceAggregationListTimeout.ToString(); } #endregion }
private void Btn_SaveInfo_Click(object sender, EventArgs e) { #region 保存自动提取数据 int inewcommentcount = Convert.ToInt32(newcommentcount.Text); if (!ValidateCount(inewcommentcount)) { return; } int inewcommentcounttimeout = Convert.ToInt32(newcommentcounttimeout.Text); if (!ValidateTimeout(inewcommentcounttimeout)) { return; } int imaxarticlecommentcount = Convert.ToInt32(maxarticlecommentcount.Text); if (!ValidateCount(imaxarticlecommentcount)) { return; } int imaxarticlecommentcounttimeout = Convert.ToInt32(maxarticlecommentcounttimeout.Text); if (!ValidateTimeout(imaxarticlecommentcounttimeout)) { return; } int imaxarticleviewcount = Convert.ToInt32(maxarticleviewcount.Text); if (!ValidateCount(imaxarticleviewcount)) { return; } int imaxarticleviewcounttimeout = Convert.ToInt32(maxarticleviewcounttimeout.Text); if (!ValidateTimeout(imaxarticleviewcounttimeout)) { return; } int imaxcommentcount = Convert.ToInt32(maxcommentcount.Text); if (!ValidateCount(imaxcommentcount)) { return; } int imaxcommentcounttimeout = Convert.ToInt32(maxcommentcounttimeout.Text); if (!ValidateTimeout(imaxcommentcounttimeout)) { return; } int imaxspaceviewcount = Convert.ToInt32(maxspaceviewcount.Text); if (!ValidateCount(imaxspaceviewcount)) { return; } int imaxspaceviewcounttimeout = Convert.ToInt32(maxspaceviewcounttimeout.Text); if (!ValidateTimeout(imaxspaceviewcounttimeout)) { return; } int imaxpostarticlespacecount = Convert.ToInt32(maxpostarticlespacecount.Text); if (!ValidateCount(imaxpostarticlespacecount)) { return; } int imaxpostarticlespacecounttimeout = Convert.ToInt32(maxpostarticlespacecounttimeout.Text); if (!ValidateTimeout(imaxpostarticlespacecounttimeout)) { return; } int iupdatespacecount = Convert.ToInt32(updatespacecount.Text); if (!ValidateCount(iupdatespacecount)) { return; } int iupdatespacetimeout = Convert.ToInt32(updatespacetimeout.Text); if (!ValidateTimeout(iupdatespacetimeout)) { return; } DNTCache cache = DNTCache.GetCacheService(); cache.RemoveObject("/Space/SpaceTopNewComments"); cache.RemoveObject("/Space/TopcommentcountPostList"); cache.RemoveObject("/Space/TopviewsPostList"); cache.RemoveObject("/Space/TopcommentcountSpaceList"); cache.RemoveObject("/Space/TopvisitedtimesSpaceList"); cache.RemoveObject("/Space/ToppostcountSpaceList"); cache.RemoveObject("/Space/RecentUpdateSpaceAggregationList"); AggregationConfigInfo aci = AggregationConfig.GetConfig(); aci.SpaceTopNewCommentsCount = inewcommentcount; aci.SpaceTopNewCommentsTimeout = inewcommentcounttimeout; aci.TopcommentcountPostListCount = imaxarticlecommentcount; aci.TopcommentcountPostListTimeout = imaxarticlecommentcounttimeout; aci.TopviewsPostListCount = imaxarticleviewcount; aci.TopviewsPostListTimeout = imaxarticleviewcounttimeout; aci.TopcommentcountSpaceListCount = imaxcommentcount; aci.TopcommentcountSpaceListTimeout = imaxcommentcounttimeout; aci.TopvisitedtimesSpaceListCount = imaxspaceviewcount; aci.TopvisitedtimesSpaceListTimeout = imaxspaceviewcounttimeout; aci.ToppostcountSpaceListCount = imaxpostarticlespacecount; aci.ToppostcountSpaceListTimeout = imaxpostarticlespacecounttimeout; aci.RecentUpdateSpaceAggregationListCount = iupdatespacecount; aci.RecentUpdateSpaceAggregationListTimeout = iupdatespacetimeout; AggregationConfig.SaveConfig(aci); AggregationFacade.BaseAggregation.ClearAllDataBind(); #endregion }
/// <summary> /// 重设配置类实例 /// </summary> public static void ResetConfig() { m_configinfo = AggregationConfigFileManager.LoadConfig(); }