Пример #1
0
 /// <summary>
 /// 获取所有评分项(包括评分项组)
 /// </summary>
 /// <param name="listScoreItem"></param>
 public virtual void GetAllScoreItem(ref List <ScoreItem> listScoreItem)
 {
     for (int i = 0; i < Items.Count; i++)
     {
         listScoreItem.Add(Items[i]);
         ScoreGroup group = Items[i] as ScoreGroup;
         if (group != null)
         {
             group.GetAllScoreItem(ref listScoreItem);
         }
     }
 }
Пример #2
0
        /// <summary>
        /// 重新设置子项的深度
        /// </summary>
        public virtual void SetItemLevel()
        {
            int level = Level;

            for (int i = 0; i < Items.Count; i++)
            {
                ScoreItem item = Items[i];
                item.Level = level + 1;
                ScoreGroup group = item as ScoreGroup;
                if (group != null)
                {
                    group.SetItemLevel();
                }
            }
        }
Пример #3
0
 /// <summary>
 /// 获取所有子评分标准
 /// </summary>
 /// <param name="listStandard"></param>
 public virtual void GetAllStandards(ref List <Standard> listStandard)
 {
     for (int i = 0; i < Items.Count; i++)
     {
         ScoreGroup scoreGroup = Items[i] as ScoreGroup;
         if (scoreGroup != null)
         {
             scoreGroup.GetAllStandards(ref listStandard);
         }
         Standard standard = Items[i] as Standard;
         if (standard != null)
         {
             listStandard.Add(standard);
         }
     }
 }
Пример #4
0
        /// <summary>
        /// 计算分数
        /// </summary>
        /// <returns></returns>
        public override double CaculateScore()
        {
            //如果得分被控制项控制了,就不用计算此项的得分了
            if (IsScoreControled)
            {
                return(RealScore);
            }
            //如果该项不计入总分,返回0
            if (IsAbortScore)
            {
                return(0.0);
            }
            double     doubleValue    = 0.0;
            bool       usePonitSystem = false;
            ScoreSheet scoreSheet     = ScoreSheet;

            if (scoreSheet != null && scoreSheet.UsePointSystem)
            {
                usePonitSystem = true;
            }
            //将NA项的分数累加记下
            double naScore = 0.0;

            for (int i = 0; i < Items.Count; i++)
            {
                ScoreItem scoreItem = Items[i];
                if (scoreItem.IsAllowNA && scoreItem.IsNA)
                {
                    naScore += scoreItem.TotalScore;
                }
            }
            //t     本项总分
            //a     子项得分
            //b     NA项多出的分值(即naScore)
            //子项实际得分的计算公式: x = (a * t) / (t - b)
            for (int i = 0; i < Items.Count; i++)
            {
                ScoreItem  scoreItem  = Items[i];
                double     t          = TotalScore;
                double     b          = naScore;
                double     a          = 0.0;
                ScoreGroup scoreGroup = scoreItem as ScoreGroup;
                if (scoreGroup != null)
                {
                    a = scoreGroup.CaculateScore();
                }
                else
                {
                    Standard standard = Items[i] as Standard;
                    if (standard != null && !standard.IsNA)
                    {
                        //如果此标准被控制项控制了,就不用计算得分,直接返回得分
                        if (standard.IsScoreControled)
                        {
                            a = standard.RealScore;
                        }
                        else
                        {
                            if (standard.IsAbortScore)
                            {
                                a = 0.0;
                            }
                            else
                            {
                                if (usePonitSystem)
                                {
                                    a = (standard.Score / standard.PointSystem) * standard.TotalScore;
                                }
                                else
                                {
                                    a = standard.Score;
                                }
                            }
                        }
                    }
                }
                //注意t-b不能为0,否则除数为0就出错了
                if (t == b)
                {
                    doubleValue = 0.0;
                }
                else
                {
                    doubleValue += (a * t) / (t - b);
                }
            }
            Score     = doubleValue;
            RealScore = Score;
            return(doubleValue);
        }