oiidentity.cs

来自「很不错的公文流转系统」· CS 代码 · 共 88 行

CS
88
字号
using System; 

namespace OI
{
	/// <summary>
	/// OIIdentity 的摘要说明。
	/// </summary>
	public class OIIdentity:System.Security.Principal.IIdentity
	{
		string cName;
		string cUserName;
		string cUnitID;
		public OIIdentity(string userid)
		{
			this.initData(userid);
		}
		#region IIdentity 成员

		private void initData(string userid)
		{
			OI.DatabaseOper.DatabaseConnect dc=new OI.DatabaseOper.DatabaseConnect();
			userid=OI.Modules.String.GenSafeChars(userid);
			System.Data.DataSet oDataSet=dc.getBinding("select UserID,UserName,UnitID from Accounts_Users where userid='"+userid+"'","tt");
			if(oDataSet.Tables[0].Rows.Count>0)
			{	
				this.cName=oDataSet.Tables[0].Rows[0][0].ToString();
				this.cUserName=oDataSet.Tables[0].Rows[0][1].ToString();
				this.cUnitID=oDataSet.Tables[0].Rows[0][2].ToString();			
			}
			
		}
		public bool IsAuthenticated
		{
			get
			{
				// TODO:  添加 OIIdentity.IsAuthenticated getter 实现
				return true;
			}
		}

		public string Name
		{
			get
			{
				return this.cName;
			}
			set
			{
				this.cName=value;
			}
		}
		public string UserName
		{
			get
			{

				return this.cUserName;
			}
			set
			{
				this.cUserName=value;
			}
		}
		public string UnitID
		{
			get
			{

				return this.cUnitID;
			}
			set
			{
				this.cUnitID=value;
			}
		}
		public string AuthenticationType
		{
			get
			{
				// TODO:  添加 OIIdentity.AuthenticationType getter 实现
				return "OI Authentication";
			}
		}

		#endregion
	}
}

⌨️ 快捷键说明

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