Exemplo n.º 1
0
 public void LoadDivisionTest()
 {
     context = new CSBCDbContext();
     var repDivision = new DivisionRepository(context);
     var divisions = repDivision.LoadDivisions(2);
     Assert.IsTrue(divisions.Count<vw_Divisions>() != 0);
 }
Exemplo n.º 2
0
 private void LoadDivisions(int division, int companyId, int seasonId)
 {
     var divisions = new DivisionRepository(new CSBCDbContext());
     try
     {
         var rsData = divisions.LoadDivisions(seasonId);
         var count = rsData.Count<vw_Divisions>();
         cmbDivisions.DataSource = rsData;
         cmbDivisions.DataValueField = "DivisionID";
         cmbDivisions.DataTextField = "Div_Desc";
         cmbDivisions.DataBind();
     }
     catch (Exception ex)
     {
         lblError.Text = "LoadDivisions::" + ex.Message;
     }
     finally
     {
         //if (Session["DivisionID"] != null)
         //    cmbDivisions.SelectedValue = Session["DivisionID"].ToString();
     }
 }
Exemplo n.º 3
0
        public ActionResult Index()
        {
            _divisionRepository.LoadDivisions();
            _countryRepository.LoadCountries();
            _userRepository.LoadAdmins();
            var    LeaderBoard   = _userRepository.GetLeaderBoard().ToList();
            string SearchString  = null;
            int?   SearchCountry = null;

            if (Request["SearchByNameTextBox"] != null)
            {
                SearchString = Request["SearchByNameTextBox"].ToString();
            }

            if (Request["CountryID"] != null)
            {
                bool result = Int32.TryParse(Request["CountryID"], out int number);
                if (result)
                {
                    SearchCountry = Convert.ToInt32(Request["CountryID"]);
                }
            }

            //Search by Name & Username & Country
            if (Request["SearchByNameTextBox"] != null && Request["SearchByNameCheckBox"] == "check" && Request["SearchByCountryCheckBox"] == "check")
            {
                var searchResult = _userRepository.GetLeaderBoardByNameAndCountry(LeaderBoard, SearchString, SearchCountry);
                ViewBag.CountryID = new SelectList(db.Countries, "CountryID", "Name").OrderBy(c => c.Text);
                if (searchResult.Count() == 0)
                {
                    TempData["UserListResult"] = "No results that match your search criteria where found";
                }
                return(View(searchResult));
            }

            //Search by Name & Username
            if (Request["SearchByNameTextBox"] != null && Request["SearchByNameCheckBox"] == "check")
            {
                var searchResult = _userRepository.GetLeaderBoardByName(LeaderBoard, SearchString);
                ViewBag.CountryID = new SelectList(db.Countries, "CountryID", "Name").OrderBy(c => c.Text);
                if (searchResult.Count() == 0)
                {
                    TempData["UserListResult"] = "No results that match your search criteria where found";
                }
                return(View(searchResult));
            }

            //Search by Country
            if (Request["SearchByCountryCheckBox"] == "check")
            {
                var searchResult = _userRepository.GetLeaderBoardByCountry(LeaderBoard, SearchCountry);
                ViewBag.CountryID = new SelectList(db.Countries, "CountryID", "Name").OrderBy(c => c.Text);
                if (searchResult.Count() == 0)
                {
                    TempData["UserListResult"] = "No results that match your search criteria where found";
                }
                return(View(searchResult));
            }

            //Get all users for Leaderboard
            LeaderBoard       = _userRepository.GetLeaderBoard().ToList();
            ViewBag.CountryID = new SelectList(db.Countries, "CountryID", "Name").OrderBy(c => c.Text);
            return(View(LeaderBoard));
        }