コード例 #1
0
 public GameScrapperJob()
 {
     HostingEnvironment.RegisterObject(this);
     _clubsRepo = new ClubsRepo();
     _gamesRepo = new GamesRepo();
     _teamsRepo = new TeamsRepo();
 }
コード例 #2
0
 public PgGames()
 {
     InitializeComponent();
     type_combobox.ItemsSource      = ListType();
     pegi_combobox.ItemsSource      = ListPEGI();
     exclusive_combobox.ItemsSource = ListExclusive();
     SetData();
     gamesListView.ItemsSource = GamesRepo.GetAll();
 }
コード例 #3
0
        public IActionResult Index([FromBody] int levelNumber = 1)
        {
            var stringCells = gameDataLoader.Load(levelNumber);
            var cells       = parsingService.Parse(stringCells);

            Game game = new Game(cells, stringCells[0].Length, stringCells.Length, levelNumber);

            GamesRepo.AddGame(game);

            return(new ObjectResult(game.GameField));
        }
コード例 #4
0
        private void BtnSearchGame_Click(object sender, RoutedEventArgs e)
        {
            string name      = nameSearch.Text;
            string publisher = publisherSearch.Text;
            string producer  = producerSearch.Text;
            string type      = type_combobox.Text;
            string exc       = exclusive_combobox.Text;
            string pegi      = pegi_combobox.Text;

            gamesListView.ItemsSource = GamesRepo.Getby(name, publisher, producer, type, exc, pegi);
        }
コード例 #5
0
        public ActionResult TeamSchedules(int id, int leagueId, int seasonId)
        {
            var gamesRepo = new GamesRepo();
            var resList   = gamesRepo.GetCyclesByTeam(id).Where(g => g.LeagueId == leagueId);

            var tRepo = new TeamsRepo();
            var team  = tRepo.GetById(id);

            ViewBag.TeamId   = id;
            ViewBag.LeagueId = leagueId;
            ViewBag.SeasonId = seasonId;
            if (team != null)
            {
                ViewBag.Logo     = UIHelper.GetTeamLogo(team.Logo);
                ViewBag.ResTitle = team.Title.Trim();
                if (team.LeagueTeams.Count > 1)
                {
                    var leagues = team.LeagueTeams.Where(l => (l.Leagues.Stages.Any(s => s.GamesCycles.Any(gc => gc.HomeTeamId == id && gc.IsPublished)) || l.Leagues.Stages.Any(s => s.GamesCycles.Any(gc => gc.GuestTeamId == id && gc.IsPublished))) && l.SeasonId == seasonId);
                    List <SelectListItem> items = new List <SelectListItem>();
                    foreach (var league in leagues)
                    {
                        items.Add(new SelectListItem {
                            Text = league.Leagues.Name, Value = league.LeagueId.ToString(), Selected = league.LeagueId == leagueId
                        });
                    }
                    ViewBag.Leagues = items;
                }
            }
            var lRepo = new LeagueRepo();
            var leag  = lRepo.GetById(leagueId);

            if (leag != null)
            {
                var alias = leag.Union?.Section?.Alias;
                switch (alias)
                {
                case GamesAlias.WaterPolo:
                case GamesAlias.BasketBall:
                    return(View("WaterPoloBasketBall/Schedules", new SchedulesDto {
                        GameCycles = resList
                    }));

                default:
                    return(View(nameof(Schedules),
                                new SchedulesDto {
                        GameCycles = resList
                    }));
                }
            }

            return(View(nameof(Schedules), new SchedulesDto {
                GameCycles = resList
            }));
        }
コード例 #6
0
        public void GetGame_AfterAddGame_ReturnsExpectedGame()
        {
            var expectedGame = A.Dummy <Game>();
            var guid         = new Guid();

            expectedGame.GameField.Id = guid;

            GamesRepo.AddGame(expectedGame);

            var game = GamesRepo.GetGame(guid);

            game.Should().Be(expectedGame);
        }
