示例#1
0
        public static JudgmentModel CrateJudgmentTree(JudgmentModel judgmentModel, IEnumerable<Property> properties, IEnumerable<Mark> marks)
        {
            for (Int32 i = 0; i < properties.Count() - 1; i++)
            {
                MarkOfPropertyModel shortInventoryObjectModel = new MarkOfPropertyModel
                {
                    PropertyId = properties.ToArray()[i].Id,
                    PropertyName = properties.ToArray()[i].Name,
                    Objects = new List<MarkOfPropertyModel>()
                };

                for (var j = i + 1; j < properties.Count(); j++)
                {
                    shortInventoryObjectModel.Objects.Add(new MarkOfPropertyModel
                    {
                        PropertyId = properties.ToArray()[j].Id,
                        PropertyName = properties.ToArray()[j].Name,
                        Mark = marks.First(m => m.IsDefault).Id
                    });
                }

                judgmentModel.Objects.Add(shortInventoryObjectModel);
            }

            return judgmentModel;
        }
示例#2
0
        private static String[] GetPropertiesList(MarkOfPropertyModel markOfPropertyModel)
        {
            List<String> properties = new List<String>();

            properties.Add(markOfPropertyModel.Objects.First().PropertyName);

            foreach (var item in markOfPropertyModel.Objects.First().Objects)
            {
                properties.Add(item.PropertyName);
            }

            return properties.ToArray();
        }