예제 #1
0
        public static Hashtable GetLanguage(string filePath, string chilNodeName)
        {
            Hashtable languageHash = new Hashtable();

            try
            {
                var xrs = new XmlReaderSettings();
                xrs.IgnoreComments   = true;
                xrs.IgnoreWhitespace = true;
                using (var languageReader = XmlReader.Create(filePath, xrs))
                {
                    languageReader.ReadToFollowing(chilNodeName);
                    XmlReader subreader = languageReader.ReadSubtree();
                    while (subreader.Read())
                    {
                        if (subreader.NodeType == XmlNodeType.Element && subreader.Name == "Item")
                        {
                            languageHash.Add(subreader.GetAttribute("key"), subreader.GetAttribute("value"));
                        }
                    }
                }
            }
            catch (System.Exception exception)
            {
                AppDebug.LogEvent("DealingConsole.LanguageHelper.GetLanguage", exception.ToString(), System.Diagnostics.EventLogEntryType.Error);
            }
            return(languageHash);
        }
예제 #2
0
        private EngineResult SendCommand(Command command)
        {
            try
            {
                lock (this._ServiceLock)
                {
                    this._ExchangeService.AddCommand(command);
                }
            }
            catch (Exception ex)
            {
                AppDebug.LogEvent("ManagerClient", "SendCommand failed:\r\n" + ex.ToString(), EventLogEntryType.Warning);

                if (ex is CommunicationObjectFaultedException)
                {
                    if (!this.inRcorverConnection)
                    {
                        this.inRcorverConnection = true;
                        ThreadPool.QueueUserWorkItem(this.ConnectToManager);
                    }
                    AppDebug.LogEvent("ManagerClient", "Try recover connection", EventLogEntryType.Warning);
                    Thread.Sleep(1000);
                    return(EngineResult.FaildWithoutSuspend);
                }
            }
            return(EngineResult.Success);
        }
