コード例 #1
0
        private IList GetListOfSelectResults(Table item, PXView itemView, List <Type> Tables, int depth, MethodInfo select)
        {
            Type currentTable = Tables[depth];
            var  source       = typeof(Table).IsAssignableFrom(currentTable)
                                ? new PXResult <Table>(item).SingleToList()
                                : (IList)select.Invoke(this, new object[] { processGraph, null });

            if (source.Count == 0)
            {
                // Create a dummy result to keep recursion going
                source = new List <PXResult>();
                source.Add((PXResult)itemView.CreateResult(new object[Tables.Count]));
            }

            return(source);
        }
        private void Select(Table item, PXView itemView, List <Type> Tables, List <object> pars, int depth = 0)
        {
            if (pars == null)
            {
                pars = new List <object>();
            }

            Type       Tsetup = BqlCommand.Compose(typeof(PXSetup <>), Tables[depth]);
            MethodInfo select = Tsetup.GetMethod("Select", BindingFlags.Public | BindingFlags.Static);                            //PXSetup<Tables[depth]>.Select

            var source = typeof(Table).IsAssignableFrom(Tables[depth])
                                ? new PXResult <Table>(item).SingleToList()
                                : (IList)select.Invoke(this, new object[] { _Graph, null });

            depth++;

            foreach (PXResult result in source)
            {
                pars.Add(result[0]);

                if (depth == Tables.Count)
                {
                    var entity = Tables.Count == 1 ? result : (PXResult)itemView.CreateResult(pars.ToArray());

                    if (!results.Contains(entity))
                    {
                        results.Add(entity);
                    }
                }
                else
                {
                    Select(item, itemView, Tables, pars, depth);
                }

                pars.RemoveAt(depth - 1);
            }

            depth--;
        }
コード例 #3
0
        private void Select(Table item, PXView itemView, List <Type> Tables, List <object> pars, int depth = 0)
        {
            if (pars == null)
            {
                pars = new List <object>();
            }

            Type       Tsetup = BqlCommand.Compose(typeof(PXSetup <>), Tables[depth]);
            MethodInfo select = Tsetup.GetMethod("Select", BindingFlags.Public | BindingFlags.Static);                            //PXSetup<Tables[depth]>.Select

            IList source = GetListOfSelectResults(item, itemView, Tables, depth, select);

            depth++;

            foreach (PXResult result in source)
            {
                pars.Add(result[0]);

                if (depth == Tables.Count)
                {
                    var entity = Tables.Count == 1 ? result : (PXResult)itemView.CreateResult(pars.ToArray());

                    if (!results.Contains(entity))
                    {
                        results.Add(entity);
                    }
                }
                else
                {
                    Select(item, itemView, Tables, pars, depth);
                }

                pars.RemoveAt(depth - 1);
            }

            depth--;
        }