Ejemplo n.º 1
0
    public LOCALUSER GetUser()
    {
        string szPsswordGM = "uniFound808";
        string szOpenID    = GetOpenID();

        if (HttpContext.Current.Session["LoginRes"] != null)
        {
            ADMINLOGINRES accInfo = (ADMINLOGINRES)HttpContext.Current.Session["LoginRes"];
            if (accInfo.AccInfo.szLogonName != null)
            {
                szOpenID = accInfo.AccInfo.szLogonName;
            }
        }
        if (string.IsNullOrEmpty(szOpenID))
        {
            LOCALUSER userRes = new LOCALUSER();
            return(userRes);
        }

        LOCALUSER user = LocalSQL.GetUser(szOpenID);

        if (user == null)
        {
            user = new LOCALUSER();
        }
        else if ((!string.IsNullOrEmpty(user.szLogonName)))
        {
            if (HttpContext.Current.Session["LoginUseInfo"] == null)
            {
                string szMsg;
                if (!Logon(user, out szMsg))
                {
                    return(null);
                }
            }
            if (HttpContext.Current.Session["LoginRes"] != null)
            {
                ADMINLOGINRES accInfo = (ADMINLOGINRES)HttpContext.Current.Session["LoginRes"];
                user.szTrueName  = accInfo.AccInfo.szTrueName;
                user.szLogonName = accInfo.AccInfo.szLogonName;
            }
        }
        else if ((szOpenID != null && szOpenID != ""))
        {
            user.szOpenID    = szOpenID;
            user.szLogonName = szOpenID;
            user.szPassword  = szPsswordGM;
            if (HttpContext.Current.Session["LoginUseInfo"] == null)
            {
                string szMsg;
                if (!Logon(user, out szMsg))
                {
                    return(null);
                }
            }
            if (HttpContext.Current.Session["LoginUseInfo"] != null)
            {
                ADMINLOGINRES accInfo = (ADMINLOGINRES)HttpContext.Current.Session["LoginRes"];
                user.szTrueName  = accInfo.AccInfo.szTrueName;
                user.szLogonName = accInfo.AccInfo.szLogonName;
            }
        }
        user.szOpenID    = szOpenID;
        user.szLogonName = szOpenID;
        user.szPassword  = szPsswordGM;//uniFound808
        return(user);
    }