Esempio n. 1
0
        public XElement GetLostCommands(Session session, int firstSequence, int lastSequence)
        {
            XmlNode xmlCommands = null;

            try
            {
                State state = SessionManager.Default.GetTradingConsoleState(session);
                Token token = SessionManager.Default.GetToken(session);
                if (Command.CompareSequence(firstSequence, lastSequence) > 0)
                {
                    _Logger.Warn(string.Format("{0},range == [{1},{2}]", token, firstSequence, lastSequence));
                    return(null);
                }
                xmlCommands = this._Commands.GetCommands(token, state, firstSequence, lastSequence);
                xmlCommands = this.VerifyRefrence(session, state, xmlCommands);
                _Logger.Warn(string.Format("{0},  range == [{1},{2}]\n{3}", token, firstSequence, lastSequence,
                                           xmlCommands.OuterXml));
                return(XmlResultHelper.NewResult(xmlCommands.OuterXml));
            }
            catch (System.Exception ex)
            {
                _Logger.Error(ex);
                return(XmlResultHelper.NewErrorResult());
            }
        }
        //Change Password
        public static XElement  UpdatePassword(Session session, string loginID, string oldPassword, string newPassword)
        {
            string message   = "";
            bool   isSucceed = false;

            try
            {
                string[][] recoverPasswordDatas = new string[][] { };
                isSucceed = UpdatePassword3(session, loginID, oldPassword, newPassword, recoverPasswordDatas, out message);
                if (isSucceed)
                {
                    Token       token      = SessionManager.Default.GetToken(session);
                    TraderState state      = SessionManager.Default.GetTradingConsoleState(session);
                    bool        isEmployee = state != null && state.IsEmployee;
                    Application.Default.TradingConsoleServer.SaveChangePasswordLog(token, isEmployee, "");
                }
                var dict = new Dictionary <string, string>()
                {
                    { "message", message }, { "isSucceed", isSucceed.ToPlainBitString() }
                };
                return(XmlResultHelper.NewResult(dict));
            }
            catch (System.Exception exception)
            {
                _Logger.Error(exception);
                return(XmlResultHelper.NewErrorResult());
            }
        }
Esempio n. 3
0
        public static XElement  Agent(Session session, string email, string receive, string organizationName, string customerName, string reportDate, string accountCode, string previousAgentCode,
                                      string previousAgentName, string newAgentCode, string newAgentName, string newAgentICNo, string dateReply)
        {
            try
            {
                String reference    = "";
                String errorMessage = "";
                Token  token        = SessionManager.Default.GetToken(session);

                bool isSucceed = Application.Default.TradingConsoleServer.Agent(token, Application.Default.StateServer, FixBug.Fix(email), FixBug.Fix(receive),
                                                                                FixBug.Fix(organizationName), FixBug.Fix(customerName), FixBug.Fix(reportDate),
                                                                                FixBug.Fix(accountCode), FixBug.Fix(previousAgentCode), FixBug.Fix(previousAgentName),
                                                                                FixBug.Fix(newAgentCode), FixBug.Fix(newAgentName), FixBug.Fix(newAgentICNo), FixBug.Fix(dateReply),
                                                                                out reference, out errorMessage);
                if (isSucceed)
                {
                    return(XmlResultHelper.NewResult(reference));
                }
                else
                {
                    return(XmlResultHelper.NewResult(errorMessage));
                }
            }
            catch (System.Exception exception)
            {
                AppDebug.LogEvent("TradingConsole.Agent:", exception.ToString(), System.Diagnostics.EventLogEntryType.Error);
                return(XmlResultHelper.NewErrorResult());
            }
        }
