Ejemplo n.º 1
0
        private GameDay getGameDay()
        {
            GameDayModel gdModel = new GameDayModel();
            GameDay      gd      = new GameDay(gdModel);

            return(gd);
        }
Ejemplo n.º 2
0
        //TODO: Unterschiedliche Zeiten für HD Wahlen erkennen
        //      +Unterfunktionen
        public Game SetupGame(int id)
        {
            HtmlDocument  source = web.Load(String.Concat(consthreadlink, id.ToString()));
            ConstructPost post   = GetPostDataFromNode(GetNodesByClass(source.DocumentNode, consclassmessage).First());

            Game ret = new Game()
            {
                ThreadId = id, SL = post.Author
            };
            GameDay gameday = new GameDay()
            {
                Day = 1
            };

            gameday.LastPostNumber = post.PostNumber;
            gameday.Start          = post.Time;
            gameday.End            = GetLynchTime(post.Postcontent, post.Author, post.PostId, post.Time, id).AddDays(1);

            ret.Days.Add(gameday);
            ret.Active = true;

            ret.PlayerList  = GetPlayerList(post.Postcontent, post.Author, post.PostNumber, id);
            ret.HoursPerDay = GetHoursPerDay(post.Postcontent);
            ret.WithHD      = GetWithHD(post.Postcontent);

            return(ret);
        }
        public async Task <GameDay> AddGameDayAsync(GameDay newGameDay, CancellationToken ct = default)
        {
            this._dbContext.GameDays.Add(newGameDay);
            await this._dbContext.SaveChangesAsync(ct);

            return(newGameDay);
        }
Ejemplo n.º 4
0
 public GameDayTest()
 {
     this.model = new GameDayModel()
     {
         Id = uniqueGuid
     };
     this.dut = new GameDay(this.model);
 }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            GameDay gameDay = await db.GameDays.FindAsync(id);

            db.GameDays.Remove(gameDay);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 6
