예제 #1
0
    /// <summary>
    /// Delete Judge
    /// </summary>
    /// <param name="source"></param>
    /// <param name="e"></param>
    protected void RadGrid1_DeleteCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        string ID = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ChallengeJudgeId"].ToString();

        challengeJudgeComponent = new ChallengeJudgeComponent(new Guid(ID));

        JudgesAssignationComponent.deleteListPerChallengeJudgeId(challengeJudgeComponent.ChallengeJudge.ChallengeJudgeId);
        challengeJudgeComponent.Delete();

        this.grdManageJudge.MasterTableView.Rebind();
    }
예제 #2
0
 /// <summary>
 /// Delete and assign solutions to jury
 /// </summary>
 /// <param name="challengeJudgeId"></param>
 /// <param name="checkBoxList"></param>
 /// <returns></returns>
 private bool SaveChkControl(Guid challengeJudgeId, CheckBoxList checkBoxList)
 {
     if (JudgesAssignationComponent.deleteListPerChallengeJudgeId(challengeJudgeId))
     {
         string result = string.Empty;
         foreach (ListItem item in checkBoxList.Items)
         {
             if (item.Selected)
             {
                 JudgesAssignationComponent judgesAssignationComponent = new JudgesAssignationComponent();
                 judgesAssignationComponent.JudgesAssignation.ChallengeJudgeId   = challengeJudgeId;
                 judgesAssignationComponent.JudgesAssignation.SolutionId         = new Guid(item.Value);
                 judgesAssignationComponent.JudgesAssignation.JudgeAssigantionId = Guid.NewGuid();
                 judgesAssignationComponent.Save();
             }
         }
         return(true);
     }
     return(false);
 }
예제 #3
0
    /// <summary>
    /// Get the score of solutions. The score may be database or XML (additional questions).
    /// </summary>
    /// <param name="solutionId"></param>
    /// <param name="challengeReference"></param>
    /// <param name="sw"></param>
    /// <returns></returns>
    protected string GetScoreJudge(Guid solutionId, string challengeReference, bool sw)
    {
        SolutionComponent solution = new SolutionComponent(solutionId);
        var scoresSolution         = solution.Solution.Scores.Where(a => a.ScoreType != "CUSTOM_XML" && a.Active == true).OrderBy(x => x.UserProperty.FirstName);

        if (challengeReferences.Contains(challengeReference))
        {
            //XML score
            scoresSolution = solution.Solution.Scores.Where(a => a.ScoreType == "CUSTOM_XML" && a.Active == true && (challengeReferences.Contains(a.ChallengeReference))).OrderBy(x => x.UserProperty.FirstName);
        }
        UserPropertyComponent userPropertyComponent;
        string        text    = string.Empty;
        StringBuilder return_ = new StringBuilder();

        ScoreComponent.ScoreJudge scoreJudge;
        List <Int32> listUserID = new List <Int32>();

        foreach (var score in scoresSolution)
        {
            if (score.UserId == UserId || sw)
            {
                if (challengeReference == score.ChallengeReference || challengeReference == string.Empty)
                {
                    ScoreComponent scoreComponent = new ScoreComponent(solutionId, score.UserId, "CUSTOM_XML", score.ChallengeReference);
                    var            user           = UserController.GetUserById(PortalId, score.UserId);
                    if (scoreComponent.Score.ScoreId != Guid.Empty)
                    {
                        if (challengeReference == string.Empty)
                        {
                            scoreJudge = new ScoreComponent.ScoreJudge(solutionId, score.UserId);
                        }
                        else
                        {
                            scoreJudge = new ScoreComponent.ScoreJudge(solutionId, score.UserId, challengeReference);
                        }
                        double value = Math.Round(((scoreJudge.AbsoluteScore * 0.6) + (Convert.ToDouble(scoreComponent.Score.ComputedValue) * 0.4)), 1);
                        if (challengeReferences.Contains(solution.Solution.ChallengeReference))
                        {
                            value = Math.Round((Convert.ToDouble(scoreComponent.Score.ComputedValue)), 1);
                        }
                        if (user != null)
                        {
                            text += user.DisplayName + " (" + value.ToString() + "), ";
                        }
                        else
                        {
                            text += "Anonymous" + " (" + value.ToString() + "), ";
                        }
                    }
                    else
                    {
                        if (challengeReference == string.Empty)
                        {
                            scoreJudge = new ScoreComponent.ScoreJudge(solutionId, score.UserId);
                        }
                        else
                        {
                            scoreJudge = new ScoreComponent.ScoreJudge(solutionId, score.UserId, challengeReference);
                        }

                        if (user != null)
                        {
                            text += user.DisplayName + " (" + scoreJudge.AbsoluteScore + "), ";
                        }
                        else
                        {
                            text += "Anonymous" + " (" + scoreJudge.AbsoluteScore + "), ";
                        }
                    }
                    if (user != null)
                    {
                        listUserID.Add(user.UserID);
                    }
                }
            }
        }
        if (sw)
        {
            var listJudgesAssignation = JudgesAssignationComponent.GetJudgesPerSolution(solution.Solution.SolutionId, challengeReference).OrderBy(x => x.ChallengeJudge.UserProperty.FirstName).ToList();
            if (listJudgesAssignation.Count() > 0)
            {
                foreach (var item in listJudgesAssignation)
                {
                    var existUser = listUserID.Exists(x => x == item.ChallengeJudge.UserId);
                    if (!existUser)
                    {
                        var user = UserController.GetUserById(PortalId, item.ChallengeJudge.UserId);
                        if (user != null)
                        {
                            text += user.DisplayName + " ( - ), ";
                        }
                    }
                }
            }
        }
        if (string.IsNullOrEmpty(text))
        {
            text = "Not Scored";
        }
        return(text);
    }