Esempio n. 1
0
    public string ComputeScore(string value, int id)
    {
        Score  score = ScoreService.GetScore(id);
        double total = 0;

        total = score.Portfolio.TotalScore;
        if (null != score && null != value)
        {
            try
            {
                double val = Convert.ToDouble(value);
                if (val <= score.Category.MaxRange && val >= score.Category.MinRange)
                {
                    score.Value = val;
                    ScoreService.Save(score);
                }
                total = ScoreService.ComputeScore(score.Judge, score.Portfolio);
            }
            catch (Exception e)
            {
                log.Debug(e.Message);
            }
        }
        return(total.ToString("F"));
    }
Esempio n. 2
0
    private void BindScores(JudgeStatus js)
    {
        ScoreType type = ScoreService.GetScoreType(js.Portfolio.Status);
        var       list = from s in js.Portfolio.Scores
                         where s.Type == type && s.Judge.Id == Judge.Id
                         select s;

        totalScore          = ScoreService.ComputeScore(Judge, js.Portfolio);
        gvScores.DataSource = list;
        gvScores.DataBind();
    }
Esempio n. 3
0
    protected void gvNominees_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
        {
            for (int i = 0; i < e.Row.Cells.Count; i++)
            {
                DataControlFieldHeaderCell obj = (DataControlFieldHeaderCell)e.Row.Cells[i];
                if (!String.IsNullOrEmpty(this.SortColumn) && obj.ContainingField.SortExpression == this.SortColumn)
                {
                    GridHelper.AddSortImage(obj, SortDirection);
                }
            }
        }
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            JudgeStatus js = e.Row.DataItem as JudgeStatus;
            if (null != js)
            {
                Label     labStatus     = e.Row.FindControl("labStatus") as Label;
                Label     labScore      = e.Row.FindControl("labScore") as Label;
                Label     labTotalScore = e.Row.FindControl("labTotalScore") as Label;
                Label     labRanking    = e.Row.FindControl("labRanking") as Label;
                HyperLink btnScores     = e.Row.FindControl("btnScores") as HyperLink;
                labStatus.Text     = js.Phase.ToDescription();
                labScore.Text      = js.Score.ToString("F");
                labTotalScore.Text = js.Portfolio.TotalScore.ToString("F");
                labRanking.Text    = js.Portfolio.Ranking.ToString();
                if (js.Score == 0)
                {
                    labScore.ForeColor = System.Drawing.Color.Red;
                }
                else
                {
                    //labStatus.Text = js.Application.Status.ToDescription();
                    labScore.Text = ScoreService.ComputeScore(Judge, js.Portfolio).ToString("F");
                }

                //labScore.Attributes.Add("onmouseover", "tooltip.show('" + GetOtherScores(js.Application) + "');");
                //labScore.Attributes.Add("onmouseout", "tooltip.hide();");

                btnScores.Visible = !js.Submitted;
            }
        }
    }