Esempio n. 4
0
        public static XElement  AdditionalClient(Session session, string email, string receive, string organizationName, string customerName, string reportDate, string accountCode,
                                                 string correspondingAddress, string registratedEmailAddress, string tel, string mobile, string fax, string fillName1, string ICNo1,
                                                 string fillName2, string ICNo2, string fillName3, string ICNo3)
        {
            try
            {
                String reference;
                Token  token = SessionManager.Default.GetToken(session);

                bool isSucceed = Application.Default.TradingConsoleServer.AdditionalClient(token, Application.Default.StateServer, FixBug.Fix(email), FixBug.Fix(receive),
                                                                                           FixBug.Fix(organizationName), FixBug.Fix(customerName),
                                                                                           FixBug.Fix(reportDate), FixBug.Fix(accountCode),
                                                                                           FixBug.Fix(correspondingAddress), FixBug.Fix(registratedEmailAddress),
                                                                                           FixBug.Fix(tel), FixBug.Fix(mobile), FixBug.Fix(fax),
                                                                                           FixBug.Fix(fillName1), FixBug.Fix(ICNo1),
                                                                                           FixBug.Fix(fillName2), FixBug.Fix(ICNo2),
                                                                                           FixBug.Fix(fillName3), FixBug.Fix(ICNo3), out reference);
                reference = isSucceed ? reference : string.Empty;
                return(XmlResultHelper.NewResult(reference));
            }
            catch (System.Exception exception)
            {
                AppDebug.LogEvent("TradingConsole.AdditionalClient:", exception.ToString(), System.Diagnostics.EventLogEntryType.Error);
                return(XmlResultHelper.NewErrorResult());
            }
        }
