topbar.ascx.cs

来自「基于Asp.net、MS sql sever 2000、C# 论坛系统源码」· CS 代码 · 共 85 行

CS
85
字号
namespace Stella.Web.Controls
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;
	using System.Collections;

	/// <summary>
	///		TopBar 的摘要说明。
	/// </summary>
	public class TopBar : System.Web.UI.UserControl
	{
		protected System.Web.UI.WebControls.HyperLink newTopic;
		protected System.Web.UI.WebControls.HyperLink reply;
		protected System.Web.UI.WebControls.Label manager;
		protected System.Web.UI.WebControls.HyperLink placard;

		private void Page_Load(object sender, System.EventArgs e)
		{
			setUpManagers();
			setUp();
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		设计器支持所需的方法 - 不要使用代码编辑器
		///		修改此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void setUp()
		{
			reply.Visible=(Request["top"]!=null);
			newTopic.Visible=(Request["tid"]!=null);
			newTopic.NavigateUrl=string.Format("../pages/newTopic.aspx?tid={0}",Request["tid"]);
			reply.NavigateUrl=string.Format("../pages/reply.aspx?tid={0}&top={1}",Request["tid"],Request["top"]);

			Stella.Web.ProcessFlow.CacheController cc=new Stella.Web.ProcessFlow.CacheController();
			Stella.Model.PlacardList pl=cc.GetCachedPlacardList();
			if(pl.Placards!=null)
			{
				if(pl.Placards.Count!=0)
					this.placard.Text=pl[0].Topic;
				else
					this.placard.Text="";
			}
			else
				this.placard.Text="";
			this.placard.NavigateUrl="../pages/placard.aspx";
		}

		private void setUpManagers()
		{
			Stella.Web.ProcessFlow.CacheController cc=new Stella.Web.ProcessFlow.CacheController();
			Hashtable hs=cc.GetCachedThemeManagerList();
			ArrayList ms=(ArrayList)hs[int.Parse(Request["tid"])];

			//斑竹列表
			System.Text.StringBuilder sb=new System.Text.StringBuilder();
			foreach(Stella.Model.Member m in ms)
			{
				sb.Append(string.Format("<a href=\"../pages/profile.aspx?mname={0}\">{0}</a>&nbsp;",m.Name));
			}
			this.manager.Text=sb.ToString();
		}
	}
}

⌨️ 快捷键说明

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