Пример #1
0
        /// <summary>
        /// 用户登陆验证
        /// </summary>
        /// <param name="strAccout">AD账号</param>
        /// <param name="strPassword">密码</param>
        /// <param name="isAdmin">是否超级管理员</param>
        /// <returns></returns>
        public string UserLogin(string strAccout, string strPassword, bool isAdmin)
        {
            string         strErrorMsg     = string.Empty;
            TB_User        mTB_User        = null;
            TB_SystemAdmin mTB_SystemAdmin = null;

            if (!isAdmin)
            {
                mTB_User = _mTB_UserDAL.GetUserInfo(strAccout);
                if (null == mTB_User)
                {
                    strErrorMsg = "Sorry,您未被授权访问本系统,请联系系统管理员!";
                    return(strErrorMsg);
                }
                HttpContext.Current.Session[TypeManager.User] = mTB_User;
            }
            else
            {
                mTB_SystemAdmin = _mTB_SystemAdminDAL.GetUserInfo(strAccout, MD5.EncryptStr(strPassword));
                if (null == mTB_SystemAdmin)
                {
                    strErrorMsg = "Sorry,密码错误!";
                    return(strErrorMsg);
                }
                else
                {
                    HttpContext.Current.Session[TypeManager.Admin] = mTB_SystemAdmin;
                    return(strErrorMsg);
                }
            }
            if (!_mCommonManager.DomainAuthenticateLogin(strAccout, strPassword))
            {
                strErrorMsg = "Sorry,密码错误!";
                return(strErrorMsg);
            }
            return(strErrorMsg);
        }