Esempio n. 1
0
        private void RecalculateDriverGroups(int newGroupCount)
        {
            //Add new groups
            for (int index = Groups.Count; index <= newGroupCount; index++)
            {
                int defaultMaxOutlier = 0;
                if (index > 0)
                {
                    //Set the default based on the previous group's minimum outlier.
                    ValueDriverGroup previousGroup = Groups[index - 1];
                    defaultMaxOutlier = Convert.ToInt32(Math.Max(0, previousGroup.MinOutlier - 1));
                }

                short groupValue = Convert.ToInt16(index + 1);
                Groups.Add(new AnalyticValueDriverGroup {
                    Value = groupValue, MinOutlier = 0, MaxOutlier = defaultMaxOutlier
                });
            }

            //Remove existing groups
            for (int index = Groups.Count - 1; index >= newGroupCount; index--)
            {
                Groups.RemoveAt(index);
            }

            //Sync max and min with first and last auto groups.
            if (IsAutoGenerated)
            {
                UpdateAutoGroupValues();
            }

            RecalculateEditableGroups();
        }
Esempio n. 2
0
        public static DTO.ValueDriverGroup ToDto(this Display.ValueDriverGroup displayEntity)
        {
            var dto = new DTO.ValueDriverGroup(
                displayEntity.Id,
                displayEntity.Value,
                displayEntity.MinOutlier,
                displayEntity.MaxOutlier,
                displayEntity.Sort);

            return(dto);
        }
Esempio n. 3
0
        public static Display.ValueDriverGroup ToDisplayEntity(this DTO.ValueDriverGroup dto)
        {
            var displayEntity = new Display.ValueDriverGroup();

            displayEntity.Id         = dto.Id;
            displayEntity.Value      = dto.Value;
            displayEntity.MinOutlier = dto.MinOutlier;
            displayEntity.MaxOutlier = dto.MaxOutlier;
            displayEntity.Sort       = dto.Sort;

            displayEntity.IsDirty = false;

            return(displayEntity);
        }