Пример #1
0
        /// <summary>
        /// Assigns each Result of this driver to its corresponding Driver Group
        /// Applies only to the selected mode (e.g., Auto or User).
        /// </summary>
        public void AssignResultsToDriverGroups()
        {
            AnalyticValueDriverMode selectedMode = Modes.Where(item => item.IsSelected).FirstOrDefault();

            if (selectedMode != null)
            {
                foreach (AnalyticValueDriverGroup driverGroup in selectedMode.Groups)
                {
                    //Assignment is based on matching the Value property of the Result and Driver Group.
                    driverGroup.Results = Results.SingleOrDefault(result => result.Value == driverGroup.Value);
                }
            }
        }
Пример #2
0
        public static DTO.AnalyticValueDriverMode ToDto(this Display.AnalyticValueDriverMode displayEntity)
        {
            var groups = new List <DTO.ValueDriverGroup>();

            foreach (Display.ValueDriverGroup group in displayEntity.Groups)
            {
                groups.Add(group.ToDto());
            }

            var dto = new DTO.AnalyticValueDriverMode(
                displayEntity.Key,
                displayEntity.IsSelected,
                displayEntity.Name,
                displayEntity.Title,
                displayEntity.Sort,
                groups);

            return(dto);
        }
Пример #3
0
        public static Display.AnalyticValueDriverMode ToDisplayEntity(this DTO.AnalyticValueDriverMode dto)
        {
            var displayEntity = new Display.AnalyticValueDriverMode();

            displayEntity.Key        = dto.Key;
            displayEntity.Name       = dto.Name;
            displayEntity.Title      = dto.Title;
            displayEntity.Sort       = dto.Sort;
            displayEntity.IsSelected = dto.IsSelected;

            if (dto.Groups != null)
            {
                foreach (DTO.ValueDriverGroup group in dto.Groups)
                {
                    displayEntity.Groups.Add(group.ToAnalyticDisplayEntity());
                }
            }

            displayEntity.IsDirty = false;

            return(displayEntity);
        }