Пример #1
0
        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)
        {
            var  dataEntityToken = (DataEntityToken)this.EntityToken;
            Type type            = this.GetBinding <Type>(SelectedTypeBindingName);

            IPage page = (IPage)dataEntityToken.Data;

            Guid dataTypeId = type.GetImmutableTypeId();

            lock (_lock)
            {
                if (page.GetFolderDefinitionId(dataTypeId) == Guid.Empty)
                {
                    page.AddFolderDefinition(dataTypeId);
                }
            }


            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();

            specificTreeRefresher.PostRefreshMesseges(this.EntityToken);

            var folderEntityToken = new AssociatedDataElementProviderHelperEntityToken(
                TypeManager.SerializeType(typeof(IPage)),
                PageElementProvider.DefaultConfigurationName,
                page.Id.ToString(),
                TypeManager.SerializeType(type));

            SelectElement(folderEntityToken);
        }
Пример #2
0
        public List <Element> GetChildren(T data, EntityToken parentEntityToken)
        {
            var children = new List <Element>();

            PropertyInfo idPropertyInfo = typeof(T).GetKeyProperties()[0];

            foreach (Type type in PageFolderFacade.GetDefinedFolderTypes((IPage)data).OrderBy(t => t.Name))
            {
                var entityToken = new AssociatedDataElementProviderHelperEntityToken(
                    TypeManager.SerializeType(typeof(T)),
                    _elementProviderContext.ProviderName,
                    ValueTypeConverter.Convert <string>(idPropertyInfo.GetValue(data, null)),
                    TypeManager.SerializeType(type)
                    );

                DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(type);

                var element = new Element(_elementProviderContext.CreateElementHandle(entityToken))
                {
                    VisualData = new ElementVisualizedData
                    {
                        Label       = dataTypeDescriptor.Title ?? type.Name,
                        ToolTip     = dataTypeDescriptor.Title ?? type.Name,
                        Icon        = this.InterfaceClosedIcon,
                        OpenedIcon  = this.InterfaceOpenIcon,
                        HasChildren = true // This is sat to always true to boost performance.
                    }
                };


                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow"), RemoveAssociatedTypePermissionTypes)))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.RemoveAssociatedTypeLabel"),
                        ToolTip        = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.RemoveAssociatedTypeToolTip"),
                        Icon           = this.RemoveDataAssociationTypeIcon,
                        Disabled       = false,
                        ActionLocation = new ActionLocation
                        {
                            ActionType  = ActionType.Delete,
                            IsInFolder  = false,
                            IsInToolbar = false,
                            ActionGroup = AppendedActionGroup
                        }
                    }
                });

                AddAddAssociatedDataAction(element, true);

                children.Add(element);
            }

            return(children);
        }
Пример #3
0
        public List <Element> GetChildren(AssociatedDataElementProviderHelperEntityToken entityToken, bool includeForeignFolders)
        {
            IData data          = entityToken.GetDataList().FirstOrDefault();
            Type  interfaceType = TypeManager.TryGetType(entityToken.Payload);

            if (data == null)
            {
                return(new List <Element>());
            }
            if (interfaceType == null)
            {
                return(new List <Element>());
            }


            return(_dataGroupingProviderHelper.GetRootGroupFolders(interfaceType, entityToken, includeForeignFolders).ToList());
        }
Пример #4
0
        private void selectTypeCodeActivity_Next_ExecuteCode(object sender, EventArgs e)
        {
            var type = GetBinding <Type>("SelectedType");

            var dataEntityToken = (DataEntityToken)EntityToken;

            var parentInterfaceType = dataEntityToken.Data.DataSourceId.InterfaceType;
            var id       = parentInterfaceType.GetKeyProperties()[0].GetValue(dataEntityToken.Data, null);
            var idString = ValueTypeConverter.Convert <string>(id);

            var entityToken = new AssociatedDataElementProviderHelperEntityToken(
                TypeManager.SerializeType(parentInterfaceType),
                EntityToken.Source,
                idString,
                TypeManager.SerializeType(type)
                );

            ExecuteWorklow(entityToken, typeof(AddAssociatedDataWorkflow));

            var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(type.GetImmutableTypeId());

            UpdateBinding("DataTypeDescriptor", dataTypeDescriptor);
        }
Пример #5
0
        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)
        {
            var dataEntityToken = (DataEntityToken)this.EntityToken;
            Type type = this.GetBinding<Type>(SelectedTypeBindingName);

            IPage page = (IPage)dataEntityToken.Data;

            page.AddFolderDefinition(type.GetImmutableTypeId());

            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();
            specificTreeRefresher.PostRefreshMesseges(this.EntityToken);

            var folderEntityToken = new AssociatedDataElementProviderHelperEntityToken(
                TypeManager.SerializeType(typeof (IPage)),
                PageElementProvider.DefaultConfigurationName,
                page.Id.ToString(),
                TypeManager.SerializeType(type));

            SelectElement(folderEntityToken);
        }
Пример #6
0
        private void selectTypeCodeActivity_Next_ExecuteCode(object sender, EventArgs e)
        {
            var type = GetBinding<Type>("SelectedType");

            var dataEntityToken = (DataEntityToken)EntityToken;

            var parentInterfaceType = dataEntityToken.Data.DataSourceId.InterfaceType;
            var id = parentInterfaceType.GetKeyProperties()[0].GetValue(dataEntityToken.Data, null);
            var idString = ValueTypeConverter.Convert<string>(id);

            var entityToken = new AssociatedDataElementProviderHelperEntityToken(
                                TypeManager.SerializeType(parentInterfaceType),
                                EntityToken.Source,
                                idString,
                                TypeManager.SerializeType(type)
                            );

            ExecuteWorklow(entityToken, typeof(AddAssociatedDataWorkflow));

            var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(type.GetImmutableTypeId());
            UpdateBinding("DataTypeDescriptor", dataTypeDescriptor);
        }
Пример #7
0
        private Type GetFolderType()
        {
            AssociatedDataElementProviderHelperEntityToken entityToken = (AssociatedDataElementProviderHelperEntityToken)this.EntityToken;

            return(TypeManager.GetType(entityToken.Payload));
        }
Пример #8
0
        private IPage GetPage()
        {
            AssociatedDataElementProviderHelperEntityToken entityToken = (AssociatedDataElementProviderHelperEntityToken)this.EntityToken;

            return(Composite.Data.PageManager.GetPageById(new Guid(entityToken.Id)));
        }