Пример #1
0
        private void LoadFileVersions___(HarvestFileNode file)
        {
            int         itemId;
            int         parentVersionId;
            int         parentItemId;
            int         versionid;
            int         versionNo;
            string      itemName;
            HarvestNode newItem;

            string query = HSqlQueriesService.GetQuery(
                "Get Versions",
                new Dictionary <string, string>()
            {
                { ":itemobjid", file.Id.ToString() }
            }
                );

            foreach (var line in CONNECTION.RunHSQL(query))
            {
                int.TryParse(line.GetValueOrDefault("ITEMOBJID"), out itemId);
                int.TryParse(line.GetValueOrDefault("VERSIONOBJID"), out versionid);
                int.TryParse(line.GetValueOrDefault("PARENTOBJID"), out parentItemId);
                int.TryParse(line.GetValueOrDefault("PARENTVERSIONID"), out parentVersionId);
                int.TryParse(line.GetValueOrDefault("MAPPEDVERSION"), out versionNo);

                itemName = line.GetValueOrDefault("ITEMNAME");

                newItem = new HarvestNode(itemName)
                {
                    Id            = itemId,
                    EnvironmentId = file.EnvironmentId,
                    ParentId      = parentItemId,
                    Type          = NodeType.FILE,
                    Level         = file.Level,
                    VersionNo     = versionNo,
                    PathFullName  = line.GetValueOrDefault("PATHFULLNAME")
                };

                file.AddVersion(newItem);
            }
        }
Пример #2
0
        private HarvestEnvironment LoadEnvironmentDetails___(HarvestEnvironment env, int?startItemId = null, int?toLevel = 10)
        {
            if (environments.Contains(env))
            {
                int         level;
                int         itemId;
                int         itemType;
                int         parentItemId;
                string      itemName;
                HarvestNode newItem = null;

                string query = HSqlQueriesService.GetQuery(
                    "Env Items Tree",
                    new Dictionary <string, string>()
                {
                    { ":viewobjid1", env.BaseLineViewId.ToString() },
                    { ":viewobjid2", env.ImplementationView.Id.ToString() },
                    { ":maxlevel", toLevel.ToString() },
                    { ":parentobjid", startItemId == null ? "0" : startItemId.ToString() }
                }
                    );

                foreach (var line in CONNECTION.RunHSQL(query))
                {
                    int.TryParse(line.GetValueOrDefault("LVL"), out level);
                    int.TryParse(line.GetValueOrDefault("ITEMOBJID"), out itemId);
                    int.TryParse(line.GetValueOrDefault("PARENTOBJID"), out parentItemId);
                    int.TryParse(line.GetValueOrDefault("ITEMTYPE"), out itemType);

                    itemName = line.GetValueOrDefault("ITEMNAME");

                    if (itemType == 0)
                    {
                        newItem = new HarvestDirectoryNode(itemName)
                        {
                            Id            = itemId,
                            EnvironmentId = env.Id,
                            ParentId      = parentItemId,
                            Type          = NodeType.DIRECTORY,
                            Level         = level,
                            PathFullName  = line.GetValueOrDefault("PATHFULLNAME")
                        };
                    }
                    else if (itemName.ToUpper() != "DEPLOY.INI")
                    {
                        newItem = new HarvestFileNode(itemName)
                        {
                            Id            = itemId,
                            EnvironmentId = env.Id,
                            ParentId      = parentItemId,
                            Type          = NodeType.FILE,
                            Level         = level,
                            PathFullName  = line.GetValueOrDefault("PATHFULLNAME")
                        };
                    }

                    if (newItem != null)
                    {
                        if (level == 0)
                        {
                            env.ImplementationView.Root = newItem as HarvestDirectoryNode;
                        }
                        else
                        {
                            env.ImplementationView.Root.GetDirectoryNode(newItem.ParentId)?.Add(newItem);
                        }
                    }
                }
            }
            return(env);
        }