Exemple #1
0
        private void CreateOrUpdateSpecialGroup(ProjectField field)
        {
            if (!field.HasSpecialGroup())
            {
                return;
            }

            if (field.CharacterGroup == null)
            {
                field.CharacterGroup = new CharacterGroup()
                {
                    AvaiableDirectSlots     = 0,
                    HaveDirectSlots         = false,
                    ParentCharacterGroupIds = new[] { field.Project.RootGroup.CharacterGroupId },
                    ProjectId = field.ProjectId,
                    IsRoot    = false,
                    IsSpecial = true,
                    ResponsibleMasterUserId = null,
                };
                MarkCreatedNow(field.CharacterGroup);
            }

            foreach (var fieldValue in field.DropdownValues)
            {
                if (fieldValue.CharacterGroup == null)
                {
                    continue;                            //We can't convert to LINQ because of RSRP-457084
                }
                UpdateSpecialGroupProperties(fieldValue);
            }

            UpdateSpecialGroupProperties(field);
        }
        private static void CreateOrUpdateSpecialGroup(ProjectField field)
        {
            if (!field.HasSpecialGroup())
            {
                return;
            }

            field.CharacterGroup = field.CharacterGroup ?? new CharacterGroup()
            {
                AvaiableDirectSlots     = 0,
                HaveDirectSlots         = false,
                ParentCharacterGroupIds = new [] { field.Project.RootGroup.CharacterGroupId },
                ProjectId = field.ProjectId,
                IsRoot    = false,
                IsSpecial = true,
                ResponsibleMasterUserId = null,
            };

            field.CharacterGroup.IsPublic = field.IsPublic;
            foreach (var fieldValue in field.DropdownValues)
            {
                if (fieldValue.CharacterGroup == null)
                {
                    continue;                            //We can't convert to LINQ because of RSRP-457084
                }
                fieldValue.CharacterGroup.IsPublic           = field.IsPublic;
                fieldValue.CharacterGroup.CharacterGroupName = fieldValue.GetSpecialGroupName();
            }
            field.CharacterGroup.IsActive    = field.IsActive;
            field.CharacterGroup.Description = field.Description;

            field.CharacterGroup.CharacterGroupName = field.GetSpecialGroupName();
        }