Esempio n. 1
0
        public static Display.AnalyticValueDriverGroup ToAnalyticDisplayEntity(this DTO.ValueDriverGroup dto)
        {
            var displayEntity = new Display.AnalyticValueDriverGroup();

            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);
        }
Esempio n. 2
0
        public void RecalculateEditableGroups()
        {
            if (Groups != null && Groups.Count > 0)
            {
                var firstGroup = Groups[0];
                //TODO: determine rules for applying cutoff to individual group values.
                //firstGroup.MaxOutlier = Math.Min(firstGroup.MaxOutlier, HighCutoff);

                var lastGroup = Groups[Groups.Count - 1];
                //TODO: determine rules for applying cutoff to individual group values.
                //lastGroup.MinOutlier = Math.Max(lastGroup.MinOutlier, LowCutoff);

                if (IsAutoGenerated)
                {
                    //Only the first group's Maximum and last group's Minimum are editable.
                    SetAllGroupsEditable(false);
                    firstGroup.IsMaxValueEditable = true;
                    lastGroup.IsMinValueEditable  = true;
                }
                else
                {
                    //First group is always editable.
                    firstGroup.IsMaxValueEditable = true;
                    firstGroup.IsMinValueEditable = true;

                    for (int i = 1; i < Groups.Count; i++)
                    {
                        //Each succeeding group's values and editabilty depend on the previous group.
                        AnalyticValueDriverGroup group = Groups[i];

                        //Max outlier is only editable for the first group.
                        group.IsMaxValueEditable = false;
                        group.MaxOutlier         = Math.Max(0, Groups[i - 1].MinOutlier - 1);
                        if (group.MaxOutlier == 0)
                        {
                            group.MinOutlier = 0;
                        }
                        group.IsMinValueEditable = (group.MaxOutlier > 0);
                    }
                }
            }
        }