コード例 #1
0
ファイル: GradingSet.cs プロジェクト: icprog/FS-SMISCloud
        public static void Add(Sensor sensor, SensorAnalyzeResult sensorAnalyzeResult)
        {
            var item = new GradingItem
            {
                SensorId = (int)sensor.SensorID,
                StructId = (int)sensor.StructId,
                FactorId = (int)sensor.FactorType,
                Score    = sensorAnalyzeResult.Score
            };

            StructGradingPlanSet.UpdatePlan(item);
        }
コード例 #2
0
        /// <summary>
        /// 强制计算结构物评分
        /// </summary>
        public void EnforceGrading()
        {
            foreach (var unGraded in this.ThemeScores.Where(f => !f.Completed))
            {
                unGraded.EnforceGrading();
            }

            var stcScore = 100;

            foreach (var themeScore in this.ThemeScores)
            {
                if (themeScore.Completed)
                {
                    stcScore -= (int)((100 - themeScore.Score) * (themeScore.Weight / 100.0));
                }
            }

            DbAccessor.SaveStructureScore(this.OrgStcId, stcScore, DateTime.Now);

            StructGradingPlanSet.CompletePlan(this);
        }
コード例 #3
0
        /// <summary>
        /// 添加评分项
        /// </summary>
        /// <param name="item">评分项</param>
        public void AddGradingItem(GradingItem item)
        {
            var factorId   = Convert.ToInt32(DbAccessor.GetSensorInfo(item.SensorId).Rows[0]["FactorId"]);
            var themeId    = Convert.ToInt32(DbAccessor.GetSafetyFactorInfo(factorId).Rows[0]["ParentId"]);
            var themeScore = this.ThemeScores.FirstOrDefault(f => f.ThemeId == themeId);

            if (themeScore != null)
            {
                themeScore.UpdateSensorScores(item);
            }

            if (this.ThemeScores.All(f => f.Completed))
            {
                var stcScore = 100;
                foreach (var score in ThemeScores)
                {
                    stcScore -= (int)((100 - score.Score) * (score.Weight / 100.0));
                }

                DbAccessor.SaveStructureScore(this.OrgStcId, stcScore, DateTime.Now);

                StructGradingPlanSet.CompletePlan(this);
            }
        }