Ejemplo n.º 1
0
        protected void Application_Start(object sender, EventArgs e)
        {
            Config.Init();
            StockInfoBiz.Init();

            int status_trade = MonitorRA.GetStatusTrade();

            if (status_trade > 0)
            {
                OpenCloseBiz.Open();
            }
        }
Ejemplo n.º 2
0
        public Result UpdateStatusTrade(StatusTradeEnum status)
        {
            int status_trade = MonitorRA.GetStatusTrade();

            if (status_trade == 0)
            {
                if (status != StatusTradeEnum.Opening)
                {
                    return(Result(ApiResultEnum.Failed));
                }

                //开盘
                if (!LogTradeDA.Open(UserRA.Get(user_id.ToString(), "name")))
                {
                    return(Result(ApiResultEnum.Failed));
                }

                MonitorRA.SetStatusTrade((int)status);
                OpenCloseBiz.Open();
            }
            else
            {
                if (status == StatusTradeEnum.Opening)
                {
                    OpenCloseBiz.Open();
                    return(Result(ApiResultEnum.Success));
                }
                else if (status == StatusTradeEnum.Recovery)
                {
                    MonitorRA.SetStatusTrade((int)StatusTradeEnum.Opening);
                }
                else if (status == StatusTradeEnum.Pause)
                {
                    MonitorRA.SetStatusTrade((int)status);
                }
                else
                {
                    //收盘
                    if (!LogTradeDA.Close(UserRA.Get(user_id.ToString(), "name")))
                    {
                        return(Result(ApiResultEnum.Failed));
                    }
                    MonitorRA.SetStatusTrade((int)status);
                    OpenCloseBiz.Close();
                }
            }
            return(Result(ApiResultEnum.Success));
        }