public void GetGameScheduleTest() { var vm = new Csbchoops.Web.ViewModels.GameSchedulesViewModel(); var games = vm.GetGames(71); Assert.IsTrue(games.Any()); }
private List<GameSchedulesViewModel> GetPlayoffGames(int divisionId) { using (var db = new CSBCDbContext()) { var games = (from g in db.SchedulePlayoffs from l in db.ScheduleLocations from d in db.Divisions where g.DivisionId == divisionId where g.LocationNumber == l.LocationNumber where g.DivisionId == d.DivisionID select new { g.ScheduleNumber, d.DivisionID, g.GameDate, g.GameTime, d.Div_Desc, g.LocationNumber, l.LocationName, g.GameNumber, g.HomeTeam, g.VisitingTeam, g.Descr }); var schedGames = new List<GameSchedulesViewModel>(); DateTime time; foreach (var g in games) { var game = new GameSchedulesViewModel(); game.ScheduleNumber = g.ScheduleNumber; //game.DivisionId = g.DivisionID; game.GameDate = (DateTime)g.GameDate; if (DateTime.TryParse(g.GameTime, out time)) game.GameTime = time; //game.D = g.Div_Desc; //game.LocationNumber = (int)g.LocationNumber; game.LocationName = g.LocationName; game.GameNumber = g.GameNumber; game.HomeTeamName = g.HomeTeam; game.VisitingTeamName = g.VisitingTeam; game.GameDescription = g.Descr; //game.GameType = GameTypes.Playoff; schedGames.Add(game); } if (divisionId != 0) { schedGames = schedGames .OrderBy(g => g.GameDate).ThenBy(g => g.GameTime).ThenBy(g => g.DivisionID).ToList<GameSchedulesViewModel>(); } return schedGames; } }
private void LoadSchedule(int divisionId, int teamId) { if (panelGames.Visible) { try { if (cbAllTeams.Checked) teamId = 0; var vm = new GameSchedulesViewModel(); var games = new List<GameSchedulesViewModel>(); if (teamId == 0) { games = vm.GetGames(Convert.ToInt32(Session["SeasonID"]), divisionId); } else { games = vm.GetGames(Convert.ToInt32(Session["SeasonID"]), divisionId, teamId); } var grid = grdSchedule; grid.DataSource = games.OrderBy(g => g.GameDate); grid.DataBind(); if (divisionId > 0) { //lblTitle.Text = games..FirdivisionDescription + " Schedule"; } //if (iTeam > 0) //{ // lblTitle.Text = divisionDescription + " Team " + sTeamDesc + " Schedule"; //} Session["ScheduleNo"] = divisionId; //Session["ScheduleDesc"] = divisionDescription; //Session["TeamName"] = sTeamDesc; Session["ReportName"] = "Schedules"; cobTeams.Visible = true; grdSchedule.Columns[9].Visible = ((Session["Editing"] != null & Session["Editing"] == "All") || (Session["User"] != null & CheckAD(Convert.ToInt32(ddlDivisions.SelectedValue), (User)Session["User"])) ); //btnSubmit.Visible = false; } catch (Exception ex) { //lblError.Text = "LoadSchedule:" + ex.Message; } } }
public void GetGameScheduleByDivisionandTeamTest() { var vm = new Csbchoops.Web.ViewModels.GameSchedulesViewModel(); var games = vm.GetGames(71, 757, 4615); Assert.IsTrue(games.Any()); }