示例#1
0
        private void ProcessPostAsyncLoginSuccess(LoginInfo loginInfo)
        {
            Session session = loginInfo.Parameter.Request.ClientInfo.Session;

            if (SetLoginInfo(loginInfo))
            {
                SessionManager.Default.AddSession(loginInfo.UserID, session);
                string version  = loginInfo.Parameter.Version;
                var    language = string.IsNullOrEmpty(version) ? "ENG" : version.Substring(version.Length - 3);
                var    token    = SessionManager.Default.GetToken(session);
                if (token == null)
                {
                    var tokenType = loginInfo.Parameter.AppType;
                    token = new Token(loginInfo.UserID, UserType.Customer, tokenType);
                    SessionManager.Default.AddToken(session, token);
                }
                token.Language = language;
                Application.Default.SessionMonitor.Add(session);
                switch (loginInfo.Parameter.AppType)
                {
                case AppType.TradingConsole:
                    JavaLoginService service = new JavaLoginService(loginInfo);
                    service.AsyncGetLoginData();
                    break;

                case AppType.Mobile:
                    OnStateLoadingComplete(AppType.Mobile);
                    break;

                case AppType.CppTrader:
                    OnStateLoadingComplete(AppType.CppTrader);
                    break;

                default:
                    throw new ArgumentException(string.Format("{0} is not recogized", loginInfo.Parameter.AppType), "AppType");
                }
            }
            else
            {
                SessionManager.Default.RemoveToken(session);
            }
        }
示例#2
0
 private void ProcessPostAsyncLoginSuccess(LoginInfo loginInfo)
 {
     Session session = loginInfo.Parameter.Request.ClientInfo.Session;
     if (SetLoginInfo(loginInfo))
     {
         SessionManager.Default.AddSession(loginInfo.UserID, session);
         string version = loginInfo.Parameter.Version;
         var language = string.IsNullOrEmpty(version) ? "ENG" : version.Substring(version.Length - 3);
         var token = SessionManager.Default.GetToken(session);
         if (token == null)
         {
             var tokenType = loginInfo.Parameter.AppType;
             token = new Token(loginInfo.UserID, UserType.Customer, tokenType);
             SessionManager.Default.AddToken(session, token);
         }
         token.Language = language;
         Application.Default.SessionMonitor.Add(session);
         switch (loginInfo.Parameter.AppType)
         {
             case AppType.TradingConsole:
                 JavaLoginService service = new JavaLoginService(loginInfo);
                 service.AsyncGetLoginData();
                 break;
             case AppType.Mobile:
                 OnStateLoadingComplete(AppType.Mobile);
                 break;
             case AppType.CppTrader:
                 OnStateLoadingComplete(AppType.CppTrader);
                 break;
             default:
                 throw new ArgumentException(string.Format("{0} is not recogized", loginInfo.Parameter.AppType), "AppType");
         }
     }
     else
     {
         SessionManager.Default.RemoveToken(session);
     }
 }