Beispiel #1
0
        private void OnEditableChildListChanged()
        {
            CleanTemplateContextByValue(Constants.EditableChildList);

            foreach (var entity in EditableChildListEntities)
            {
                string key = String.Format(Constants.ListFormat, entity.EntityKeyName);

                if (ContextData.Get(key) != null)
                {
                    ContextData.Remove(key);
                }

                DynamicRootListEntities.Remove(entity);
                EditableRootListEntities.Remove(entity);
                DynamicListBaseEntities.Remove(entity);

                ContextData.Add(key, Constants.EditableChildList);

                if (State == TemplateState.RestoringProperties)
                {
                    continue;
                }

                AddChildEntity(entity, false, true);
            }
        }
Beispiel #2
0
        private void AddChildList(IEntity entity, bool readOnly, bool child)
        {
            if (Configuration.Instance.ExcludeRegexIsMatch(entity.EntityKey()))
            {
                return;
            }

            if (readOnly)
            {
                if (ReadOnlyListEntities.Count > 0 && ReadOnlyListEntities.Contains(entity))
                {
                    return;
                }
                if (ReadOnlyChildListEntities.Count > 0 && ReadOnlyChildListEntities.Contains(entity))
                {
                    return;
                }

                if (child)
                {
                    ReadOnlyChildListEntities.Add(entity);
                }
                else
                {
                    ReadOnlyListEntities.Add(entity);
                }
            }
            else
            {
                if (DynamicRootListEntities.Count > 0 && DynamicRootListEntities.Contains(entity))
                {
                    return;
                }
                if (EditableRootListEntities.Count > 0 && EditableRootListEntities.Contains(entity))
                {
                    return;
                }
                if (EditableChildListEntities.Count > 0 && EditableChildListEntities.Contains(entity))
                {
                    return;
                }
                if (child)
                {
                    EditableChildListEntities.Add(entity);
                }
                else
                {
                    EditableRootListEntities.Add(entity);
                }
            }
        }