Пример #1
0
        /// <summary>
        /// 将datatable转换成list对象
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        private List <TB_SystemAdmin> ConvertTableToList(DataTable dt)
        {
            List <TB_SystemAdmin> lstSystemAdmin  = new List <TB_SystemAdmin>();
            TB_SystemAdmin        mTB_SystemAdmin = null;

            foreach (DataRow dr in dt.Rows)
            {
                mTB_SystemAdmin          = new TB_SystemAdmin();
                mTB_SystemAdmin.ID       = Convert.ToInt32(dr[TB_SystemAdmin.col_ID]);
                mTB_SystemAdmin.Account  = dr[TB_SystemAdmin.col_Account].ToString();
                mTB_SystemAdmin.SiteID   = Convert.ToInt32(dr[TB_SystemAdmin.col_SiteID]);
                mTB_SystemAdmin.PassWord = dr[TB_SystemAdmin.col_PassWord].ToString();
                lstSystemAdmin.Add(mTB_SystemAdmin);
            }
            return(lstSystemAdmin);
        }
Пример #2
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);
        }