public async Task AddAsync_GivenAnime_ShouldAddAnime() { // Given var dbContext = InMemoryDbProvider.GetDbContext(); var repository = new SeasonRepository(dbContext); const string expectedName = "ExpectedName"; const int expectedYear = 2000; var season = new SeasonBuilder() .WithName(expectedName) .WithYear(expectedYear) .Build(); // When await repository.AddAsync(season); // Then var allSeasons = await dbContext.AnimeSeasons.ToListAsync(); var newSeason = await dbContext.AnimeSeasons.FirstOrDefaultAsync(); using (new AssertionScope()) { allSeasons.Should().ContainSingle(); newSeason.Should().NotBeNull(); newSeason.Name.Should().Be(expectedName); newSeason.Year.Should().Be(expectedYear); } }
private static InsertSeiyuuHandler CreateHandler(SeiyuuMoeContext dbContext) { var scheduleConfiguration = ConfigurationReader.MalBgJobsScheduleConfiguration; var animeRepository = new AnimeRepository(dbContext); var seiyuuRepository = new SeiyuuRepository(dbContext); var characterRepository = new CharacterRepository(dbContext); var animeRoleRepository = new AnimeRoleRepository(dbContext); var seasonRepository = new SeasonRepository(dbContext); var jikanUrl = ConfigurationReader.JikanUrl;; var jikanConfiguration = new JikanClientConfiguration { Endpoint = jikanUrl, SuppressException = true }; var jikanClient = new Jikan(jikanConfiguration); var jikanService = new JikanService(jikanClient); var s3Client = new S3Service(); return(new InsertSeiyuuHandler( scheduleConfiguration.InsertSeiyuuBatchSize, scheduleConfiguration.DelayBetweenCallsInSeconds, seiyuuRepository, seasonRepository, characterRepository, animeRepository, animeRoleRepository, jikanService, s3Client )); }
private UpdateAnimeHandler CreateHandler(SeiyuuMoeContext dbcontext, IMalApiService apiService) { var animeRepository = new AnimeRepository(dbcontext); var seasonRepository = new SeasonRepository(dbcontext); return(new UpdateAnimeHandler(animeRepository, seasonRepository, apiService)); }
public void AddSeasons() { // Arrange var repository = new SeasonRepository(); var dbContext = A.Fake <ProFootballEntities>(); var seasons = new List <Season>(); for (int i = 0; i < 3; i++) { var season = new Season { ID = 2017 - i }; seasons.Add(season); } A.CallTo(() => dbContext.Seasons.AddRange(A <IEnumerable <Season> > .Ignored)).Returns(seasons); // Act var result = repository.AddEntities(dbContext, seasons); // Assert A.CallTo(() => dbContext.Seasons.AddRange(seasons)).MustHaveHappenedOnceExactly(); Assert.AreSame(seasons, result); }
public void GetCurrentSeasonTest() { var rep = new SeasonRepository(context); var season = new Season(); season = rep.GetCurrentSeason(1); Assert.IsTrue(season != null); Assert.IsTrue(season.SeasonID != 0); }
//[TestCase] public void TestCase1() { // Arrange var repository = new SeasonRepository(); // Act // Assert }
public static void InsertSeason(string name, DateTime startDate, DateTime endDate, bool isActive) { if (endDate < DateTime.Now || string.IsNullOrEmpty(name)) { throw new ExceptionWithHttpStatus(System.Net.HttpStatusCode.BadRequest, Messages.OBRIGATORY_DATA_MISSING); } SeasonRepository.Get().InsertSeason(name, startDate, endDate, isActive); }
private UpdateSeasonsHandler CreateHandler(SeiyuuMoeContext dbContext) { var seasonRepository = new SeasonRepository(dbContext); var jikanUrl = ConfigurationReader.JikanUrl; var jikanClient = new Jikan(jikanUrl); var jikanService = new JikanService(jikanClient); return(new UpdateSeasonsHandler(seasonRepository, jikanService)); }
public void GetSummaryTest() { var context = new CSBCDbContext(); var rep = new SummaryRepository(context); var repSeason = new SeasonRepository(context); var current = repSeason.GetCurrentSeason(1); rep.GetSummary(1, current.SeasonID); Assert.IsTrue(false); }
protected void SeasonList_SelectedIndexChanged(object sender, EventArgs e) { var seasonRepository = new SeasonRepository(); var races = seasonRepository.GetById(int.Parse(SeasonList.SelectedValue)).Races; RaceList.DataSource = races; RaceList.DataValueField = "Id"; RaceList.DataTextField = "Name"; RaceList.DataBind(); }
public void GetDivisionRecordsTest() { context = new CSBCDbContext(); var house = new Division(); var rep = new DivisionRepository(context); var seasonRep = new SeasonRepository(context); var season = seasonRep.GetCurrentSeason(1); var divisions = rep.GetDivisions(season.SeasonID); Assert.IsTrue(divisions.Any<Division>()); }
public static SeasonEntity GetCurrentSeason() { var season = SeasonRepository.Get().GetCurrentSeason(); if (season == null) { throw new ExceptionWithHttpStatus(System.Net.HttpStatusCode.BadRequest, Messages.NO_SEASONS_REGISTERED); } return(season); }
public async Task GetAsync_GivenNoSeasons_ShouldReturnNull() { // Given var dbContext = InMemoryDbProvider.GetDbContext(); var repository = new SeasonRepository(dbContext); // When var result = await repository.GetAsync(x => true); // Then result.Should().BeNull(); }
public void GetSeasons_HappyPath() { // Arrange var dbContext = A.Fake <ProFootballEntities>(); var repository = new SeasonRepository(dbContext); // Act var result = repository.GetEntities(); // Assert Assert.IsInstanceOf <IEnumerable <Season> >(result); }
public void GetPlayerDivisionTest() { context = new CSBCDbContext(); var repPeople = new PlayerRepository(context); var player = context.Players.FirstOrDefault(); //var person = repPeople.GetById(2); var repSeason = new SeasonRepository(context); var season = repSeason.GetCurrentSeason(1); var repDivision = new DivisionRepository(context); var dt = repDivision.GetPlayerDivision(1, season.SeasonID, player.PeopleID); Assert.IsTrue(dt != 0); }
private UpdateSeasonsHandler CreateHandler(SeiyuuMoeContext dbContext) { var seasonRepository = new SeasonRepository(dbContext); var jikanUrl = ConfigurationReader.JikanUrl;; var jikanConfiguration = new JikanClientConfiguration { Endpoint = jikanUrl, SuppressException = true }; var jikanClient = new Jikan(jikanConfiguration); var jikanService = new JikanService(jikanClient); return(new UpdateSeasonsHandler(seasonRepository, jikanService)); }
public void EditSeason_ExceptionCaught_LogsAndRethrowsException() { // Arrange var dbContext = A.Fake <ProFootballEntities>(); var repository = new SeasonRepository(dbContext); var season = new Season(); A.CallTo(() => dbContext.SetModified(A <Season> .Ignored)).Throws <Exception>(); // Act & Assert Assert.Throws <Exception>(() => repository.EditEntity(season)); }
public UnitOfWork(MediaCloudContext context) { _context = context; MovieLibraries = new MovieLibraryRepository(context); SeriesLibraries = new SeriesLibraryRepository(context); Libraries = new LibraryRepository(context); Items = new ItemRepository(context); Genres = new GenreRepository(context); Movies = new MovieRepository(context); Seasons = new SeasonRepository(context); Episodes = new EpisodeRepository(context); Media = new MediaRepository(context); }
public async Task AddAsync_GivenDuplicatedKeySeason_ShouldThrowException() { // Given var dbContext = InMemoryDbProvider.GetDbContext(); var repository = new SeasonRepository(dbContext); await repository.AddAsync(new SeasonBuilder().WithId(1).Build()); // When Func <Task> func = repository.Awaiting(x => x.AddAsync(new SeasonBuilder().WithId(1).Build())); // Then func.Should().Throw <Exception>(); }
public async Task AddAsync_GivenEmptySeason_ShouldAddAnime() { // Given var dbContext = InMemoryDbProvider.GetDbContext(); var repository = new SeasonRepository(dbContext); // When await repository.AddAsync(new SeasonBuilder().Build()); // Then var allSeasons = await dbContext.AnimeSeasons.ToListAsync(); allSeasons.Should().ContainSingle(); }
public void EditSeason_HappyPath() { // Arrange var dbContext = A.Fake <ProFootballEntities>(); var repository = new SeasonRepository(dbContext); var season = new Season(); // Act repository.EditEntity(season); // Assert A.CallTo(() => dbContext.SetModified(season)).MustHaveHappenedOnceExactly(); }
private static UpdateSeiyuuHandler CreateHandler(SeiyuuMoeContext dbContext) { var animeRepository = new AnimeRepository(dbContext); var seiyuuRepository = new SeiyuuRepository(dbContext); var characterRepository = new CharacterRepository(dbContext); var seiyuuRoleRepository = new SeiyuuRoleRepository(dbContext); var animeRoleRepository = new AnimeRoleRepository(dbContext); var seasonRepository = new SeasonRepository(dbContext); var jikanUrl = ConfigurationReader.JikanUrl; var jikanClient = new Jikan(jikanUrl, true); var jikanService = new JikanService(jikanClient); return(new UpdateSeiyuuHandler(seiyuuRepository, animeRepository, characterRepository, seiyuuRoleRepository, animeRoleRepository, seasonRepository, jikanService)); }
protected void InitializeVariables(CSBCDbContext context) { if (Session["CompanyID"] == null) Session["CompanyID"] = 1; if (Session["SeasonID"] == null) { var seasonrep = new SeasonRepository(context); var season = seasonrep.GetCurrentSeason(GetSessionCompany()); Session["SeasonID"] = season.SeasonID; //lblSeason.Text = season.Sea_Desc; } //test other variables }
public void CreateSeason_HappyPath() { // Arrange var dbContext = A.Fake <ProFootballEntities>(); var repository = new SeasonRepository(dbContext); A.CallTo(() => dbContext.Seasons.Create()).Returns(new Season()); // Act var result = repository.CreateEntity(); // Assert A.CallTo(() => dbContext.Seasons.Create()).MustHaveHappenedOnceExactly(); Assert.IsInstanceOf <Season>(result); }
public async Task GetSeasonsAsync() { // Arrange var repository = new SeasonRepository(); var dbContext = A.Fake <ProFootballEntities>(); dbContext.SetUpFakeSeasonsAsync(); // Act var result = await repository.GetEntitiesAsync(dbContext); // Assert Assert.IsInstanceOf <IEnumerable <Season> >(result); }
public void GetSeasons_ExceptionCaught_LogsAndRethrowsException() { // Arrange var dbContext = A.Fake <ProFootballEntities>(); var repository = new SeasonRepository(dbContext); A.CallTo(() => dbContext.Seasons).Throws <Exception>(); // Act IEnumerable <Season> result = null; Assert.Throws <Exception>(() => result = repository.GetEntities()); // Assert Assert.IsNull(result); }
//[TestCase] public void TestCase1() { // Arrange var dbContext = A.Fake <ProFootballEntities>(); var repository = new SeasonRepository(dbContext); // TODO: Define argument variables of method under test. // TODO: Set up needed infrastructure of class under test. // Act // TODO: Call method under test. // Assert // TODO: Assert results of call to method under test. }
public void CreateSeason_ExceptionCaught_LogsAndRethrowsException() { // Arrange var dbContext = A.Fake <ProFootballEntities>(); var repository = new SeasonRepository(dbContext); A.CallTo(() => dbContext.Seasons.Create()).Throws <Exception>(); // Act Season result = null; Assert.Throws <Exception>(() => result = repository.CreateEntity()); // Assert Assert.IsNull(result); }
public void AddSeasons_HappyPath() { // Arrange var dbContext = A.Fake <ProFootballEntities>(); var repository = new SeasonRepository(dbContext); var seasons = new List <Season>(); A.CallTo(() => dbContext.Seasons.AddRange(A <IEnumerable <Season> > .Ignored)).Returns(seasons); // Act var result = repository.AddEntities(seasons); // Assert A.CallTo(() => dbContext.Seasons.AddRange(seasons)).MustHaveHappenedOnceExactly(); Assert.AreSame(seasons, result); }
public async Task GetAsync_GivenSingleSeasons_ShouldReturn() { // Given var dbContext = InMemoryDbProvider.GetDbContext(); var repository = new SeasonRepository(dbContext); var season1 = new SeasonBuilder().WithName("Test1").Build(); await dbContext.AnimeSeasons.AddAsync(season1); await dbContext.SaveChangesAsync(); // When var result = await repository.GetAsync(x => true); // Then result.Name.Should().Be("Test1"); }
public void RemoveSeason_HappyPath() { // Arrange var dbContext = A.Fake <ProFootballEntities>(); var repository = new SeasonRepository(dbContext); var season = new Season(); A.CallTo(() => dbContext.Seasons.Remove(A <Season> .Ignored)).Returns(season); // Act var result = repository.RemoveEntity(season); // Assert A.CallTo(() => dbContext.Seasons.Remove(season)).MustHaveHappenedOnceExactly(); Assert.AreSame(season, result); }
public void AddSeasons_ExceptionCaught_LogsAndRethrowsException() { // Arrange var dbContext = A.Fake <ProFootballEntities>(); var repository = new SeasonRepository(dbContext); var seasons = new List <Season>(); A.CallTo(() => dbContext.Seasons.AddRange(A <IEnumerable <Season> > .Ignored)).Throws <Exception>(); // Act IEnumerable <Season> result = null; Assert.Throws <Exception>(() => result = repository.AddEntities(seasons)); // Assert Assert.IsNull(result); }
public void FindEntity_GenericExceptionCaught_LogsAndRethrowsException() { // Arrange var dbContext = A.Fake <ProFootballEntities>(); var repository = new SeasonRepository(dbContext); var id = 2017; A.CallTo(() => dbContext.Seasons.Find(A <int> .Ignored)).Throws <Exception>(); // Act Season result = null; Assert.Throws <Exception>(() => result = repository.FindEntity(id)); // Assert Assert.IsNull(result); }
public void FindEntity_InvalidOperationExceptionCaught_ThrowsObjectNotFoundException() { // Arrange var dbContext = A.Fake <ProFootballEntities>(); var repository = new SeasonRepository(dbContext); var id = 2017; A.CallTo(() => dbContext.Seasons.Find(A <int> .Ignored)).Throws <InvalidOperationException>(); // Act Season result = null; Assert.Throws <ObjectNotFoundException>(() => { result = repository.FindEntity(id); }); // Assert Assert.IsNull(result); }
public void GetDivisionTeamsTest2() { var divisions = new List<Division>(); using (var context = new CSBCDbContext()) { var repSeason = new SeasonRepository(context); var currentSeason = repSeason.GetCurrentSeason(1); var repDivision = new DivisionRepository(context); divisions = repDivision.GetDivisions(currentSeason.SeasonID).ToList<Division>(); } var division = divisions.FirstOrDefault(); var rep = new TeamVM(); var teams = rep.GetDivisionTeams(division.DivisionID); Assert.IsTrue(teams.Any()); var team = teams.FirstOrDefault(); Assert.IsTrue(team.DivisionID > 0); }
public async Task FindEntityAsync_EntityFoundInDataStore_ReturnsEntity() { // Arrange var repository = new SeasonRepository(); var dbContext = A.Fake <ProFootballEntities>(); var id = 2017; Season season = new Season(); A.CallTo(() => dbContext.Seasons.FindAsync(A <int> .Ignored)).Returns(season); // Act var result = await repository.FindEntityAsync(dbContext, id); // Assert A.CallTo(() => dbContext.Seasons.FindAsync(id)).MustHaveHappenedOnceExactly(); Assert.AreSame(season, result); }
private void LoadSeason() { var rep = new SeasonRepository(new CSBCDbContext()); var season = new Season(); //CSBC.Components.Season.ClsSeasons oSeason = new CSBC.Components.Season.ClsSeasons(); var master = new CSBCAdminMasterPage(); try { season = rep.GetCurrentSeason(master.GetSessionCompany()); //_with1.GetCurrentSeason(1); Session["SeasonDesc"] = season.Description; Session["CompanyID"] = season.CompanyID; Session["SeasonID"] = season.SeasonID; } catch (Exception ex) { //lblError.Text = "Invalid Username/Password" } }
private InsertSeiyuuHandler CreateHandler(SeiyuuMoeContext dbContext, JikanService jikanService, IS3Service s3Service, int insertSeiyuuBatchSize) { var animeRepository = new AnimeRepository(dbContext); var seiyuuRepository = new SeiyuuRepository(dbContext); var characterRepository = new CharacterRepository(dbContext); var animeRoleRepository = new AnimeRoleRepository(dbContext); var seasonRepository = new SeasonRepository(dbContext); return(new InsertSeiyuuHandler( insertSeiyuuBatchSize, 0, seiyuuRepository, seasonRepository, characterRepository, animeRepository, animeRoleRepository, jikanService, s3Service )); }
protected void btnSubmit_Click(object sender, EventArgs e) { var rep = new UserRepository(new CSBCDbContext()); User user = rep.GetUser(txtUserName.Text, txtPassword.Text); if ((user == null) || (user.UserID == 0)) { lblError.Text = "Invalid user / password"; lblError.Visible = true; } else { Session["UserID"] = user.UserID; Session["UserName"] = user.Name; Session["UserType"] = user.UserType; Session["CompanyID"] = rep.GetById(user.UserID).CompanyID; Session["TestMode"] = checkTestMode.Checked; var seasonrep = new SeasonRepository(new CSBCDbContext()); var season = seasonrep.GetCurrentSeason((int)Session["CompanyID"]); Session["SeasonID"] = season.SeasonID; Response.Redirect("welcome1.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var seasonRepository = new SeasonRepository(); var seasons = seasonRepository.GetAll(); SeasonList.DataSource = seasons; SeasonList.DataValueField = "Id"; SeasonList.DataTextField = "Name"; SeasonList.DataBind(); var currentSeason = seasonRepository.GetCurrent(); SeasonList.SelectedValue = currentSeason.Id.ToString(); var races = currentSeason.Races; RaceList.DataSource = races; RaceList.DataValueField = "Id"; RaceList.DataTextField = "Name"; RaceList.DataBind(); } }
public ActionResult Delete(int seasonId) { var seasonRepo = new SeasonRepository(); var result = new ApiResult(); try { var season = seasonRepo.GetAll().SingleOrDefault(sr => sr.SeasonId == seasonId); if (null != season) { season.IsActive = false; seasonRepo.Save(season); } result.Description = "Season successfully deleted!"; result.Success = true; } catch (Exception e) { result.Description = "Failed to delete season"; result.Success = false; } return this.ToJson(result); }
private decimal GetSeasonFee() { decimal functionReturnValue = 0; var oSeason = new SeasonRepository(new CSBCDbContext()); functionReturnValue = 0; try { var season = oSeason.GetById(Master.SeasonId); functionReturnValue = Convert.ToDecimal(season.ParticipationFee); } catch (Exception ex) { lblError.Text = "GetSeasonFee::" + ex.Message; } return functionReturnValue; }
protected void grdMembers_SelectedRowsChange(object sender, EventArgs e) { //PeopleId = grdMembers.DisplayLayout.ActiveRow.Cells.FromKey("PeopleID").Value; if (Master.PeopleId > 0) { var rep = new SeasonRepository(new CSBCDbContext()); var currentSeasonId = rep.GetCurrentSeason(Master.CompanyId).SeasonID; GetPlayerInfo(currentSeasonId, Master.PeopleId); LoadPersonDetails(Master.PeopleId); LoadComments(Master.PeopleId); } }
private void LoadFees() { var repSeasons = new SeasonRepository(new CSBCDbContext()); try { var seasonFees = repSeasons.GetSeasonFees((int)Session["SeasonID"]); cmbFees.DataSource = seasonFees; cmbFees.DataValueField = "Name"; cmbFees.DataTextField = "Amount"; cmbFees.DataBind(); //IQueryable<seasonFees> rsdata = seasonFees; //rsData = oSeasons.GetSeasonFees(Session["SeasonID"], Session["CompanyID"]); //if (rsData.Rows.Count == 0) // return; /*var _with11 = cmbFees; _with11.DataSource = rsData; _with11.DataValueField = "Fee"; _with11.DataTextField = "Fee"; _with11.DataBind(); _with11.SelectedIndex = 2; */ } catch (Exception ex) { lblError.Text = "LoadFees::" + ex.Message; } }
private void LoadPerson(int personId) { var context = new CSBCDbContext(); var rep = new PersonRepository(context); var person = rep.GetById(personId); Master.HouseId = person.HouseID; var repSeason = new SeasonRepository(context); var seasonId = repSeason.GetCurrentSeason(Master.CompanyId).SeasonID; GetPlayerInfo(seasonId, personId); if (Master.HouseId > 0) ReadHouse(); LoadPersonDetails(person, PlayerVM.LastSeason(personId)); PlayerHistory1.LoadPlayerHistory(personId); LoadComments(personId); }
private void GetSeason() { try { using (var db = new CSBCDbContext()) { var rep = new SeasonRepository(db); var currentSeason = rep.GetCurrentSeason(1); Session["SeasonDesc"] = currentSeason.Description; Session["SeasonID"] = currentSeason.SeasonID; } } catch (Exception ex) { //lblError.Text = "GetSeason:" + ex.Message; } }
protected void InitializeVariables(CSBCDbContext context) { if (Session["CompanyID"] == null) Session["CompanyID"] = Convert.ToInt32(ConfigurationManager.AppSettings["CompanyId"]); if (Session["SeasonID"] == null) { var seasonrep = new SeasonRepository(context); var season = seasonrep.GetCurrentSeason(GetSessionCompany()); Session["SeasonID"] = season.SeasonID; //lblSeason.Text = season.Sea_Desc; } //test other variables }
protected void LoadSeasons() { using (var context = new CSBCDbContext()) { var rep = new SeasonRepository(context); var seasons = rep.GetSeasons(CompanyId).OrderByDescending(s => s.FromDate).ToList(); ddlSeasons.DataValueField = "SeasonID"; ddlSeasons.DataTextField = "Description"; ddlSeasons.DataSource = seasons; ddlSeasons.DataBind(); } }
private void LoadRecord(int rowId) { var repSeason = new SeasonRepository(new CSBCDbContext()); var season = repSeason.GetById(rowId); try { //season.TimeZone = Session["TimeZone"] txtSeasonID.Value = rowId.ToString(); txtName.Text = season.Description; mskStartDate.Text = season.FromDate.Value.ToString("yyyy-MM-dd"); mskEndDate.Text = season.ToDate.Value.ToString("yyyy-MM-dd"); chkNewSchool.Checked = Convert.ToBoolean(season.NewSchoolYear); chkCurrentSeason.Checked = Convert.ToBoolean(season.CurrentSeason); chkRegistration.Checked = Convert.ToBoolean(season.CurrentSignUps); var curReg = Convert.ToBoolean(season.CurrentSignUps); //mskORStart.Enabled = curReg; //mskOREnd.Enabled = curReg; if (season.SignUpsDate != null) mskORStart.Text = season.SignUpsDate.Value.ToString("yyyy-MM-dd"); if (season.SignUpsEND != null) mskOREnd.Text = season.SignUpsEND.Value.ToString("yyyy-MM-dd"); chkSchedules.Checked = Convert.ToBoolean(season.CurrentSchedule); if (season.ParticipationFee != null) txtPlayersFee.Text = Convert.ToDecimal(string.Format("{0:F2}", season.ParticipationFee)).ToString(); if (season.SponsorFee != null) mskSponsorFee.Text = Convert.ToDecimal(string.Format("{0:F2}", season.SponsorFee)).ToString(); if (season.ConvenienceFee != null) mskSponsorFeeDiscounted.Text = Convert.ToDecimal(string.Format("{0:F2}", season.ConvenienceFee)).ToString(); } catch (Exception ex) { lblError.Text = "LoadRecord::" + ex.Message; } }
private void UpdRow(int rowId) { var repSeason = new SeasonRepository(new CSBCDbContext()); DateTime date; Season season; if (rowId != 0) season = repSeason.GetById(rowId); else { season = new Season(); } try { season.CompanyID = Master.CompanyId; season.SeasonID = rowId; season.Description = txtName.Text; if (DateTime.TryParse(mskStartDate.Text, out date)) season.FromDate = date; if (DateTime.TryParse(mskEndDate.Text, out date)) season.ToDate = date; season.NewSchoolYear = chkNewSchool.Checked; season.CurrentSeason = chkCurrentSeason.Checked; season.CurrentSignUps = chkRegistration.Checked; season.CurrentSchedule = chkSchedules.Checked; // Set dates if (DateTime.TryParse(mskORStart.Text, out date)) season.SignUpsDate = date; if (DateTime.TryParse(mskOREnd.Text, out date)) season.SignUpsEND = date; // Set fees decimal fee; season.ParticipationFee = Decimal.TryParse(txtPlayersFee.Text, out fee) ? fee : 0; season.SponsorFee = Decimal.TryParse(mskSponsorFee.Text, out fee) ? fee : 0; season.ConvenienceFee = Decimal.TryParse(mskSponsorFeeDiscounted.Text, out fee) ? fee : 0; season.CreatedUser = Session["UserName"].ToString(); if (rowId == 0) repSeason.Insert(season); else repSeason.Update(season); } catch (Exception e) { lblError.Text = "SaveRecord::" + e.Message; } }
public SeasonController() { this.seasonRepo = new SeasonRepository(); }
public void GetSeasonPlayersTest() { var context = new CSBC.Core.Data.CSBCDbContext(); var rep = new PlayerRepository(context); var repSeason = new SeasonRepository(context); var seasonId = repSeason.GetCurrentSeason(1).SeasonID; var players = rep.GetPlayers(seasonId); Assert.IsTrue(players.Count<SeasonPlayer>() > 0); }
public void GetSeasonsFromRepository() { var rep = new SeasonRepository(context); var seasons = rep.GetSeasons(1); Assert.IsTrue(seasons.Count<Season>() > 0); }
private List<Season> GetActiveSeasons() { var seasonRepo = new SeasonRepository(); return seasonRepo.GetAllSeasons(); }
public List<SelectSeasonVM> GetRecords(int companyId) { var rep = new SeasonRepository(new Core.Data.CSBCDbContext()); IQueryable<Season> seasons = rep.GetSeasons(companyId); var seasonsVm = new List<SelectSeasonVM>(); foreach (Season season in seasons) { var vm = new SelectSeasonVM(); vm.SeasonID = season.SeasonID; vm.Description = season.Description; vm.FromDate = (DateTime)season.FromDate; vm.ToDate = (DateTime)season.ToDate; vm.CurrentSeason = season.CurrentSeason == null ? false : (bool)season.CurrentSeason; vm.CurrentSchedule = season.CurrentSchedule == null ? false : (bool) season.CurrentSchedule; vm.CurrentSignUps = season.CurrentSignUps == null ? false : (bool)season.CurrentSignUps; seasonsVm.Add(vm); } return seasonsVm.OrderByDescending(s => s.FromDate).ToList(); }