Exemplo n.º 1
0
        private void Populate(ABOResult parent, int count, ref int index, bool getFull, NamesList names, int childPercent, int siblingPercent)
        {
            if (index >= count)
            {
                return;
            }

            index++;

            ABOResult result = (getFull) ? new ABOFullResult() : new ABOResult();

            result.SetSampleData(names, index);
            if (parent.Children == null)
            {
                parent.Children = new List <ABOResult>();
            }
            parent.Children.Add(result);

            result.GroupSize = _random.Next(1, 25);

            bool makeChild   = (((double)_random.Next(10000) / 10000) * 100) <= childPercent;
            bool makeSibling = (((double)_random.Next(10000) / 10000) * 100) <= siblingPercent;

            if (makeChild)
            {
                this.Populate(result, count, ref index, getFull, names, childPercent, siblingPercent);
            }
            else if (makeSibling)
            {
                this.Populate(parent, count, ref index, getFull, names, childPercent, siblingPercent);
            }
        }
Exemplo n.º 2
0
        private List <object> Minify(ABOResult record)
        {
            var resultStrings = new List <object>();

            var properties = record.GetType().GetProperties();

            foreach (var item in properties)
            {
                if (item.Name != "Children")
                {
                    resultStrings.Add(item.GetValue(record));
                }
            }

            //var resultStrings = new List<object>(new object[] {
            //		record.Name,
            //		record.ID,
            //		record.Country,
            //		record.IsActive.ToString(),
            //		record.IsConfidential.ToString(),
            //		record.Entry.ToString()
            //});

            if (record.Children != null)
            {
                List <object> children = new List <object>();
                foreach (var child in record.Children)
                {
                    children.Add(this.Minify(child));
                }
                resultStrings.Add(children);
            }

            return(resultStrings);
        }
Exemplo n.º 3
0
        private ABOResult Getter(int count, bool getFull, int childPercent, int siblingPercent)
        {
            // limit the number of results
            if (count > 20000)
            {
                count = 20000;
            }
            count = count - 1;

            var       results = new List <ABOResult>();
            NamesList names   = new NamesList();

            ABOResult result = (getFull) ? new ABOFullResult() : new ABOResult();

            result.SetSampleData(names, 0);
            int index = 0;

            while (index < count)
            {
                this.Populate(result, count, ref index, getFull, names, childPercent, siblingPercent);
            }

            return(result);
        }
Exemplo n.º 4
0
        private void Populate(ABOResult parent, int count, ref int index, bool getFull, NamesList names, int childPercent, int siblingPercent)
        {
            if (index >= count) return;

            index++;

            ABOResult result = (getFull) ? new ABOFullResult() : new ABOResult();
            result.SetSampleData(names, index);
            if (parent.Children == null) parent.Children = new List<ABOResult>();
            parent.Children.Add(result);

            result.GroupSize = _random.Next(1, 25);

            bool makeChild = (((double)_random.Next(10000) / 10000) * 100) <= childPercent;
            bool makeSibling = (((double)_random.Next(10000) / 10000) * 100) <= siblingPercent;
            if (makeChild) {
                this.Populate(result, count, ref index, getFull, names, childPercent, siblingPercent);
            } else if (makeSibling) {
                this.Populate(parent, count, ref index, getFull, names, childPercent, siblingPercent);
            }
        }
Exemplo n.º 5
0
        private List<object> Minify(ABOResult record)
        {
            var resultStrings = new List<object>();

            var properties = record.GetType().GetProperties();
            foreach (var item in properties) {
                if (item.Name != "Children") {
                    resultStrings.Add(item.GetValue(record));
                }
            }

            //var resultStrings = new List<object>(new object[] {
            //		record.Name,
            //		record.ID,
            //		record.Country,
            //		record.IsActive.ToString(),
            //		record.IsConfidential.ToString(),
            //		record.Entry.ToString()
            //});

            if (record.Children != null) {
                List<object> children = new List<object>();
                foreach (var child in record.Children) {
                    children.Add(this.Minify(child));
                }
                resultStrings.Add(children);
            }

            return resultStrings;
        }