Beispiel #1
0
        public GameInfoCollection QueryGameInfoCollection()
        {
            var result = new GameInfoCollection();

            result.AddRange(new LotteryGameManager().QueryEnableGame());
            return(result);
        }
        private string MakeGameFilterString(GameInfoCollection i_Games, EdlInfoCollection i_EdlInfos, FilterInfoCollection i_Filters, bool i_MultiLine)
        {
            StringBuilder m_SBGameFilter = new StringBuilder();

            string m_StrGames = MakeGameInfoString(i_Games, i_EdlInfos, i_MultiLine);

            string m_StrFilters = MakeFilterInfoString(i_Filters, i_MultiLine);

            m_SBGameFilter.AppendFormat("{0} \n\n{1}", m_StrGames, m_StrFilters);

            return(m_SBGameFilter.ToString());
        }
Beispiel #3
0
        /// <summary>
        /// 更新彩种状态
        /// </summary>
        public void UpdateLotteryGame(string gameCode, int enableStatus)
        {
            var manager = new LotteryGameManager();
            var entity  = manager.QueryLotteryGame(gameCode);

            if (entity == null)
            {
                throw new Exception("没有查到该彩种!");
            }
            entity.EnableStatus = (EnableStatus)enableStatus;
            if (_gameList == null)
            {
                _gameList = new GameInfoCollection();
            }
            _gameList.Clear();
            manager.UpdateLotteryGame(entity);

            //清空缓存
            BusinessHelper.ReloadLotteryGame();
        }
Beispiel #4
0
        // create our Deserialized JSON data objects
        private bool getStats(int gameID)
        {
            try
            {
                using (var webClient = new WebClient())
                {
                    gameInfoJSON = webClient.DownloadString(string.Format("https://statsapi.mlb.com/api/v1/game/{0}/boxscore", gameID.ToString()));
                    gameInfo     = JsonConvert.DeserializeObject <GameInfoCollection>(gameInfoJSON);

                    string allPlaysJSON = webClient.DownloadString(string.Format("https://statsapi.mlb.com/api/v1/game/{0}/playByPlay", gameID.ToString()));
                    allPlays = JsonConvert.DeserializeObject <AllPlaysCollection>(allPlaysJSON);
                }
            }
            catch (Exception e)
            {
                writeErrorLog(e.Message, gameID);
                Message        = e.Message;
                loadSuccessful = false;
                return(false);
            }

            return(true);
        }
        //        private string MakeGameInfoString(GameInfoCollection i_Games, bool i_MultiLine)
//        {
//            string m_RetStr = "<No Game>";

//            if(i_Games == null || i_Games.Count == 0) return m_RetStr;

//            StringBuilder m_SBGames = new StringBuilder();

//            if(this._Title)
//            {
//                m_SBGames.AppendFormat("{0}","Games:\n");
//            }

//            int times = 0;

//            int scouttypetimes=0 , maxtime=i_Games.Count-1;  //added at 2008-10-22 14:24:25@Simon

//            foreach(GameInfo i_Game in i_Games)
//            {
//                if((i_Game.Object == null || i_Game.Object == string.Empty)
//                    &&(i_Game.Opponent == null || i_Game.Opponent == string.Empty))
//                {
//                    //if obj and opponent is null , add game name
//                    if(i_Game.GameName == null || i_Game.GameName == string.Empty)
//                    {
//                        m_SBGames.Append("<None>");
//                    }
//                    else
//                    {
//                        m_SBGames.AppendFormat("{0}",i_Game.GameName);
//                    }
//                }
//                else
//                {
//                    //format game name
//                    if(!this.FirstObjectOnly || times == 0)
//                    {
//                        if(this._Object)
//                        {
//                            m_SBGames.AppendFormat("{0} ",i_Game.Object);
//                        }

//                        m_SBGames.Append("VS");

//                        times++;
//                    }

//                    if(this._Opponent)
//                    {
//                        m_SBGames.AppendFormat(" {0} ",i_Game.Opponent);
//                    }

//                    if(this._Location)
//                    {
//                        m_SBGames.AppendFormat("AT {0} ",i_Game.Location);
//                    }

//                    if(this._Date)
//                    {
//                        m_SBGames.AppendFormat("ON {0} ",i_Game.GameDate);
//                    }

//                    if(this._ScoutType)
//                    {
////						m_SBGames.AppendFormat("- {0} ",i_Game.ScoutType);
//                        #region Modified Area  at 2008-10-22 14:32:22@Simon
//                        //add his code for show Scout Type once
//                        if(!this.OnceScoutType||scouttypetimes==maxtime)
//                        {
//                            m_SBGames.AppendFormat("- {0} ",i_Game.ScoutType);
//                        }
//                        scouttypetimes++;

//                        #endregion        //End Modify
//                    }
//                }

//                if(i_MultiLine)
//                {
//                    m_SBGames.AppendFormat("\n");
//                }
//                else
//                {
//                    #region Modified Area 2008-10-27 9:19:25@Simon
////					m_SBGames.AppendFormat(",");
//                    if(!this.FirstObjectOnly)
//                    {
//                        m_SBGames.AppendFormat(",");
//                    }
//                    #endregion        //End Modify
//                }
//            }
//            m_SBGames.Length--;


//            return m_SBGames.ToString();
//        }

//        private string MakeGameFilterString(GameInfoCollection i_Games, FilterInfoCollection i_Filters, bool i_MultiLine)
//        {
//            StringBuilder m_SBGameFilter = new StringBuilder();

//            string m_StrGames = MakeGameInfoString(i_Games, i_MultiLine);

//            string m_StrFilters = MakeFilterInfoString(i_Filters, i_MultiLine);

//            m_SBGameFilter.AppendFormat("{0} \n\n{1}", m_StrGames, m_StrFilters);

