Пример #1
0
 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);
 }
Пример #2
0
        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);
        }
Пример #3
0
 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>());
 }
Пример #4
0
        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);
        }
Пример #5
0
        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
        }
Пример #6
0
        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);
        }
Пример #7
0
        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");
            }
        }
Пример #8
0
        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);
        }
Пример #9
0
        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;
            }
        }
Пример #10
0
 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"
     }
 }
Пример #11
0
        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
        }
Пример #12
0
        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);
        }
Пример #13
0
 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);
     }
 }