Example #1
0
        private void deleteDependency(NpgsqlConnection conn, NpgsqlTransaction tran, String id)
        {
            DependencyDAO dependencyDAO = new DependencyDAO();

            List <Dependency> dependencies = dependencyDAO.selectByElementID(id);

            foreach (Dependency dependency in dependencies)
            {
                dependencyDAO.delete(conn, tran, dependency.element.getId(), dependency.dependencyElement.getId());
            }

            dependencies = dependencyDAO.selectByDependencyElementID(id);
            foreach (Dependency dependency in dependencies)
            {
                dependencyDAO.delete(conn, tran, dependency.element.getId(), dependency.dependencyElement.getId());
            }
        }
Example #2
0
        private void updateDependencyID(NpgsqlConnection conn, NpgsqlTransaction tran, String originalID, String newID)
        {
            if (originalID.Equals(Element.getRoot().getId()))
            {
                return;
            }

            DependencyDAO dependencyDAO = new DependencyDAO();

            List <Dependency> dependencies = dependencyDAO.selectByElementID(originalID);

            foreach (Dependency dependency in dependencies)
            {
                dependencyDAO.update(
                    conn,
                    tran,
                    dependency.element.getId(),
                    dependency.dependencyElement.getId(),
                    newID,
                    dependency.dependencyElement.getId(),
                    dependency.dependencyTypeCreate,
                    dependency.dependencyTypeRead,
                    dependency.dependencyTypeUpdate,
                    dependency.dependencyTypeDelete,
                    dependency.remark);
            }

            dependencies = dependencyDAO.selectByDependencyElementID(originalID);
            foreach (Dependency dependency in dependencies)
            {
                dependencyDAO.update(
                    conn,
                    tran,
                    dependency.element.getId(),
                    dependency.dependencyElement.getId(),
                    dependency.element.getId(),
                    newID,
                    dependency.dependencyTypeCreate,
                    dependency.dependencyTypeRead,
                    dependency.dependencyTypeUpdate,
                    dependency.dependencyTypeDelete,
                    dependency.remark);
            }
        }