Ejemplo n.º 1
0
    /// <summary>
    /// Initializes the target object for the page
    /// </summary>
    /// <remarks>Many pages have "target" objects that the page operates on. For instance, when viewing
    /// an event, the target object is an event. When looking up a directory, that's the target
    /// object. This method is intended to be overriden to initialize the target object for
    /// each page that needs it.</remarks>
    protected override void InitializeTargetObject()
    {
        base.InitializeTargetObject();

        targetJudgingTeam = LoadObjectFromAPI <msJudgingTeam>(ContextID);

        if (targetJudgingTeam == null)
        {
            GoToMissingRecordPage();
            return;
        }

        targetCompetition = LoadObjectFromAPI <msCompetition>(targetJudgingTeam.Competition);

        if (Request.QueryString["roundID"] != null)
        {
            targetRound = LoadObjectFromAPI <msJudgingRound>(Request.QueryString["roundID"]);
        }

        if (targetCompetition == null)
        {
            GoToMissingRecordPage();
            return;
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Initializes the target object for the page
    /// </summary>
    /// <remarks>Many pages have "target" objects that the page operates on. For instance, when viewing
    /// an event, the target object is an event. When looking up a directory, that's the target
    /// object. This method is intended to be overriden to initialize the target object for
    /// each page that needs it.</remarks>
    protected override void InitializeTargetObject()
    {
        base.InitializeTargetObject();

        targetCompetitionEntry = LoadObjectFromAPI <msCompetitionEntry>(ContextID);
        targetJudgingRound     = LoadObjectFromAPI <msJudgingRound>(JudgingRoundId);

        if (targetCompetitionEntry == null)
        {
            GoToMissingRecordPage();
            return;
        }

        targetCompetition = LoadObjectFromAPI <msCompetition>(targetCompetitionEntry.Competition);
        if (targetCompetition == null)
        {
            GoToMissingRecordPage();
            return;
        }

        targetEntrant = LoadObjectFromAPI <msIndividual>(targetCompetitionEntry.Entrant);

        if (targetEntrant == null)
        {
            GoToMissingRecordPage();
            return;
        }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Initializes the target object for the page
    /// </summary>
    /// <remarks>Many pages have "target" objects that the page operates on. For instance, when viewing
    /// an event, the target object is an event. When looking up a directory, that's the target
    /// object. This method is intended to be overriden to initialize the target object for
    /// each page that needs it.</remarks>
    protected override void InitializeTargetObject()
    {
        base.InitializeTargetObject();

        targetCompetitionEntry = LoadObjectFromAPI <msCompetitionEntry>(ContextID);
        targetJudgingRound     = LoadObjectFromAPI <msJudgingRound>(JudgingRoundId);

        if (targetCompetitionEntry == null || targetJudgingRound == null)
        {
            GoToMissingRecordPage();
            return;
        }

        targetCompetition = LoadObjectFromAPI <msCompetition>(targetCompetitionEntry.Competition);
        if (targetCompetition == null)
        {
            GoToMissingRecordPage();
            return;
        }

        targetEntrant = LoadObjectFromAPI <msIndividual>(targetCompetitionEntry.Entrant);
        if (targetEntrant == null)
        {
            GoToMissingRecordPage();
            return;
        }

        //Search for an existing score card for this judge/competition entry/round and if not found create a new one
        Search sScoreCard = new Search {
            Type = msScoreCard.CLASS_NAME, Context = targetCompetitionEntry.ID
        };

        sScoreCard.AddOutputColumn("ID");
        sScoreCard.AddCriteria(Expr.Equals("Judge", ConciergeAPI.CurrentEntity.ID));
        sScoreCard.AddCriteria(Expr.Equals("Entry", targetCompetitionEntry.ID));
        sScoreCard.AddCriteria(Expr.Equals("Round", targetJudgingRound.ID));

        SearchResult srScoreCard = APIExtensions.GetSearchResult(sScoreCard, 0, 1);

        targetScoreCard = srScoreCard.Table != null && srScoreCard.Table.Rows.Count > 0
                              ? LoadObjectFromAPI <msScoreCard>(srScoreCard.Table.Rows[0]["ID"].ToString())
                              : new msScoreCard
        {
            Entry  = targetCompetitionEntry.ID,
            Judge  = ConciergeAPI.CurrentEntity.ID,
            Round  = targetJudgingRound.ID,
            Scores = new List <msScoreCardScore>(),
            Name   =
                string.Format("{0} Scores for {1} {2} Round", targetCompetition.Name,
                              targetEntrant.Name, targetJudgingRound.Name)
        };
    }