コード例 #7
0
        public void ExportReferees(int id)
        {
            var repo = new GamesRepo();

            var grid = new GridView {
                DataSource = repo.GetRefereesExcel(id)
            };

            grid.DataBind();

            var rer = grid.RowHeaderColumn;

            Response.ClearContent();
            Response.AddHeader("content-disposition", "attachment; filename=ExportReferees.xls");
            Response.ContentType = "application/ms-excel";
            StringWriter   sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);

            grid.RenderControl(hw);
            Response.Write(sw.ToString());
            Response.End();
        }
コード例 #8
0
        public IActionResult Moves(Guid gameId, [FromBody] UserInputForMovesPost userInput)
        {
            var game = GamesRepo.GetGame(gameId);

            game.MovePlayer(moveProvider.GetMovement(userInput));

            if (game.GameField.IsFinished)
            {
                GameDto gameField = game.GameField;
                try
                {
                    var stringCells = gameDataLoader.Load(game.GameField.Level + 1);
                    var cells       = parsingService.Parse(stringCells);
                    game.GameField = new GameDto(cells, true, true, game.GameField.Width, game.GameField.Height, gameId,
                                                 false, 0, game.GameField.Level + 1);
                }
                catch
                {
                    game.GameField = gameField;
                }
            }
            return(new ObjectResult(game.GameField));
        }
コード例 #9
0
 public IActionResult Leaderboard()
 {
     return(new ObjectResult(GamesRepo.GetTable()));
 }
コード例 #10
0
 public MovesController(GamesRepo gamesRepo, IMapper mapper, IFieldFactory factory)
 {
     this.mapper    = mapper;
     this.gamesRepo = gamesRepo;
     this.factory   = factory;
 }
コード例 #11
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string name;

            #region try/catch

            try
            {
                name = Name_textbox.Text;
            }
            catch
            {
                MessageBox.Show(Properties.Resources.errorAddGameChar + " 'Name'", Properties.Resources.errorError);
                goto End;
            }

            string publisher;
            try
            {
                publisher = publisher_textbox.Text;
            }
            catch
            {
                MessageBox.Show(Properties.Resources.errorAddGameChar + " 'Publisher'", Properties.Resources.errorError);
                goto End;
            }

            string producer;
            try
            {
                producer = producent_textbox.Text;
            }
            catch
            {
                MessageBox.Show(Properties.Resources.errorAddGameChar + " 'Producer'", Properties.Resources.errorError);
                goto End;
            }

            double price;
            try
            {
                price = double.Parse(price_textbox.Text);
            }
            catch
            {
                MessageBox.Show(Properties.Resources.errorAddGameDouble + " 'Price'", Properties.Resources.errorError);
                goto End;
            }

            uint metacritics;
            try
            {
                metacritics = uint.Parse(meta_textbox.Text);
            }
            catch
            {
                MessageBox.Show(Properties.Resources.errorAddGameInt + " 'Metacritics'", Properties.Resources.errorError);
                goto End;
            }

            uint pegi;
            try
            {
                pegi = uint.Parse(pegi_combobox.Text);
            }
            catch
            {
                MessageBox.Show(Properties.Resources.errorAddGameInt + " 'PEGI'", Properties.Resources.errorError);
                goto End;
            }

            #endregion

            try
            {
                string date      = Date();
                string exclusive = ex_combobox.Text;
                string isSeries  = isSeries_combobox.Text;
                string type      = type_combobox.SelectedItem.ToString();

                var newGame = new Games(name, publisher, producer, type, price, date, metacritics, exclusive, isSeries, pegi);
                GamesRepo.Insert(newGame);
            }
            catch
            {
                MessageBox.Show(Properties.Resources.errorAddGameNewGame, Properties.Resources.errorError);
            }
            End :;
        }
コード例 #12
0
 public GamesController(IFieldFactory fieldFactory, GamesRepo gamesRepo)
 {
     this.fieldFactory = fieldFactory;
     this.gamesRepo    = gamesRepo;
 }
コード例 #13
0
 public Account()
 {
     InitializeComponent();
     gamesUserListView.ItemsSource = GamesRepo.GetByLogin(Assets.Scripts.Login.UserLogin);
     SetData();
 }
コード例 #14
0
 public RatingsController()
 {
     _RatingsRepo = new RatingsRepo();
     _GamesRepo   = new GamesRepo();
 }
コード例 #15
0
 public GamesController()
 {
     _GamesRepo = new GamesRepo();
 }