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

📄 header.ascx.cs

📁 企业内部管理系统
💻 CS
字号:
namespace infoWeb.WebModules.Forums.Web.Controls.User
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;
	using infoWeb.WebModules.Accounts.Business;

	/// <summary>
	///		Summary description for Header.
	/// </summary>
	public abstract class Header : System.Web.UI.UserControl
	{
		protected System.Web.UI.WebControls.HyperLink LinkToCategories;
		protected System.Web.UI.WebControls.HyperLink LinkToForum;
		protected System.Web.UI.WebControls.HyperLink LinkToTopic;
		protected System.Web.UI.WebControls.Label LinkToProfileText;
		protected System.Web.UI.WebControls.HyperLink LinkToSettings;

		private int forumID;
		private int topicID;

		private void Page_Load(object sender, System.EventArgs e)
		{
			if (Context.User.Identity.IsAuthenticated)
			{
				// check if the current user is allowed to change the settings
				SitePrincipal currentPrincipal = (SitePrincipal)Context.User;
				if (!currentPrincipal.HasPermission((int)ForumsPermissions.EditSettings))
				{
					// if not, hide the link
					LinkToSettings.Visible = false;
				}

				// change the title of the link to the MyProfile page whether the current
				// user is registered for the forum or not
				SiteIdentity currUser = (SiteIdentity)Context.User.Identity;
				Business.Member member = new Business.Member();
				member.LoadFromUser(currUser.UserID);
				LinkToProfileText.Text = (member.ID == -1 ? "注册" : "我的配置文件");
			}
			else
			{
				LinkToProfileText.Text = "Register";
				LinkToSettings.Visible = false;
			}
		}

		public int ForumID
		{
			get { return forumID; }
			set
			{
				forumID = value;
				topicID = -1;
				
				Business.Forum forum = new Business.Forum(forumID);
				LinkToCategories.Text = forum.Category.Name;
				LinkToForum.Text = forum.Name;
				LinkToForum.NavigateUrl = "Forum.aspx?ForumID=" + forum.ID.ToString();
			}
		}

		public int TopicID
		{
			get { return topicID; }
			set
			{
				forumID = -1;
				topicID = value;
				
				Business.Topic topic = new Business.Topic(topicID);
				LinkToCategories.Text = topic.Forum.Category.Name;
				LinkToForum.Text = topic.Forum.Name;
				LinkToForum.NavigateUrl = "Forum.aspx?ForumID=" + topic.Forum.ID.ToString();
				LinkToTopic.Text = topic.Subject;
				LinkToTopic.NavigateUrl = "Topic.aspx?TopicID=" + topic.ID.ToString();
			}
		}
	
		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		///		Required method for Designer support - do not modify
		///		the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
	}
}

⌨️ 快捷键说明

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