예제 #3
0
파일: Callback.cs 프로젝트: dreamsql/Outter
        public bool UpdateCustomerDisallowlogin(Token token, List <Dictionary <string, string> > customerFileValues, List <Dictionary <string, string> > salesFileValues)
        {
            bool isOk         = false;
            bool isCustomerOk = true;
            bool isSalesOk    = true;

            try
            {
                if (customerFileValues != null && customerFileValues.Count > 0)
                {
                    isCustomerOk = false;
                    XmlNode customerPolicyNode = ManagerHelper.GetUpdateNodeFromDic(customerFileValues, "Customer");
                    isCustomerOk = Global.StateServer.UpdateCustomeDisallowLogin(token, customerPolicyNode);
                }
                if (salesFileValues != null && salesFileValues.Count > 0)
                {
                    isSalesOk = false;
                    XmlNode employeePolicyNode = ManagerHelper.GetUpdateNodeFromDic(salesFileValues, "Employee");
                    isSalesOk = Global.StateServer.UpdateEmployeeDisallowLogin(token, employeePolicyNode);
                }
                isOk = (isCustomerOk && isSalesOk);
            }
            catch (Exception ex)
            {
                AppDebug.LogEvent("ManagerCallback.UpdateCustomerDisallowlogin",
                                  string.Format("UpdateCustomerDisallowlogin:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error);
                return(false);
            }
            return(isOk);
        }
예제 #4
0
파일: Callback.cs 프로젝트: dreamsql/Outter
        private bool Kickoff(Guid[] customerId, Guid[] employeeId)
        {
            bool kickSuccess = true;

            try
            {
                if (customerId != null)
                {
                    foreach (var customer in customerId)
                    {
                        _proxy.Kickout(customer);
                    }
                }

                if (employeeId != null)
                {
                    foreach (var employee in employeeId)
                    {
                        _proxy.Kickout(employee);
                    }
                }

                kickSuccess = Global.StateServer.KickoffSL(customerId, employeeId);

                AppDebug.LogEvent("StateServer.Kickoff", string.Format("kickoff completed. customerid {0}, employeeid {1}, success= {2}.",
                                                                       customerId == null ? string.Empty : string.Join(",", customerId), employeeId == null ? string.Empty : string.Join(",", employeeId), kickSuccess), EventLogEntryType.Information);
            }
            catch (Exception e)
            {
                AppDebug.LogEvent("StateServer.Kickoff",
                                  string.Format("Kickoff:Error\r\n{0}", e.ToString()), EventLogEntryType.Error);
                return(false);
            }
            return(kickSuccess);
        }
예제 #5
0
        /// <summary>
        /// Send the executed transaction data to head office, if failed, save the data to file and re-send it later.
        /// </summary>
        public void AddFilialeTransaction(FilialeTransaction filialeTransaction)
        {
            lock (_Lock)
            {
                if (this._FailedQueue.Count > 0)
                {
                    this.AppendFailedTransactionToFile(filialeTransaction);
                    this._FailedQueue.Enqueue(filialeTransaction);
                    this._FailedQueueAddedEvent.Set();
                }
                else
                {
                    try
                    {
                        this.SendFilialeTransactionToExchangeSwitch(filialeTransaction);
                    }
                    catch (Exception exception)
                    {
                        AppDebug.LogEvent("StateServer", String.Format("{0}\r\n{1}", exception, filialeTransaction), EventLogEntryType.Error);

                        this.AppendFailedTransactionToFile(filialeTransaction);
                        this._FailedQueue.Enqueue(filialeTransaction);
                        this._FailedQueueAddedEvent.Set();
                    }
                }
            }
        }
예제 #6
0
 protected void Application_PreRequestHandlerExecute(Object sender, EventArgs e)
 {
     try
     {
         //Fix: sometime iis Restarted but client's session is still valid ???
         if (!this.Context.Request.IsAuthenticated)
         {
             return;
         }
         if (this.Context.Request.RawUrl.EndsWith("?WSDL"))
         {
             return;
         }
         if (this.Context.Session == null)
         {
             return;                              //for not all web method are session enabled, so it maybe null!?
         }
         Token token = (Token)this.Context.Session["Token"];
         if (token == null)
         {
             FormsAuthentication.SignOut();
             this.Response.StatusCode = (int)System.Net.HttpStatusCode.Unauthorized;
         }
     }
     catch (System.Exception ex)
     {
         AppDebug.LogEvent("DealingConsole.Application_PreRequestHandlerExecute", ex.ToString(), System.Diagnostics.EventLogEntryType.Error);
     }
 }
예제 #7
0
        private bool Book(MappedTran tran)
        {
            TransactionError error = this.booker.Invoke(tran);

            if (error == TransactionError.OK || error == TransactionError.TransactionAlreadyExists ||
                error == TransactionError.OpenOrderNotExists || error == TransactionError.InvalidOrderRelation ||
                error == TransactionError.ExceedOpenLotBalance)
            {
                if (error != TransactionError.OK)
                {
                    AppDebug.LogEvent("StateServer", string.Format("Book failed, error = {0} \n {1}", error, tran.ToXmlString()), System.Diagnostics.EventLogEntryType.Warning);
                }

                try
                {
                    string fileName = Path.Combine(this.cachePath, string.Format("{0}.tan", tran.Sequence));
                    File.Delete(fileName);
                }
                catch (Exception ex)
                {
                    AppDebug.LogEvent("StateServer", ex.ToString(), System.Diagnostics.EventLogEntryType.Error);
                }

                return(true);
            }
            else
            {
                AppDebug.LogEvent("StateServer", string.Format("Book failed, error = {0} \n {1}", error, tran.ToXmlString()), System.Diagnostics.EventLogEntryType.Warning);
                return(false);
            }
        }
예제 #8
0
        private void SendFailedTransactions(object state)
        {
            while (true)
            {
                while (this._FailedQueue.Count > 0)
                {
                    FilialeTransaction filialeTransaction = this._FailedQueue.Peek();
                    try
                    {
                        this.SendFilialeTransactionToExchangeSwitch(filialeTransaction);

                        this._FailedQueue.Dequeue();
                        if (this._FailedQueue.Count == 0 && File.Exists(PacketFileFullName))
                        {
                            File.Delete(PacketFileFullName);
                        }
                    }
                    catch (Exception exception)
                    {
                        AppDebug.LogEvent("StateServer", String.Format("{0}\r\n{1}", exception, filialeTransaction), EventLogEntryType.Error);
                        Thread.Sleep(TimeSpan.FromSeconds(SleepSecondsWhileSendFailed));
                    }
                }

                this._FailedQueueAddedEvent.WaitOne();
            }
        }
예제 #9
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());
            }
        }
