hradminglobals.cs

来自「人力资源管理系统 读者须安装好IIS和Microsoft Visual Stut」· CS 代码 · 共 105 行

CS
105
字号
using System;
using System.Configuration;
using System.Collections.Specialized ;
using System.Web;
using System.Collections; 
using System.Web.SessionState;
using System.Data;
using System.IO;
using System.Threading;
using HRAdmin.BLL ;

namespace HRAdmin.COMMON
{
	/// <summary>
	/// 
	/// PMAdminGlobals类包含该解决方案通用的公共变量
	/// 
	/// </summary>
	public class HRAdminGlobals
	{
		//***********************************************************************
		//
		//属性   数据库连接字串,只读
		//
		//从web.config文件获取数据库连接字串
		//
		//***********************************************************************

		public static string ConnectionString 
		{
			get 
			{
				NameValueCollection nvc = (NameValueCollection)
					ConfigurationSettings.GetConfig("HRAdmin/database");
				return nvc[ "connectionString" ];
			} 
		}


		//***********************************************************************
		//
		//属性   日志文件路径,只读
		//
		//从web.config读取日志文件路径
		//
		//***********************************************************************

		public static string TraceFilePath
		{
			get 
			{
				NameValueCollection nvc = (NameValueCollection)
					ConfigurationSettings.GetConfig("HRAdmin/tracefile");
				return nvc[ "traceFilePath" ];
			} 
		}

		//***********************************************************************
		//
		//属性    系统配置文件路径,只读
		//
		//该路径固定
		//
		//***********************************************************************

		/// <summary>
		/// 系统配置文件路径,只读
		/// </summary>
		public static string ConfigFilePath
		{
			get 
			{
				string configpath = "COMMON\\Configs\\" ;
				string path = HttpRuntime.AppDomainAppPath ;
				return path + configpath ;	
			} 
		}


		#region Session中的内容
		/// <summary>
		/// 当前登录用户
		/// </summary>
		static public PersonnelInfo LoginUsr
		{
			get
			{
				HttpSessionState sess=HttpContext.Current.Session;
				return (PersonnelInfo)sess["LoginUsr"];
			}
			set
			{
				HttpSessionState sess=HttpContext.Current.Session;
				if (value ==null)
					sess.Remove("LoginUsr");
				else
					sess["LoginUsr"]=value;
			}
		}

		#endregion
		
	}
}

⌨️ 快捷键说明

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