Exemplo n.º 1
0
 protected bool Equals(PartNode other)
 {
     return Equals(Part, other.Part);
 }
Exemplo n.º 2
0
 protected bool Equals(PartNode other)
 {
     return(Equals(Part, other.Part));
 }
Exemplo n.º 3
0
        public ActionResult ShowImportExport(String providerConfigName)
        {
            var providerPair = ProviderPairFactory.CreateProviderPair(providerConfigName);
            var allValues = providerPair.ValueManager.GetAllValuesQualified().ToArray();
            var allParts = allValues.Select(value => value.Qualifier.Part).Distinct().OrderBy(p => p.ToString()).ToArray();
            var allLocales = allValues.Select(value => value.Qualifier.Locale).Distinct().OrderBy(l => l.ToString()).ToArray();

            var partNodes = new Dictionary<Part, PartNode>();
            foreach (var part in allParts) {
                var isRoot = part.Parent == null;
                var node = new PartNode(part, isRoot);

                partNodes.Add(part, node);
                if (!isRoot) {
                    var fixNode = node;
                    while (fixNode.Part.Parent != null) {
                        var parentNode = new PartNode(fixNode.Part.Parent, fixNode.Part.Parent.Parent == null);
                        if (partNodes.ContainsKey(parentNode.Part)) {
                            partNodes[parentNode.Part].SubParts.Add(fixNode);
                            break;
                        }

                        partNodes.Add(parentNode.Part, parentNode);
                        parentNode.SubParts.Add(fixNode);
                        fixNode = parentNode;
                    }
                }
            }
            foreach (var part in allParts.Where(part => part.Parent != null))
                partNodes.Remove(part);

            return View(new ImportExportData(partNodes.Values, allLocales, providerConfigName));
        }