⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apppagecounter.cs

📁 投票系统模块设计
💻 CS
字号:
using System;
using System.Web;

namespace Common
{
	/// <summary>
	/// AppPageCounter 的摘要说明。
	/// </summary>
	public class AppPageCounter : IPageCounter
	{
		public AppPageCounter()
		{
			if (HttpContext.Current.Application["PageCount"] == null)
			{
				HttpContext.Current.Application.Add("PageCount", 0);
			}
		}
		#region IPageCounter 成员

		public int GetPageCount()
		{
			return (int)HttpContext.Current.Application["PageCount"];
		}

		public void SetPageCount(int iCount)
		{
			HttpContext.Current.Application.Lock();
			if (HttpContext.Current.Application["PageCount"] == null)
			{
				HttpContext.Current.Application.Add("PageCount", 0);
			}
			else
			{
				HttpContext.Current.Application["PageCount"] = iCount;
			}
			HttpContext.Current.Application.UnLock();
		}

		public void IncreasePageCount()
		{
			HttpContext.Current.Application.Lock();
			HttpContext.Current.Application["PageCount"] = GetPageCount() + 1;
			HttpContext.Current.Application.UnLock();
		}

		#endregion
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -