Exemplo n.º 1
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);
            }
        }
        public ActionResult <string> update([FromForm] InsertedLink parameter)
        {
            DependencyDAO dependnecyDAO = new DependencyDAO();

            dependnecyDAO.update(
                parameter.source,
                parameter.target,
                parameter.source,
                parameter.target,
                parameter.dependencyTypeC,
                parameter.dependencyTypeR,
                parameter.dependencyTypeU,
                parameter.dependencyTypeD,
                parameter.remark
                );

            return(JsonConvert.SerializeObject(new { }));
        }