protected List <PXSiteMapNode> GetGraphTypes(string key, MakeSiteMapCondition condition)
        {
            var list = new List <PXSiteMapNode>();

            foreach (EntityItemSource e in EMailSourceHelper.TemplateScreensByCondition(this, key, null, condition))
            {
                if (!String.IsNullOrEmpty(e.ScreenID))
                {
                    PXSiteMapNode node = (PXSiteMapNode)PXSiteMap.Provider.FindSiteMapNodeFromKey(e.Key);
                    if (node != null && !String.IsNullOrEmpty(node.GraphType))
                    {
                        e.SubKey = node.GraphType;
                        if (node.HasChildNodes)
                        {
                            list.AddRange(GetGraphTypes(e.Key, condition));
                        }
                        else
                        {
                            list.Add(node);
                        }
                    }
                }
                else
                {
                    list.AddRange(GetGraphTypes(e.Key, condition));
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
        private IEnumerable <EntityItemSource> GraphTypeList()
        {
            if (this.AssigmentMap.Current == null)
            {
                yield break;
            }

            var aMap = AssigmentMap.Current;
            EPAssignmentRoute route = PXSelect <EPAssignmentRoute,
                                                Where <EPAssignmentRoute.assignmentMapID, Equal <Required <EPAssignmentRoute.assignmentMapID> > > >
                                      .Select(this, aMap.AssignmentMapID);

            if (route != null && aMap.EntityType != null)
            {
                Type graphType;

                if (aMap.GraphType != null)
                {
                    graphType = GraphHelper.GetType(aMap.GraphType);
                }
                else
                {
                    Type entityType = System.Web.Compilation.PXBuildManager.GetType(aMap.EntityType, false);
                    graphType      = EntityHelper.GetPrimaryGraphType(this, entityType);
                    aMap.GraphType = graphType.FullName;
                }

                if (graphType != null)
                {
                    PXSiteMapNode node = PXSiteMap.Provider.FindSiteMapNodeUnsecure(graphType);
                    if (node != null)
                    {
                        yield return(new EntityItemSource(node, aMap.GraphType));
                    }
                }
                else
                {
                    foreach (var e in EMailSourceHelper.TemplateScreens(this, null, null))
                    {
                        yield return(e);
                    }
                }
            }
            else
            {
                foreach (EntityItemSource e in EMailSourceHelper.TemplateScreensByCondition(this, null, null,
                                                                                            type => type.IsDefined(typeof(PXEMailSourceAttribute), true) && typeof(PX.Data.EP.IAssign).IsAssignableFrom(type)))
                {
                    if (!String.IsNullOrEmpty(e.ScreenID))
                    {
                        PXSiteMapNode node = PXSiteMap.Provider.FindSiteMapNodeByScreenID(e.ScreenID);
                        if (node != null && !String.IsNullOrEmpty(node.GraphType))
                        {
                            e.SubKey = node.GraphType;
                            yield return(e);
                        }
                    }
                }
            }
        }