//获取用户名BySQL(FullName) public static string GetLoginFullName(string PDMDbName) { SQLHelper.connString = Globals.connStrPDM; string loginId = PDMHelper.GetLoginID(); string sql = string.Format("select fullname from [{0}].dbo.Users where UserId='{1}'", PDMDbName, loginId); return(SQLHelper.GetSingleResult(sql).ToString()); }
/// <summary> /// 获取登录名ByPDM(UserName) /// </summary> /// <returns></returns> public static String GetLoginUserName() { string a = PDMHelper.GetLoginID(); DataTable dt = PDMHelper.GetUserList(); DataView dv = new DataView(dt); dv.RowFilter = string.Format(" UserId='{0}' ", a); return(dv.ToTable("default").Rows[0]["UserName"].ToString()); }
/// <summary> /// 获取并显示PDM登录信息 /// </summary> private void GetPDMLoginInfo() { //获取登录信息 Globals.UserID = PDMHelper.GetLoginID(); Globals.UserName = PDMHelper.GetLoginFullName(); //显示登录信息 this.lblUserName.ForeColor = Color.Black; this.lblUserName.Text = string.Format("当前用户:{0}({1})", Globals.DEF_CreateId, Globals.UserName); }
/// <summary> /// 初始化全局变量(即Globals中的变量) /// </summary> private void InitializeGlobalsVariables() { //获取SolidWorks文件名及文件ID Globals.FileName = swAppHelper.GetFileName(); Globals.FileID = PDMHelper.GetFileID(Globals.FileName).ToString(); //获取PDM登录信息 Globals.PDM_UserID = PDMHelper.GetLoginID(); Globals.PDM_UserAccount = PDMHelper.GetLoginUserName(); Globals.PDM_UserFullName = PDMHelper.GetLoginFullName(); }