예제 #1
0
 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();
     }
 }
예제 #2
0
파일: SelectSeason.cs 프로젝트: rsalit/CSBC
 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();
 }
예제 #3
0
파일: SeasonsTest.cs 프로젝트: rsalit/CSBC
 public void GetSeasonsFromRepository()
 {
     var rep = new SeasonRepository(context);
        var seasons = rep.GetSeasons(1);
     Assert.IsTrue(seasons.Count<Season>() > 0);
 }