sharepoint获取当前登录人

 /// <summary>
        /// 当前登陆人组织情况
        /// </summary>
        public OrgEmployee CurEmployee
        {
            get
            {
                string login = SPContext.Current.Web.CurrentUser.LoginName.ToUpper();
                login = login.Substring(login.IndexOf('\\') + 1);
                return new OrgManage().GetEmployeeByLoginName(login);
            }
        }
        /// <summary>
        /// 得到登陆人的loginname
        /// </summary>
        public string CurShortLoginName
        {
            get
            {
                string login = SPContext.Current.Web.CurrentUser.LoginName.ToUpper();
                return login.Substring(login.IndexOf('\\') + 1);
            }
        }
        /// <summary>
        /// 打开页面
        /// </summary>
        /// <param name="msg"></param>
        public void ShowMessage(string msg)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "msg",
                String.Format("<script type=\"text/javascript\"> window.alert('{0}');</script>", msg.Replace("'", " ").Replace("\""," ")));
        }

posted @ 2013-04-26 09:23  717806198  阅读(194)  评论(0编辑  收藏  举报