示例#1
0
        public void WriteOne(GameDBO item)
        {
            string output  = JsonConvert.SerializeObject(item);
            string message = output;

            WriteOneMessage(message);
        }
示例#2
0
        private List <GameDBO> ParseGameData(List <string> partiallyParsed)
        {
            string competition = partiallyParsed[0];
            int    current     = 1;

            List <GameDBO> listOut = new List <GameDBO>();


            while (current < partiallyParsed.Count)
            {
                string time_text = partiallyParsed[current++];
                //string minuto_jornada = partiallyParsed[current++];
                //if (!minuto_jornada.Contains("Minuto")
                //   && !minuto_jornada.Contains("Descanso")
                //    && !minuto_jornada.Contains("Jornada")  )

                //{
                //    current--;
                //}
                string team1 = partiallyParsed[current++];
                current++;
                string team2 = partiallyParsed[current++];
                current++;
                DateTime date = DateTime.Today;
                if (DateTime.TryParse(time_text, out date))
                {
                    var retGame = new GameDBO
                    {
                        Start           = date,
                        CompetitionName = competition,
                        Team1           = team1,
                        Team2           = team2,
                        Sport           = "soccer",
                        LastUpdatedOn   = DateTime.UtcNow
                    };
                    listOut.Add(retGame);
                }
                else
                {
                    LogError("date parse failed for time: " + time_text);
                }
            }



            return(listOut);
        }
        public void WriteOne(GameDBO dbo, string json)
        {
            var entityGame = Converter.GameDBO_To_EntityGame(dbo);

            this.LastPushPersisted = true;

            if (!IsGamePersisted(entityGame))
            {
                db.Games.Add(entityGame);
                this.LastPushPersisted = true;
                log.DebugFormat(" [x] Received {0}", json);
                db.SaveChanges();
                log.DebugFormat("New Id = {0}", entityGame.Id);
            }
            else
            {
                log.DebugFormat("***old news\n{0}", json);
                this.LastPushPersisted = false;
            }


            OnPushedMessage(json, LastPushPersisted);
        }
        public void WriteOne(GameDBO dbo)
        {
            var json = JsonConvert.SerializeObject(dbo);

            WriteOne(dbo, json);
        }