예제 #10
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());
            }
        }
예제 #11
0
파일: Callback.cs 프로젝트: dreamsql/Outter
        public bool UpdateDealingPolicyDetail(Token token, List <Dictionary <string, string> > dealingPolicyDic, List <Dictionary <string, string> > instrumentDic)
        {
            try
            {
                bool isDealingPolicy = true;
                bool isInstrument    = true;
                if (dealingPolicyDic.Count > 0)
                {
                    XmlNode dealingPolicyNode = ManagerHelper.GetUpdateNodeFromDic(dealingPolicyDic, "DealingPolicyDetail");
                    isDealingPolicy = Global.StateServer.UpdateDealingPolicyDetail(token, dealingPolicyNode);
                }

                if (instrumentDic.Count > 0)
                {
                    XmlNode instrumentNode = ManagerHelper.GetUpdateNodeFromDic(instrumentDic, "Instrument");
                    isInstrument = Global.StateServer.UpdateInstrument(token, instrumentNode);
                }

                return(isDealingPolicy && isInstrument);
            }
            catch (Exception ex)
            {
                AppDebug.LogEvent("ManagerCallback.UpdateDealingPolicyDetail",
                                  string.Format("UpdateDealingPolicyDetail:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error);
                return(false);
            }
        }
예제 #12
0
파일: Checker.cs 프로젝트: dreamsql/Outter
        public static bool Hash()
        {
            try
            {
                byte[] hashValue = Checker.hashNames();

                string hashValue2 = "0x";
                foreach (byte b in hashValue)
                {
                    hashValue2 += b.ToString("X2");
                }

                //save to db
                string     connectionString = ConfigurationSettings.AppSettings["ConnectionString"];
                string     sql     = "UPDATE SystemParameter SET SystemSign =" + hashValue2;
                SqlCommand command = new SqlCommand(sql, new SqlConnection(connectionString));
                command.Connection.Open();
                command.ExecuteNonQuery();
                command.Connection.Close();

                return(true);
            }
            catch (Exception ex)
            {
                AppDebug.LogEvent("StateServer", ex.ToString(), EventLogEntryType.Error);
                throw ex;
            }
        }
예제 #13
0
 public static void AddCommand(Command command)
 {
     if (!(command is QuotationCommand))
     {
         AppDebug.LogEvent("ManagerClient", "AddCommand :" + command.GetType().Name, EventLogEntryType.Information);
         ManagerClient._Client.InternalAddCommand(command);
     }
 }
        public bool SetSystemParameter(Token token, string parameters)
        {
            string sql = string.Format("Exec dbo.P_SetSystemParameter '{0}','{1}',N'{2}'", token.UserID, (Int32)token.AppType, parameters);

            AppDebug.LogEvent("DealingConsoleServer.SetSystemParameter:", string.Format("Token={0}\n ConnectionString={1}\n SQL={2}", token.ToString(), this.connectionString, sql), EventLogEntryType.Information);

            return(DataAccess.UpdateDB(sql, this.connectionString));
        }
예제 #15
0
 internal static void UpdateLoginInfo(iExchange.Common.TraderServerType appType, string onlineXml, TimeSpan expireTime)
 {
     if (ManagerClient._Client._ExchangeService == null)
     {
         AppDebug.LogEvent("StateServer", "ManagerClient.UpdateLoginInfo Faild : ManagerService Not Connected.", EventLogEntryType.Warning);
         return;
     }
     ManagerClient._Client._ExchangeService.UpdateLoginInfo(appType, onlineXml, expireTime);
 }
예제 #16
0
 internal static MinuteChartData[] GetMinuteChartData(Guid?instrumentId, Guid?quotePolicyId)
 {
     if (ManagerClient._Client._ExchangeService == null)
     {
         AppDebug.LogEvent("StateServer", "ManagerClient.GetMinuteChartData Faild : ManagerService Not Connected.", EventLogEntryType.Error);
         return(null);
     }
     return(ManagerClient._Client._ExchangeService.GetMinuteChartData(instrumentId, quotePolicyId));
 }
예제 #17
0
        private void ConnectToManager(object state)
        {
            try
            {
                EndpointAddress address = new EndpointAddress(this._ManagerAddress);
                NetTcpBinding   binding = new NetTcpBinding(SecurityMode.None);
                binding.TransferMode = TransferMode.Buffered;
                binding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
                binding.ReaderQuotas.MaxDepth       = 64;
                binding.ReaderQuotas.MaxArrayLength = 16384;

                binding.OpenTimeout            = TimeSpan.FromSeconds(50);
                binding.SendTimeout            = TimeSpan.FromSeconds(180);
                binding.MaxReceivedMessageSize = int.MaxValue;
                binding.MaxBufferSize          = int.MaxValue;
                binding.MaxBufferPoolSize      = 524288;

                DuplexChannelFactory <IExchangeService> factory = new DuplexChannelFactory <IExchangeService>(new InstanceContext(new Callback()), binding, address);

                try
                {
                    foreach (var operationDescription in factory.Endpoint.Contract.Operations)
                    {
                        System.ServiceModel.Description.DataContractSerializerOperationBehavior dcsob =
                            operationDescription.Behaviors.Find <System.ServiceModel.Description.DataContractSerializerOperationBehavior>();
                        if (dcsob != null)
                        {
                            dcsob.MaxItemsInObjectGraph = int.MaxValue;
                        }
                    }
                }
                catch { }

                lock (this._ServiceLock)
                {
                    this._ExchangeService = factory.CreateChannel();
                    this._ExchangeService.Register(this._ExchangeCode, false);
                }
                this._CommandRelayEngine.Resume();

                // create quotation channel
                DuplexChannelFactory <IExchangeService> factory2 = new DuplexChannelFactory <IExchangeService>(new InstanceContext(new Callback()), binding, address);
                this._ExchangeServiceQuotation = factory2.CreateChannel();
                this._ExchangeServiceQuotation.Register(this._ExchangeCode, true);

                AppDebug.LogEvent("ManagerClient",
                                  string.Format("StateServer connected to manager service at:{0}, ExchangeCode:{1}", this._ManagerAddress, this._ExchangeCode), EventLogEntryType.Information);
            }
            catch (Exception ex)
            {
                AppDebug.LogEvent("ManagerClient", "ConnectToManager failed:\r\n" + ex.ToString(), EventLogEntryType.Error);
            }
            finally
            {
                this.inRcorverConnection = false;
            }
        }
예제 #18
0
        protected void Application_End(Object sender, EventArgs e)
        {
            AppDebug.LogEvent("[DealingConsole]", "Application_End", EventLogEntryType.Information);

            string serviceUrl = this.GetLocalServiceUrl();

            this.StateServer.UnRegister(new Token(Guid.Empty, UserType.System, AppType.DealingConsole), serviceUrl);

            AppDebug.LogEvent("DealingConsole", "DealingConsole stopped", EventLogEntryType.SuccessAudit);
        }
예제 #19
0
        protected void Application_Start(Object sender, EventArgs e)
        {
            try
            {
                AppDebug.LogEvent("DealingConsole", "Application_Start", EventLogEntryType.Information);

                //Used for kickout--Michael
                this.Context.Application["SessionIDs"] = new Hashtable();

                this.Context.Application["IsRegistered"] = false;
                this.Context.Application["Commands"]     = new Commands(new TimeSpan(0, 10, 0).TotalMilliseconds);
                this.Context.Application["Tokens"]       = new Hashtable();

                StateServerService stateServer = new StateServerService();
                this.StateServerReadyCheck(stateServer);
                this.Context.Application["StateServer"] = stateServer;

                ParticipantServices.ParticipantServices participantServices = new ParticipantServices.ParticipantServices();
                Application["ParticipantServices"] = participantServices;
                SecurityServices.SecurityServices securityServices = new SecurityServices.SecurityServices();
                Application["SecurityServices"] = securityServices;


                //			this.Context.Application["IsRegistered"]=false;
                //			this.Context.Application["Commands"]=null;
                //			this.Context.Application["Tokens"]=new Hashtable();
                ////			this.Context.Application["Sessions"]=new Hashtable();
                //
                //			StateServer.Service stateServer=new StateServer.Service();
                //			this.Context.Application["StateServer"]=stateServer;
                //
                int     commandSequence;
                Token   token   = new Token(Guid.Empty, UserType.System, AppType.DealingConsoleServer);
                DataSet dataSet = stateServer.GetInitData(token, null, out commandSequence);

                string connectionString = ConfigurationSettings.AppSettings["ConnectionString"];
                DealingConsoleServer dealingConsoleServer = new DealingConsoleServer(connectionString);
                dealingConsoleServer.Init(dataSet);
                this.Context.Application["DealingConsoleServer"] = dealingConsoleServer;

                AppDebug.LogEvent("DealingConsole", "DealingConsole started", EventLogEntryType.SuccessAudit);
            }
            catch (Exception exception)
            {
                AppDebug.LogEvent("DealingConsole", exception.ToString(), EventLogEntryType.Error);
            }
            //
            //
            //#if (PERMISSION)
            //			ParticipantServices.ParticipantServices  participantServices = new ParticipantServices.ParticipantServices();
            //			Application["ParticipantServices"] = participantServices;
            //			SecurityServices.SecurityServices securityServices = new SecurityServices.SecurityServices();
            //			Application["SecurityServices"] = securityServices;
            //#endif
        }
예제 #20
0
파일: Callback.cs 프로젝트: dreamsql/Outter
 public void BrodcastTradingDailyQuotations(Token token, List <InstrumentDailyClosePriceInfo> closeQuotations)
 {
     try
     {
         Global.StateServer.SetDailyClosePrices(token, closeQuotations);
     }
     catch (Exception ex)
     {
         AppDebug.LogEvent("ManagerCallback.SetDailyClosePrices",
                           string.Format("SetDailyClosePrices:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error);
     }
 }
예제 #21
0
파일: Callback.cs 프로젝트: dreamsql/Outter
 public void BrodcastMinuteChartDataCommand(Token token, MinuteChartData[] minuteChartDatas)
 {
     try
     {
         Global.StateServer.BrodcastMinuteChartDataCommand(token, minuteChartDatas);
     }
     catch (Exception ex)
     {
         AppDebug.LogEvent("ManagerCallback.BrodcastMinuteChartDataCommand",
                           string.Format("BrodcastMinuteChartDataCommand:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error);
     }
 }
예제 #22
0
파일: Callback.cs 프로젝트: dreamsql/Outter
 public void BrodcastTradingDailyQuotation(Token token, Guid instrumentId, DateTime tradeDay, List <TradingDailyQuotation> closeQuotations)
 {
     try
     {
         Global.StateServer.SetDailyClosePrice(token, instrumentId, tradeDay, closeQuotations);
     }
     catch (Exception ex)
     {
         AppDebug.LogEvent("ManagerCallback.SetDailyClosePrice",
                           string.Format("SetDailyClosePrice:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error);
     }
 }
예제 #23
0
파일: Callback.cs 프로젝트: dreamsql/Outter
 public bool ResetServerAndKickoffAllTrader(Token token, int timeout)
 {
     try
     {
         return(Global.StateServer.ResetServerAndKickoffAllTrader(token, timeout));
     }
     catch (Exception ex)
     {
         AppDebug.LogEvent("ManagerCallback.ResetServerAndKickoffAllTrader", string.Format("{0}", ex), EventLogEntryType.Error);
         return(false);
     }
 }
예제 #24
0
파일: Callback.cs 프로젝트: dreamsql/Outter
 public void ResetHit(Token token, Guid[] orderIds)
 {
     try
     {
         Global.StateServer.ResetHit(token, orderIds);
     }
     catch (Exception ex)
     {
         AppDebug.LogEvent("ManagerCallback.ResetHit",
                           string.Format("ResetHit:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error);
     }
 }
예제 #25
0
파일: Callback.cs 프로젝트: dreamsql/Outter
 public void BroadcastQuotation(Token token, OriginQuotation[] originQs, OverridedQuotation[] overridedQs)
 {
     try
     {
         Global.StateServer.Broadcast(token, originQs, overridedQs);
     }
     catch (Exception ex)
     {
         AppDebug.LogEvent("ManagerCallback.BroadcastQuotation",
                           string.Format("udpateNode:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error);
     }
 }
예제 #26
0
        private bool InnerLoginAndAuthenticate(string userName, string password, ExchangeSystem exchangeSystem, bool authenticateOnly, out Guid userID, out string errorMsg)
        {
            try
            {
                ParticipantServices.ParticipantServices participantServices = (ParticipantServices.ParticipantServices)Application["ParticipantServices"];
                userID = participantServices.Login(userName, password);
                if (userID == Guid.Empty)
                {
                    errorMsg = "User name not exists or password is invalid.";
                    return(false);
                }

                SecurityServices.SecurityServices securityServices = (SecurityServices.SecurityServices)Application["SecurityServices"];
                Guid programID    = new Guid(ConfigurationSettings.AppSettings["DealingConsole"]);
                Guid permissionID = new Guid(ConfigurationSettings.AppSettings["Run"]);
                bool isAuthrized  = securityServices.CheckPermission(userID, programID, permissionID, "", "", userID, out errorMsg);
                if (isAuthrized == false)
                {
                    userID = Guid.Empty;
                    return(false);
                }

                Token token = new Token(userID, UserType.System, AppType.DealingConsole);
                token.SessionID       = this.Context.Session.SessionID;
                token.ExchangeSystem  = exchangeSystem;
                this.Session["Token"] = token;
                bool success = this.StateServer.Login(token);
                if (success == false)
                {
                    userID   = Guid.Empty;
                    errorMsg = "Login to stateServer failure.";
                    return(false);
                }

                if (!authenticateOnly)
                {
                    FormsAuthentication.SetAuthCookie(userID.ToString(), false);

                    //Prevent be kickout
                    Hashtable sessionIDs = (Hashtable)this.Context.Application["SessionIDs"];
                    sessionIDs         = Hashtable.Synchronized(sessionIDs);
                    sessionIDs[userID] = this.Context.Session.SessionID;
                }

                return(true);
            }
            catch (Exception exception)
            {
                AppDebug.LogEvent("DealingConsole", exception.ToString(), EventLogEntryType.Error);
                throw;
            }
        }
예제 #27
0
파일: Callback.cs 프로젝트: dreamsql/Outter
 public TransactionError CancelPlace(Token token, Guid tranID)
 {
     try
     {
         return(TransactionError.OK);
     }
     catch (Exception ex)
     {
         AppDebug.LogEvent("ManagerCallback.CancelPlace",
                           string.Format("CancelPlace:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error);
         return(TransactionError.RuntimeError);
     }
 }
예제 #28
0
파일: Callback.cs 프로젝트: dreamsql/Outter
 public bool Kickoff(Token token, Guid[] customerId, Guid[] employeeId)
 {
     try
     {
         return(this.Kickoff(customerId, employeeId));
     }
     catch (Exception ex)
     {
         AppDebug.LogEvent("ManagerCallback.Kickoff",
                           string.Format("Kickoff:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error);
         return(false);
     }
 }
예제 #29
0
파일: Callback.cs 프로젝트: dreamsql/Outter
 public Protocal.UpdateInstrumentTradingStatusMarketCommand GetTradingInstrumentStatusCommand()
 {
     try
     {
         return(Global.StateServer.GetTradingInstrumentStatusCommand());
     }
     catch (Exception ex)
     {
         AppDebug.LogEvent("ManagerCallback.GetTradingInstrumentStatusCommand",
                           string.Format("GetTradingInstrumentStatusCommand:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error);
         return(null);
     }
 }
예제 #30
0
파일: Callback.cs 프로젝트: dreamsql/Outter
 public Guid[] Rehit(Common.Token token, Guid[] orderIDs, string[] hitPrices, Guid[] accountIDs)
 {
     try
     {
         return(Global.StateServer.Rehit(token, orderIDs, hitPrices, accountIDs));
     }
     catch (Exception ex)
     {
         AppDebug.LogEvent("ManagerCallback.Rehit",
                           string.Format("Rehit:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error);
         return(null);
     }
 }