Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RedirectUtil.RedirectUnauthenticatedUserToLoginPage();

            BreadCrumbUtil.DataBind(Page, new List <BreadCrumb>()
            {
                new BreadCrumb(NavUtil.GetHomePageUrl(), "Home"),
                new BreadCrumb(NavUtil.GetShowsPageUrl(), "Shows"),
                new BreadCrumb(NavUtil.GetShowPageUrl(GetShowId()), "Show"),
                new BreadCrumb(NavUtil.GetContestPageUrl(GetShowId(), GetContestId()), "Contest"),
                new BreadCrumb(NavUtil.GetContestantPageUrl(GetShowId(), GetContestId(), GetContestantId()), "Contestant", IsActive: true),
            });

            var contestantId = GetContestantId();

            this.contestant = ServiceFactory.ContestantService.Get(contestantId);
            this.contest    = ServiceFactory.ContestService.Get(GetContestId());
            this.scoreCards = ServiceFactory.ScoreCardService.GetContestantScoreCards(contestantId);
            var performers = ServiceFactory.PerformerService.GetContestantPerformers(contestantId);

            labelPageTitle.Text       = GetContestantHeadingText(performers);
            labelPageDescription.Text = GetContestantDescriptionText(contestant);

            if (!IsUserAnAdmin())
            {
                return;
            }

            var performerItems = new List <HyperlinkListPanelItem>();

            foreach (var performer in performers)
            {
                var url     = NavUtil.GetUpdatePerformerPageUrl(GetShowId(), GetContestId(), GetContestantId(), performer.Id);
                var heading = GetPerformerHeadingText(performer);
                var text    = GetPerformerDescriptionText(performer);

                performerItems.Add(new HyperlinkListPanelItem(url, heading, text));
            }

            HyperlinkListPanelRenderer.Render(performersList, new HyperlinkListPanelConfig("Performers", performerItems, ButtonAddPerformerClick));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            RedirectUtil.RedirectUnauthenticatedUserToLoginPage();
            RedirectUtil.RedirectNonAdminUserToHomePage();

            BreadCrumbUtil.DataBind(Page, new List <BreadCrumb>()
            {
                new BreadCrumb(NavUtil.GetHomePageUrl(), "Home"),
                new BreadCrumb(NavUtil.GetShowsPageUrl(), "Shows"),
                new BreadCrumb(NavUtil.GetShowPageUrl(GetShowId()), "Show"),
                new BreadCrumb(NavUtil.GetContestPageUrl(GetShowId(), GetContestId()), "Contest"),
                new BreadCrumb(NavUtil.GetContestantPageUrl(GetShowId(), GetContestId(), GetContestantId()), "Contestant"),
                new BreadCrumb(NavUtil.GetUpdateContestantPageUrl(GetShowId(), GetContestId(), GetContestantId()), "Update Contestant", IsActive: true),
            });

            labelPageTitle.Text       = "Update the Contestant";
            labelPageDescription.Text = "Use the form below to update the contestant.";

            contestantForm.GetSubmitButton().Click += new EventHandler(btnUpdateContestant_Click);
            contestantForm.GetCancelButton().Click += new EventHandler(btnCancel_Click);
        }
 protected string GetContestantURL(int contestantId, TalentShow.Contest contest)
 {
     return(NavUtil.GetContestantPageUrl(GetShowId(), contest.Id, contestantId));
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            RedirectUtil.RedirectUnauthenticatedUserToLoginPage();

            BreadCrumbUtil.DataBind(Page, new List <BreadCrumb>()
            {
                new BreadCrumb(NavUtil.GetHomePageUrl(), "Home"),
                new BreadCrumb(NavUtil.GetShowsPageUrl(), "Shows"),
                new BreadCrumb(NavUtil.GetShowPageUrl(GetShowId()), "Show"),
                new BreadCrumb(NavUtil.GetContestPageUrl(GetShowId(), GetContestId()), "Contest", IsActive: true),
            });

            var showId = GetShowId();
            var show   = ServiceFactory.ShowService.Get(showId);

            var contestId = GetContestId();

            this.contest = ServiceFactory.ContestService.Get(contestId);

            labelPageTitle.Text       = contest.Name + " (" + contest.Status + ")";
            labelPageDescription.Text = contest.Description;

            if (IsAllowedToViewContestantsList())
            {
                var contestantItems = new List <HyperlinkListPanelItem>();

                foreach (var contestant in contest.Contestants)
                {
                    var url     = NavUtil.GetContestantPageUrl(showId, contestId, contestant.Id);
                    var heading = GetContestantHeadingText(contestant);
                    var text    = GetContestantDescriptionText(contestant);

                    contestantItems.Add(new HyperlinkListPanelItem(url, heading, text));
                }

                HyperlinkListPanelRenderer.Render(contestantsList, new HyperlinkListPanelConfig("Contestants", contestantItems, ButtonAddContestantClick));
            }

            if (!IsUserAnAdmin())
            {
                return;
            }

            var judgeItems = new List <HyperlinkListPanelItem>();

            foreach (var judge in contest.Judges)
            {
                var url     = NavUtil.GetUpdateJudgePageUrl(showId, contestId, judge.Id);
                var heading = GetJudgeHeadingText(judge);
                var text    = GetJudgeDescriptionText(judge);

                judgeItems.Add(new HyperlinkListPanelItem(url, heading, text));
            }

            HyperlinkListPanelRenderer.Render(judgesList, new HyperlinkListPanelConfig("Judges", judgeItems, ButtonAddJudgeClick));

            var scoreCriterionItems = new List <HyperlinkListPanelItem>();

            foreach (var scoreCriterion in contest.ScoreCriteria)
            {
                var url     = NavUtil.GetUpdateScoreCriterionPageUrl(showId, contestId, scoreCriterion.Id);
                var heading = GetScoreCriterionHeadingText(scoreCriterion);
                var text    = GetScoreCriterionDescriptionText(scoreCriterion);

                scoreCriterionItems.Add(new HyperlinkListPanelItem(url, heading, text));
            }

            HyperlinkListPanelRenderer.Render(scoreCriteriaList, new HyperlinkListPanelConfig("Score Criteria", scoreCriterionItems, ButtonAddScoreCriterionClick));
        }