0
        private async void NavegationNotification(string param)
        {
            string[] paramPush = param.Split(';');
            Preferences.Set("pushParam", string.Empty);

            try
            {
                if (paramPush.Length > 2)
                {
                    string valorNav = paramPush.GetValue(1).ToString();
                    object val      = paramPush.GetValue(2).ToString();
                    Services.NavigationService nav = new Services.NavigationService();

                    switch (valorNav)
                    {
                    case "B":
                        var gamesDay = new List <GameDay>();
                        var gameDay  = new GameDay();
                        Services.GameDayService gameDayService = new Services.GameDayService();
                        gamesDay = await gameDayService.GetGameDay(null);

                        foreach (var game in gamesDay)
                        {
                            if (int.Parse(val.ToString()) == game.IDCalendario)
                            {
                                gameDay = game as Models.GameDay;
                            }
                        }

                        if (gameDay.IDCalendario > 0)
                        {
                            nav.Navegate("GameDetailsPage", gameDay);
                        }

                        break;

                    case "N":
                        nav.Navegate("NewsPage");
                        break;

                    case "E":
                        nav.Navegate("LeadersPage");
                        break;

                    case "C":
                        nav.Navegate("SchedulePage");
                        break;

                    default:
                        break;
                    }
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 7
0
        public void TestAdvance_WhenNotStarted_ThenTrue()
        {
            GameDay gd = this.getGameDay();

            gd.PutInSeason(this.dut);

            bool result = this.dut.Advance();

            Assert.True(result);
        }
Ejemplo n.º 8
0
        public static Table Create(Guid id, int number, string note, int seatsCount, Guid gameDayID, Guid?gameID)
        {
            var table = new Table(id, number);

            table.Note       = note;
            table.SeatsCount = seatsCount;
            table.GameDay    = GameDay.Get(gameDayID);
            table.Game       = gameID.HasValue ? Game.Get(gameID.Value) : null;
            //
            return(table);
        }
Ejemplo n.º 9
0
        public static GameDayViewModel Convert(GameDay gameDay)
        {
            GameDayViewModel model = new GameDayViewModel();

            model.GamesDay = gameDay.GamesDay;
            model.Id       = gameDay.Id;
            model.LeagueSessionScheduleId = gameDay.LeagueSessionScheduleId;
            model.GamesTimes = GameTimeConverter.ConvertList(gameDay.GamesTimes);

            return(model);
        }
Ejemplo n.º 10
0
        private static GameDay CreateGameDay(Matchup match, Matchup matchSwitched)
        {
            var matchups = new List <Matchup>
            {
                match, matchSwitched
            };

            var gameDay = GameDay.Create(matchups);

            return(gameDay);
        }
Ejemplo n.º 11
0
        public void OnShareClicked(object sender, EventArgs args)
        {
            gameDay = g as GameDay;

            string statusGame = gameDay.ScoreCasa > 0 ? "FINAL" : gameDay.Hora;
            string score      = statusGame == "FINAL" ? $"{gameDay.Visita} {gameDay.ScoreVisita} @ {gameDay.Casa} {gameDay.ScoreCasa}" :
                                $"{gameDay.Visita} vs {gameDay.Casa} {gameDay.NombreInstalacion}";

            //DependencyService.Get<IShareSocial>().ShareSocial("Compartir", score + " " + statusGame + " #LNBFans " + "#playStore goo.gl/mYKel4  - #appStore goo.gl/KtnF09", "http://deportes56.com/Imagenes/LNB/Detalles/LNB300.png", "LNB300");

            Helpers.SettingHelper.ShareUri(score + " " + statusGame + " #LNBFans playStore goo.gl/mYKel4  - appStore goo.gl/KtnF09", "Compartir");
        }
        public async Task <ActionResult> Edit([Bind(Include = "GameNo,Date,Time,Venue,PaidBy,PaidAmount,PassedGame")] GameDay gameDay)
        {
            if (ModelState.IsValid)
            {
                db.Entry(gameDay).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.PaidBy = new SelectList(db.Players, "ID", "FirstName", gameDay.PaidBy);
            return(View(gameDay));
        }
Ejemplo n.º 13
0
        public void TestPutInGameDay_WhenGiven_ThenUpdated()
        {
            Guid         expected = Guid.NewGuid();
            GameDayModel gdModel  = new GameDayModel()
            {
                Id = expected
            };
            GameDay gd = new GameDay(gdModel);

            this.dut.PutInGameDay(gd);

            Assert.True(expected.Equals(this.model.GameDay));
        }
Ejemplo n.º 14
0
        public void GetGameDetail(GameDay game)
        {
            IsBusy = true;

            if (game != null)
            {
                Game      = new GameDay();
                this.game = game;
            }

            IsBusy = false;

            //return Game;
        }
        // GET: GameDays/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GameDay gameDay = await db.GameDays.FindAsync(id);

            if (gameDay == null)
            {
                return(HttpNotFound());
            }
            return(View(gameDay));
        }
        // GET: GameDays/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GameDay gameDay = await db.GameDays.FindAsync(id);

            if (gameDay == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PaidBy = new SelectList(db.Players, "ID", "FirstName", gameDay.PaidBy);
            return(View(gameDay));
        }
Ejemplo n.º 17
0
        //TODO: Mehr Schlüsselwörter erkennen
        //TODO: Spieler ersetzen erkennen(ReplacePlayer)
        private void AnalyzeSLPost(ConstructPost post, ref Game game)
        {
            if (post.Postcontent.DocumentNode.InnerText.Contains("Nachtpost") && post.Time > game.CurrentDay().End)
            {
                var     current = game.CurrentDay();
                GameDay gameday = new GameDay()
                {
                    Day = current.Day + 1, End = current.End.AddHours(game.HoursPerDay), Start = post.Time
                };
                game.Days.Add(gameday);
            }

            var plist = String.Join("|", game.PlayerList.Where(x => x.Alive).Select(x => ReplaceSymbols(x.Name)));
            var alist = String.Join("|", playerNames.Select(x => ReplaceSymbols(x.Value)));

            Regex regrep = new Regex($@"!replace (?<player1>{plist})?\s*(?<player2>{alist})?", RegexOptions.IgnoreCase);
            var   match  = regrep.Match(post.Postcontent.DocumentNode.InnerText);

            if (match.Success)
            {
                if (match.Groups["player1"].Success)
                {
                }
            }


            Regex reg = new Regex($@"(?<player>{plist})?\s*(wird|ist)(\s*neuer)?\s*(Hauptmann|HD)", RegexOptions.IgnoreCase);

            match = reg.Match(post.Postcontent.DocumentNode.InnerText);

            if (match.Success)
            {
                if (match.Groups["player"].Success)
                {
                    game.HD = game.PlayerList.Where(x => x.Name.Equals(match.Groups["player"].Value, StringComparison.InvariantCultureIgnoreCase)).First();
                }
                else
                {
                    errorList.Add(new Error(conserrorHD, post.Author, post.PostId, game.ThreadId));
                }
            }
        }
        public async Task <bool> PublishSessionsSchedulesAsync(List <LeagueSessionScheduleViewModel> newLeagueSessionsSchedules, CancellationToken ct = default(CancellationToken))
        {
            List <LeagueSessionSchedule> leagueSessionOperations = new List <LeagueSessionSchedule>();

            foreach (LeagueSessionScheduleViewModel newSchedule in newLeagueSessionsSchedules)
            {
                LeagueSessionSchedule leagueSessionSchedule = new LeagueSessionSchedule()
                {
                    Active        = newSchedule.Active,
                    LeagueID      = newSchedule.LeagueID,
                    ByeWeeks      = newSchedule.ByeWeeks,
                    NumberOfWeeks = newSchedule.NumberOfWeeks,
                    SessionStart  = newSchedule.SessionStart,
                    SessionEnd    = newSchedule.SessionEnd
                };

                // create game day entry for all configured game days
                foreach (GameDayViewModel gameDay in newSchedule.GamesDays)
                {
                    GameDay newGameDay = new GameDay()
                    {
                        GamesDay = gameDay.GamesDay
                    };

                    // create game time entry for every game day
                    foreach (GameTimeViewModel gameTime in gameDay.GamesTimes)
                    {
                        GameTime newGameTime = new GameTime()
                        {
                            GamesTime = DateTimeOffset.FromUnixTimeSeconds(gameTime.GamesTime).DateTime.ToLocalTime(),
                        };

                        newGameDay.GamesTimes.Add(newGameTime);
                    }

                    leagueSessionSchedule.GamesDays.Add(newGameDay);
                }

                // update teams sessions
                foreach (TeamSessionViewModel teamSession in newSchedule.TeamsSessions)
                {
                    // retrieve the team with the corresponding id
                    Team team = await this._teamRepository.GetByIdAsync(teamSession.TeamId, ct);

                    if (team != null)
                    {
                        TeamSession newTeamSession = new TeamSession()
                        {
                            Team = team,
                            LeagueSessionSchedule = leagueSessionSchedule
                        };

                        leagueSessionSchedule.TeamsSessions.Add(newTeamSession);
                    }
                }

                // update matches for this session
                foreach (MatchViewModel match in newSchedule.Matches)
                {
                    // if match DateTime is not set do not add it to the database
                    if (match.DateTime != 0)
                    {
                        Match newMatch = new Match()
                        {
                            DateTime   = match.DateTime,
                            HomeTeamId = match.HomeTeamId,
                            AwayTeamId = match.AwayTeamId,
                            LeagueID   = match.LeagueID
                        };

                        MatchResult newMatchResult = new MatchResult()
                        {
                            LeagueId   = match.LeagueID,
                            HomeTeamId = match.HomeTeamId,
                            AwayTeamId = match.AwayTeamId
                        };

                        newMatch.MatchResult = newMatchResult;

                        leagueSessionSchedule.Matches.Add(newMatch);
                    }
                }

                leagueSessionOperations.Add(await this._sessionScheduleRepository.AddScheduleAsync(leagueSessionSchedule, ct));
            }

            // ensure all leagueSessionOperations did not return any null values
            return(leagueSessionOperations.All(op => op != null));
        }
Ejemplo n.º 19
0
 public InactiveRound(string name, Hour hour, GameDay initialisation, GameDay end) : base(name, hour, new List <GameDay>(), new List <TvOffset>(), initialisation, end, false, 0)
 {
     _ranking = null;
 }
Ejemplo n.º 20
0
 public KnockoutRound(string name, Hour hour, List <GameDay> dates, List <TvOffset> offsets, bool twoLegs, GameDay initialisation, GameDay end, RandomDrawingMethod method, bool noRandomDrawing) : base(name, hour, dates, offsets, initialisation, end, twoLegs, 0)
 {
     _randomDrawingMethod = method;
     _noRandomDrawing     = noRandomDrawing;
 }
Ejemplo n.º 21
0
 public ChampionshipRound(string name, Hour hour, List <GameDay> days, bool twoLegs, List <TvOffset> offsets, GameDay initialisation, GameDay end, int lastDaySameDay) : base(name, hour, days, offsets, initialisation, end, twoLegs, lastDaySameDay)
 {
 }