Exemple #1
0
    public static ElectronTicketAgents GetCurrentUser()
    {
        string Key = (System.Web.HttpContext.Current.Session.SessionID + "").ToLower() + "_ElectronTicketAgents";

        // 从 Cookie 中取出 UserID
        HttpCookie cookieUser = HttpContext.Current.Request.Cookies[Key];

        if ((cookieUser == null) || (String.IsNullOrEmpty(cookieUser.Value)))
        {
            return(null);
        }

        string CookieUserID = cookieUser.Value;

        try
        {
            CookieUserID = Shove._Security.Encrypt.UnEncryptString(PF.GetCallCert(), Shove._Security.Encrypt.Decrypt3DES(PF.GetCallCert(), CookieUserID, PF.DesKey));
        }
        catch
        {
            CookieUserID = "";
        }

        if (String.IsNullOrEmpty(CookieUserID))
        {
            return(null);
        }

        int UserID = Shove._Convert.StrToInt(CookieUserID, -1);

        if (UserID < 1)
        {
            return(null);
        }

        ElectronTicketAgents electronTicketAgents = new ElectronTicketAgents();

        electronTicketAgents.ID = UserID;

        string ReturnDescription = "";
        int    Result            = electronTicketAgents.GetInformationByID(ref ReturnDescription);

        if (Result < 0)
        {
            return(null);
        }

        return(electronTicketAgents);
    }
    public static ElectronTicketAgents GetCurrentUser()
    {
        // This item is obfuscated and can not be translated.
        if (HttpContext.Current.Session.SessionID == null)
        {
            return(null);
        }
        string     str    = HttpContext.Current.Session.SessionID.ToLower() + "_ElectronTicketAgents";
        HttpCookie cookie = HttpContext.Current.Request.Cookies[str];

        if ((cookie == null) || string.IsNullOrEmpty(cookie.Value))
        {
            return(null);
        }
        string input = cookie.Value;

        try
        {
            input = Encrypt.UnEncryptString(PF.GetCallCert(), Encrypt.Decrypt3DES(PF.GetCallCert(), input, PF.DesKey));
        }
        catch
        {
            input = "";
        }
        if (string.IsNullOrEmpty(input))
        {
            return(null);
        }
        int num = _Convert.StrToInt(input, -1);

        if (num < 1)
        {
            return(null);
        }
        ElectronTicketAgents agents = new ElectronTicketAgents
        {
            ID = num
        };
        string returnDescription = "";

        if (agents.GetInformationByID(ref returnDescription) < 0)
        {
            return(null);
        }
        return(agents);
    }
 public static ElectronTicketAgents GetCurrentUser()
 {
     // This item is obfuscated and can not be translated.
     if (HttpContext.Current.Session.SessionID == null)
     {
         return null;
     }
     string str = HttpContext.Current.Session.SessionID.ToLower() + "_ElectronTicketAgents";
     HttpCookie cookie = HttpContext.Current.Request.Cookies[str];
     if ((cookie == null) || string.IsNullOrEmpty(cookie.Value))
     {
         return null;
     }
     string input = cookie.Value;
     try
     {
         input = Encrypt.UnEncryptString(PF.GetCallCert(), Encrypt.Decrypt3DES(PF.GetCallCert(), input, PF.DesKey));
     }
     catch
     {
         input = "";
     }
     if (string.IsNullOrEmpty(input))
     {
         return null;
     }
     int num = _Convert.StrToInt(input, -1);
     if (num < 1)
     {
         return null;
     }
     ElectronTicketAgents agents = new ElectronTicketAgents
     {
         ID = num
     };
     string returnDescription = "";
     if (agents.GetInformationByID(ref returnDescription) < 0)
     {
         return null;
     }
     return agents;
 }