Ejemplo n.º 1
0
        public ActionResult ManageTeamApplications(Guid SelectedTournamentId)
        {
            ManageTeamApplicationsView teamApplications = null;

            try
            {
                teamApplications = new ManageTeamApplicationsView();
                TournamentAccessRepository rep             = new TournamentAccessRepository();
                ThirdPartyAccessRepository third_party_rep = new ThirdPartyAccessRepository();
                List <Tournament>          tournaments     = third_party_rep.GetRegistrationAvailableTournaments();
                teamApplications.TournamentDropList = new List <SelectListItem>();
                foreach (Tournament tourn in tournaments)
                {
                    teamApplications.TournamentDropList.Add(new SelectListItem {
                        Text = tourn.TournamentName, Value = tourn.TournamentID.ToString()
                    });
                }
                teamApplications.TeamApplications = rep.GetAllTeamApplicationsByTournamentID(SelectedTournamentId);
                if (teamApplications.TeamApplications == null)
                {
                    ViewData["Message"] = "There was an error processing your request. Please contact your administrator.";
                }
            }
            catch (Exception e)
            {
                ViewData["Message"] = "There was an error processing your request. Please contact your administrator.";
            }

            return(View("ManageTeamApplications", teamApplications));
        }
Ejemplo n.º 2
0
        public ActionResult ManageTeamApplications(ManageTeamApplicationsView teamApplications, string id, string message)
        {
            try
            {
                ThirdPartyAccessRepository rep = new ThirdPartyAccessRepository();
                teamApplications = new ManageTeamApplicationsView();
                List <Tournament> tournaments = rep.GetRegistrationAvailableTournaments();
                teamApplications.TournamentDropList = new List <SelectListItem>();
                foreach (Tournament tourn in tournaments)
                {
                    teamApplications.TournamentDropList.Add(new SelectListItem {
                        Text = tourn.TournamentName, Value = tourn.TournamentID.ToString()
                    });
                }
                if (id != null)
                {
                    if (message != null)
                    {
                        ViewData["Message"] = message;
                    }
                    TournamentAccessRepository tournament_rep = new TournamentAccessRepository();
                    teamApplications.TeamApplications = tournament_rep.GetAllTeamApplicationsByTournamentID(Guid.Parse(id));
                }
                return(View("ManageTeamApplications", teamApplications));
            }
            catch (Exception e)
            {
                ViewData["Message"] = "There was an error processing your request. Please contact your administrator.";
            }

            return(null);
        }
Ejemplo n.º 3
0
        public ActionResult TeamApproveOrDeny(FormCollection Form)
        {
            ManageTeamApplicationsView teamApplications = null;

            try
            {
                Guid   teamApplicationID = Guid.Parse(Form.Get(Request.Form.Keys[0]));
                Guid   tournamentID      = Guid.Parse(Form.Get(Request.Form.Keys[1]));
                string teamMessage       = Form.Get(Request.Form.Keys[2]).ToString();
                string decision          = Form.Get(Request.Form.Keys[3]).ToString();
                int    status            = 0;
                if (decision == "Approve")
                {
                    status = 2;
                }
                else if (decision == "Deny")
                {
                    status = 3;
                }
                TournamentAccessRepository rep = new TournamentAccessRepository();
                bool isUpated = rep.UpdateTeamApplication(teamApplicationID, status, teamMessage);
                if (isUpated)
                {
                    ViewData["Message"] = "The team application updated successfully";
                }
                else
                {
                    ViewData["Message"] = "There was an error processing your request. Please contact your administrator.";
                }

                teamApplications = new ManageTeamApplicationsView();
                ThirdPartyAccessRepository third_party_rep = new ThirdPartyAccessRepository();
                List <Tournament>          tournaments     = third_party_rep.GetRegistrationAvailableTournaments();
                teamApplications.TournamentDropList = new List <SelectListItem>();
                foreach (Tournament tourn in tournaments)
                {
                    teamApplications.TournamentDropList.Add(new SelectListItem {
                        Text = tourn.TournamentName, Value = tourn.TournamentID.ToString()
                    });
                }
                teamApplications.TeamApplications = rep.GetAllTeamApplicationsByTournamentID(tournamentID);
                return(RedirectToAction("ManageTeamApplications", new { id = tournamentID, message = ViewData["Message"] }));//, message = "The team application updated successfully!" });
            }

            catch (Exception e)
            {
                ViewData["Message"] = "There was an error processing your request. Please contact your administrator.";
            }

            return(Redirect(Url.Content("~/Tournament/ManageTeamApplications/")));
        }