Exemplo n.º 1
0
 public static string CheckCredentials(FarmAccountArg e)
 {
     try
     {
         var proxyTrade = new TradeSharpServerTrade(new TradeServerCallbackProcessor());
         var localTime  = DateTime.Now.Ticks;
         var hash       = CredentialsHash.MakeCredentialsHash(e.Login, e.Password, localTime);
         int sessionTag;
         var response = proxyTrade.proxy.Authenticate(e.Login, hash, "robot_farm",
                                                      TestTerminalId, localTime, out sessionTag);
         if (response != AuthenticationResponse.OK)
         {
             return(EnumFriendlyName <AuthenticationResponse> .GetString(response));
         }
         Account account;
         var     status = TradeSharpAccount.Instance.proxy.GetAccountInfo(e.AccountId, false, out account);
         // !! logout here
         return(EnumFriendlyName <RequestStatus> .GetString(status));
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
Exemplo n.º 2
0
 public static string CheckCredentials(FarmAccountArg e)
 {
     try
     {
         var proxyTrade = new TradeSharpServerTrade(new TradeServerCallbackProcessor());
         var localTime = DateTime.Now.Ticks;
         var hash = CredentialsHash.MakeCredentialsHash(e.Login, e.Password, localTime);
         int sessionTag;
         var response = proxyTrade.proxy.Authenticate(e.Login, hash, "robot_farm",
             TestTerminalId, localTime, out sessionTag);
         if (response != AuthenticationResponse.OK)
             return EnumFriendlyName<AuthenticationResponse>.GetString(response);
         Account account;
         var status = TradeSharpAccount.Instance.proxy.GetAccountInfo(e.AccountId, false, out account);
         // !! logout here
         return EnumFriendlyName<RequestStatus>.GetString(status);
     }
     catch (Exception ex)
     {
         return ex.Message;
     }
 }