コード例 #1
0
        private void AddMissingDimensionsAndLevels(Models.AssessmentScoringResult result)
        {
            List <Models.DimensionResult> dimensions = result.DimensionResults.ToList();

            foreach (var item in _dimensionCapabilityCount)
            {
                Models.DimensionResult dimension = null;
                if (dimensions.Any(i => i.DimensionId == item.Item1))
                {
                    dimension = dimensions.First(i => i.DimensionId == item.Item1);
                }
                else
                {
                    dimension = new Models.DimensionResult()
                    {
                        DimensionId = item.Item1
                    };
                    dimensions.Add(dimension);
                }

                AddMissingLevels(dimension, item.Item2);
            }

            result.DimensionResults = dimensions;
        }
コード例 #2
0
        private void AddMissingLevels(Models.DimensionResult dimension, int level)
        {
            if (dimension.Levels == null)
            {
                dimension.Levels = new List <Models.LevelResult>();
            }

            if (!dimension.Levels.Any(i => i.Level == level))
            {
                var levels = dimension.Levels.ToList();
                levels.Add(new Models.LevelResult()
                {
                    Level         = level,
                    LevelAchieved = false
                });
                dimension.Levels = levels;
            }
        }
コード例 #3
0
        private void AddMissingDimensionsAndLevels(Models.AssessmentScoringResult result)
        {
            List<Models.DimensionResult> dimensions = result.DimensionResults.ToList();

            foreach (var item in _dimensionCapabilityCount)
            {
                Models.DimensionResult dimension = null;
                if (dimensions.Any(i => i.DimensionId == item.Item1))
                {
                    dimension = dimensions.First(i => i.DimensionId == item.Item1);
                }
                else
                {
                    dimension = new Models.DimensionResult() { DimensionId = item.Item1 };
                    dimensions.Add(dimension);
                }

                AddMissingLevels(dimension, item.Item2);
            }

            result.DimensionResults = dimensions;
        }