//            return m_SBGameFilter.ToString();
//        }

        #endregion

        #region New
        private string MakeGameInfoString(GameInfoCollection i_Games, EdlInfoCollection i_EdlInfos, bool i_MultiLine)
        {
            string m_RetStr = "<No Game>";

            if ((i_Games == null || i_Games.Count == 0) && (i_EdlInfos == null || i_EdlInfos.Count == 0))
            {
                return(m_RetStr);
            }

            if (i_Games == null)
            {
                i_Games = new GameInfoCollection();
            }

            if (i_EdlInfos == null)
            {
                i_EdlInfos = new EdlInfoCollection();
            }

            StringBuilder m_SBGames = new StringBuilder();

            if (this._Title)
            {
                m_SBGames.AppendFormat("{0}", "Games :\n");
            }

            int times = 0;

            int scouttypetimes = 0, maxtime = i_Games.Count - 1;  //added at 2008-10-22 14:24:25@Simon

            foreach (GameInfo i_Game in i_Games)
            {
                if ((i_Game.Object == null || i_Game.Object == string.Empty) &&
                    (i_Game.Opponent == null || i_Game.Opponent == string.Empty))
                {
                    //if obj and opponent is null , add game name
                    if (i_Game.GameName == null || i_Game.GameName == string.Empty)
                    {
                        m_SBGames.Append("<None>");
                    }
                    else
                    {
                        m_SBGames.AppendFormat("{0}", i_Game.GameName);
                    }
                }
                else
                {
                    #region Format Game Display only some parts of game Name
                    //format game name
                    if (!this.FirstObjectOnly || times == 0)
                    {
                        if (this._Object)
                        {
                            m_SBGames.AppendFormat("{0} ", i_Game.Object);
                        }

                        m_SBGames.Append("VS");

                        times++;
                    }

                    if (this._Opponent)
                    {
                        m_SBGames.AppendFormat(" {0} ", i_Game.Opponent);
                    }

                    if (this._Location)
                    {
                        m_SBGames.AppendFormat("AT {0} ", i_Game.Location);
                    }

                    if (this._Date)
                    {
                        m_SBGames.AppendFormat("ON {0} ", i_Game.GameDate);
                    }

                    if (this._ScoutType)
                    {
                        //						m_SBGames.AppendFormat("- {0} ",i_Game.ScoutType);
                        #region Modified Area  at 2008-10-22 14:32:22@Simon
                        //add his code for show Scout Type once
                        if (!this.OnceScoutType || scouttypetimes == maxtime)
                        {
                            m_SBGames.AppendFormat("- {0} ", i_Game.ScoutType);
                        }
                        scouttypetimes++;

                        #endregion        //End Modify
                    }
                    #endregion
                }

                if (i_MultiLine)
                {
                    m_SBGames.AppendFormat("\n");
                }
                else
                {
                    #region Modified Area 2008-10-27 9:19:25@Simon
                    //					m_SBGames.AppendFormat(",");
                    if (!this.FirstObjectOnly)
                    {
                        m_SBGames.AppendFormat(",");
                    }
                    #endregion        //End Modify
                }
            }
            if (!i_MultiLine && this.FirstObjectOnly && maxtime > 0)
            {
                m_SBGames.AppendFormat(",");
            }
            foreach (EdlInfo edlInfo in i_EdlInfos)
            {
                m_SBGames.AppendFormat("{0} ", edlInfo.EDLName);

                if (i_MultiLine)
                {
                    m_SBGames.AppendFormat("\n");
                }
                else
                {
                    m_SBGames.AppendFormat(",");
                }
            }

            m_SBGames.Length--;

            return(m_SBGames.ToString());
        }
Beispiel #6
0
        public string MakeGameInfoString(GameInfoCollection i_Games)
        {
            string m_RetStr = "<No Game>";

            if (i_Games == null || i_Games.Count == 0)
            {
                return(m_RetStr);
            }

            StringBuilder m_SBGames = new StringBuilder();

            if (this._Title)
            {
                m_SBGames.AppendFormat("{0}", "Games:\n");
            }

            int times = 0;


            foreach (GameInfo i_Game in i_Games)
            {
                if ((i_Game.Object == null || i_Game.Object == string.Empty) &&
                    (i_Game.Opponent == null || i_Game.Opponent == string.Empty))
                {
                    //if obj and opponent is null , add game name
                    if (i_Game.GameName == null || i_Game.GameName == string.Empty)
                    {
                        m_SBGames.Append("<None>");
                    }
                    else
                    {
                        m_SBGames.AppendFormat("{0}", i_Game.GameName);
                    }
                }
                else
                {
                    //format game name
                    if (!this.FirstObjectOnly || times == 0)
                    {
                        if (this._Object)
                        {
                            m_SBGames.AppendFormat("{0} ", i_Game.Object);
                        }

                        m_SBGames.Append("VS");

                        times++;
                    }

                    if (this._Opponent)
                    {
                        m_SBGames.AppendFormat(" {0} ", i_Game.Opponent);
                    }

                    if (this._Location)
                    {
                        m_SBGames.AppendFormat("AT {0} ", i_Game.Location);
                    }

                    if (this._Date)
                    {
                        m_SBGames.AppendFormat("ON {0} ", i_Game.GameDate);
                    }

                    if (this._ScoutType)
                    {
                        m_SBGames.AppendFormat("- {0} ", i_Game.ScoutType);
                    }
                }

                if (this.Multiline)
                {
                    m_SBGames.AppendFormat("\n");
                }
                else
                {
                    if (!this.FirstObjectOnly)
                    {
                        m_SBGames.AppendFormat(",");
                    }
                }
            }
            m_SBGames.Length--;


            return(m_SBGames.ToString());
        }