Esempio n. 5
0
 public static XElement GetNewsList2(string newsCategoryID, string language, DateTime date)
 {
     try
     {
         DataSet ds = Application.Default.TradingConsoleServer.GetNewsList2(newsCategoryID, language, date);
         return(XmlResultHelper.NewResult(ds.ToXml()));
     }
     catch (System.Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
 public static XElement  VerifyMarginPin(Guid accountId, string password)
 {
     try
     {
         bool result = Application.Default.TradingConsoleServer.VerifyMarginPin(accountId, password);
         return(XmlResultHelper.NewResult(result.ToPlainBitString()));
     }
     catch (Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 7
0
 public static XElement  GetChartData(Guid asyncResultId)
 {
     try
     {
         DataSet ds = (DataSet)Application.Default.AsyncResultManager.GetResult(asyncResultId);
         return(XmlResultHelper.NewResult(ds.ToXml()));
     }
     catch (Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 8
0
 public static XElement GetInterestRate(Guid[] orderIds)
 {
     try
     {
         DataSet ds = Application.Default.TradingConsoleServer.GetInterestRate(orderIds);
         return(XmlResultHelper.NewResult(ds.ToXml()));
     }
     catch (System.Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
 public static XElement  ChangeMarginPin(Guid accountId, string oldPassword, string newPassword)
 {
     try
     {
         var result = Application.Default.TradingConsoleServer.ChangeMarginPin(accountId, oldPassword, newPassword);
         return(XmlResultHelper.NewResult(result.ToPlainBitString()));
     }
     catch (Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 10
0
 public static XElement GetMerchantInfoFor99Bill(Guid[] organizationIds)
 {
     try
     {
         string[] infos = Application.Default.TradingConsoleServer.GetMerchantInfoFor99Bill(organizationIds);
         return(XmlResultHelper.NewResult(infos.ToJoinString()));
     }
     catch (System.Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 11
0
 public XElement  GetAccountsForTradingConsole(Session session)
 {
     try
     {
         Token token = SessionManager.Default.GetToken(session);
         var   ds    = Application.Default.TradingConsoleServer.GetAccountsForTradingConsole(token.UserID);
         return(XmlResultHelper.NewResult(ds.ToXml()));
     }
     catch (System.Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 12
0
 public XElement  GetAccountBanksApproved(Guid accountId, string language)
 {
     try
     {
         string sql = string.Format("dbo.P_GetAccountBanksApproved @accountId='{0}', @language='{1}'", accountId, language);
         var    ds  = DataAccess.GetData(sql, SettingManager.Default.ConnectionString);
         return(XmlResultHelper.NewResult(ds.ToXml()));
     }
     catch (System.Exception ex)
     {
         _Logger.Error(ex);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 13
0
 public XElement  GetAccountBankReferenceData(string countryId, string language)
 {
     try
     {
         string  sql = string.Format("dbo.P_GetAccountBankReferenceData @language='{0}'", language) + (string.IsNullOrEmpty(countryId)? "" : " , @countryId=" + countryId);
         DataSet ds  = DataAccess.GetData(sql, SettingManager.Default.ConnectionString);
         return(XmlResultHelper.NewResult(ds.ToXml()));
     }
     catch (System.Exception ex)
     {
         _Logger.Error(ex);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 14
0
 public static XElement GetTimeInfo()
 {
     try
     {
         TimeInfo info = ((ITimeSyncService)Framework.Time.SystemTime.Default).GetTimeInfo();
         string   xml  = XmlSerializeHelper.ToXml(info.GetType(), info);
         return(XmlResultHelper.NewResult(xml));
     }
     catch (System.Exception exception)
     {
         AppDebug.LogEvent("TradingConsole.GetTimeInfo:", exception.ToString(), System.Diagnostics.EventLogEntryType.Error);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 15
0
 public XElement  UpdateAccountSetting(Session session, Guid[] accountIds)
 {
     try
     {
         Token token  = SessionManager.Default.GetToken(session);
         bool  result = Application.Default.TradingConsoleServer.UpdateAccountSetting(token.UserID, accountIds);
         return(XmlResultHelper.NewResult(result.ToPlainBitString()));
     }
     catch (System.Exception exception)
     {
         _Logger.Error((exception));
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 16
0
 public XElement OrderQuery(Session session, Guid customerId, string accountId, string instrumentId, int lastDays)
 {
     try
     {
         string language = SessionManager.Default.GetToken(session).Language;
         var    ds       = Application.Default.TradingConsoleServer.OrderQuery(language, customerId, accountId, instrumentId, lastDays);
         return(XmlResultHelper.NewResult(ds.ToXml()));
     }
     catch (Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 17
0
 public static XElement VerifyTransaction(Session session, Guid[] transactionIDs)
 {
     try
     {
         Token  token  = SessionManager.Default.GetToken(session);
         Guid[] result = Application.Default.TradingConsoleServer.VerifyTransaction(token, Application.Default.StateServer, transactionIDs);
         return(XmlResultHelper.NewResult(result.ToJoinString()));
     }
     catch (System.Exception exception)
     {
         AppDebug.LogEvent("TradingConsole.VerifyTransaction:", exception.ToString(), System.Diagnostics.EventLogEntryType.Error);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 18
0
 public static XElement GetMessages(Session session)
 {
     try
     {
         Token   token = SessionManager.Default.GetToken(session);
         DataSet ds    = Application.Default.TradingConsoleServer.GetMessages(token);
         return(XmlResultHelper.NewResult(ds.ToXml()));
     }
     catch (System.Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 19
0
 public XElement GetNewsContents(Session session, string newsID)
 {
     try
     {
         TraderState state = SessionManager.Default.GetTradingConsoleState(session);
         var         ds    = Application.Default.TradingConsoleServer.GetNewsContents(newsID, state.Language);
         return(XmlResultHelper.NewResult(ds.ToXml()));
     }
     catch (Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 20
0
 public XElement DeleteMessage(Session session, Guid id)
 {
     try
     {
         Token token  = SessionManager.Default.GetToken(session);
         bool  result = Application.Default.TradingConsoleServer.DeleteMessage(token, id);
         return(XmlResultHelper.NewResult(result.ToPlainBitString()));
     }
     catch (System.Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 21
0
 public XElement  CancelLmtOrder(Session session, string transactionID)
 {
     try
     {
         Token token  = SessionManager.Default.GetToken(session);
         var   result = Application.Default.TradingConsoleServer.CancelLMTOrder(token, Application.Default.StateServer, transactionID);
         return(XmlResultHelper.NewResult(result.ToString()));
     }
     catch (System.Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 22
0
 public static XElement  AsyncGetChartData2(Session session, Guid instrumentId, DateTime from, DateTime to, string dataCycleParameter)
 {
     try
     {
         AsyncResult asyncResult = new AsyncResult("AsyncGetChartData2", session.ToString());
         Application.Default.AssistantOfCreateChartData2.AddTask(asyncResult, new ChartDataArgument2(instrumentId, dataCycleParameter, from, to, asyncResult, session), CreateChartData2);
         return(XmlResultHelper.NewResult(asyncResult.Id.ToString()));
     }
     catch (System.Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 23
0
 public XElement GetQuotePolicyDetailsAndRefreshInstrumentsState(Session session, Guid customerID)
 {
     try
     {
         Token token = SessionManager.Default.GetToken(session);
         var   ds    = InternalGetQuotePolicyDetailsAndRefreshInstrumentsState(session, token.UserID);
         return(XmlResultHelper.NewResult(ds.ToXml()));
     }
     catch (System.Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 24
0
 public XElement GetOrderInstalment(Guid orderId)
 {
     try
     {
         TradingConsoleServer tradingConsoleServer = Application.Default.TradingConsoleServer;
         DataSet ds = tradingConsoleServer.GetOrderInstalment(orderId);
         return(XmlResultHelper.NewResult(ds.ToXml()));
     }
     catch (System.Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
 public XElement GetInstrumentForSetting(Session session)
 {
     try
     {
         Token   token   = SessionManager.Default.GetToken(session);
         XmlNode content = Application.Default.TradingConsoleServer.GetInstrumentForSetting(token, Application.Default.StateServer);
         return(XmlResultHelper.NewResult(content.OuterXml));
     }
     catch (Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 26
0
 public XElement GetDeliveryAddress(Session session, Guid deliveryPointGroupId)
 {
     try
     {
         string language = SessionManager.Default.GetToken(session).Language;
         TradingConsoleServer tradingConsoleServer = Application.Default.TradingConsoleServer;
         string[]             addresses            = tradingConsoleServer.GetDeliveryAddress(deliveryPointGroupId, language);
         return(XmlResultHelper.NewResult(addresses.ToJoinString()));
     }
     catch (Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
 public XElement UpdateInstrumentSetting(Session session, string[] instrumentIDs)
 {
     try
     {
         Token token = SessionManager.Default.GetToken(session);
         var   ds    = this.UpdateInstrumentSetting(session, token, instrumentIDs);
         ds.SetInstrumentGuidMapping();
         return(XmlResultHelper.NewResult(ds.ToXml()));
     }
     catch (Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 28
0
 public static XElement SaveLog(Session session, string logCode, DateTime timestamp, string action, Guid transactionId)
 {
     try
     {
         Token       token      = SessionManager.Default.GetToken(session);
         TraderState state      = SessionManager.Default.GetTradingConsoleState(session);
         bool        isEmployee = state == null ? false : state.IsEmployee;
         Application.Default.TradingConsoleServer.SaveLog(token, isEmployee, "", logCode, timestamp, action, transactionId);
         return(XmlResultHelper.NewResult(""));
     }
     catch (System.Exception exception)
     {
         AppDebug.LogEvent("TradingConsole.SaveLog:", exception.ToString(), System.Diagnostics.EventLogEntryType.Error);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 29
0
 public XElement Quote2(Session session, string instrumentID, double buyQuoteLot, double sellQuoteLot, int tick)
 {
     try
     {
         Token       token      = SessionManager.Default.GetToken(session);
         TraderState state      = SessionManager.Default.GetTradingConsoleState(session);
         bool        isEmployee = state != null && state.IsEmployee;
         Application.Default.TradingConsoleServer.Quote2(token, isEmployee, Application.Default.StateServer, GetLocalIP(), instrumentID, buyQuoteLot, sellQuoteLot, tick);
         return(XmlResultHelper.NewResult(StringConstants.OkResult));
     }
     catch (System.Exception exception)
     {
         _Logger.Error(exception);
         return(XmlResultHelper.NewErrorResult());
     }
 }
Esempio n. 30
0
 public static XElement  RecoverPasswordDatas(Session session, string[][] recoverPasswordDatas)
 {
     try
     {
         if (recoverPasswordDatas.Length > 0)
         {
             Token token = SessionManager.Default.GetToken(session);
             Application.Default.TradingConsoleServer.UpdateRecoverPasswordData(token.UserID, recoverPasswordDatas);
             return(XmlResultHelper.NewResult(StringConstants.OkResult));
         }
     }
     catch (Exception exception)
     {
         _Logger.Error(exception);
     }
     return(XmlResultHelper.NewErrorResult());
 }