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

📄 onlineuser.ascx.cs

📁 很不错的公文流转系统
💻 CS
字号:
/// <summary>
	/// module 的摘要说明。
	/// 设计人:蒲丰
	/// 日期2003.11.22
	/// 功能说明:在线用户,不在线用户,
	/// </summary>

namespace OI.UserControls
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;

	/// <summary>
	///		onlineUser 的摘要说明。
	///		请在客户端写你的Option(userid)方法.
	///		UserListHeight :设置人员列表高度,例:UserListHeight="400px";
	/// </summary>
	public class onlineUser : System.Web.UI.UserControl
	{
		protected System.Web.UI.WebControls.Table TableOnlieUsers;
		protected System.Web.UI.WebControls.Table TableUnlineUsers;
		protected System.Web.UI.WebControls.Label Labelonline;
		protected System.Web.UI.WebControls.Label Labelunline;
        protected OI.DatabaseOper .DatabaseConnect Dbc=new OI.DatabaseOper.DatabaseConnect ();
		protected string userslistheight="400px";
		public string UserListHeight
		{
			set {userslistheight=value;}
		}
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			if (!Page.IsPostBack )
			{
				Page.RegisterStartupScript ("","<script>ResetHeight('"+userslistheight+"')</script>");
			}
			DisplayOnlieUsers();
			DisplayUnlieUsers();
		}

		private void DisplayOnlieUsers()
		{
			string str;
			str = " select a.username , DepartmentName,a.userid  from  accounts_users a, departments d, OnlineUsers ol ";
            str +=" where a.userid=ol.userid and a.DepartmentID =d.DepartmentID  order by a.username";
			DataSet ds=new DataSet ();
			ds=Dbc.getBinding (str,"t");
			Labelonline.Text="("+ds.Tables[0].Rows .Count +"人)";
			foreach ( DataRow dr in ds.Tables[0].Rows )
			{
				TableRow tr=new TableRow ();
                TableCell tc=new TableCell (); 
				tc.Text ="<a  onclick=\"Option("+dr["userid"].ToString () +")\" title=\"所在部门:"+dr["DepartmentName"].ToString ()+"\">"+ dr["username"].ToString ()+"</a>";
				tr.Cells .Add (tc);
				TableOnlieUsers.Rows .Add (tr);
			}
		}
		private void DisplayUnlieUsers()
		{
			string str;
			str = " select a.username , DepartmentName,a.userid  from  accounts_users a, departments d ";
			str +=" where  userid not in (select  userid from OnlineUsers ) and a.DepartmentID =d.DepartmentID  order by a.username";
			DataSet ds=new DataSet ();
			ds=Dbc.getBinding (str,"t");
			Labelunline.Text="("+ds.Tables[0].Rows .Count +"人)";
			foreach ( DataRow dr in ds.Tables[0].Rows )
			{
				TableRow tr=new TableRow ();
				TableCell tc=new TableCell (); 
				tc.Text ="<a  title=\"所在部门:"+dr["DepartmentName"].ToString ()+"\">"+ dr["username"].ToString ()+"</a>";
				tr.Cells .Add (tc);
				TableUnlineUsers.Rows .Add (tr);
			}
		}
		#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

	
	}
}

⌨️ 快捷键说明

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