public static string GetSubcontractViewName(this CacheEntityItem cacheEntityItem)
 {
     return(cacheEntityItem.SubKey == typeof(POOrder).FullName
         ? Constants.SubcontractTypeName
         : cacheEntityItem.SubKey == typeof(POLine).FullName
             ? Constants.SubcontractLine
             : cacheEntityItem.Name);
 }
Ejemplo n.º 2
0
        public static List <CacheEntityItem> TemplateEntity(PXGraph graph, string parent, PXSiteMap.ScreenInfo _info)
        {
            List <CacheEntityItem> ret = new List <CacheEntityItem>();

            if (parent == null)
            {
                int i = 0;
                if (_info.GraphName != null)
                {
                    foreach (Data.Description.PXViewDescription viewdescr in _info.Containers.Values)
                    {
                        CacheEntityItem item = new CacheEntityItem();
                        item.Key    = viewdescr.ViewName;
                        item.SubKey = viewdescr.ViewName;
                        item.Path   = null;
                        item.Name   = viewdescr.DisplayName;
                        item.Number = i++;
                        item.Icon   = Sprite.Main.GetFullUrl(Sprite.Main.Box);
                        ret.Add(item);
                    }
                }
            }
            else
            {
                string[] viewname = null;
                _info.Views.TryGetValue(parent, out viewname);
                if (viewname != null)
                {
                    int f         = 0;
                    var tempgraph = (PXGraph)PXGraph.CreateInstance(GraphHelper.GetType(_info.GraphName));
                    if (!tempgraph.Views.ContainsKey(parent))
                    {
                        return(null);
                    }

                    foreach (PXFieldState field in PXFieldState.GetFields(graph, tempgraph.Views[parent].BqlSelect.GetTables(), false))
                    {
                        CacheEntityItem item = new CacheEntityItem();
                        item.Key    = parent + "." + field.Name;
                        item.SubKey = field.Name;
                        item.Path   = "((" +
                                      (string.IsNullOrEmpty(parent)
                                                                                                        ? field.Name
                                                                                                        : parent + "." + field.Name) + "))";
                        item.Name   = field.DisplayName;
                        item.Number = f++;
                        item.Icon   = Sprite.Main.GetFullUrl(Sprite.Main.BoxIn);
                        ret.Add(item);
                    }
                }
            }
            return(ret);
        }