Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void moveDataSameInstance() throws Exception
        private void moveDataSameInstance()
        {
            this.progress.Indeterminate = true;
            bool @bool = (this.sourceConnection != null) ? 1 : 0;

            if (!@bool)
            {
                this.sourceConnection            = ProjectSessionFactory.getConnection(this.source);
                this.sourceConnection.AutoCommit = false;
            }
            try
            {
                System.Collections.IList list1 = this.helper.listEntities();
                System.Collections.IList list2 = this.helper.listEntitiesWithForeignKeys();
                this.progress.Indeterminate = false;
                this.progress.TotalTimes    = list1.Count * 2 + list2.Count;
                logger.trace("SOURCE ID: " + this.source.ProjectUrlId + " DEST ID: " + this.dest.ProjectUrlId);
                foreach (ProjectEntityMetadataKeeper projectEntityMetadataKeeper in list1)
                {
                    try
                    {
                        executeUpdateQuery(this.sourceConnection, projectEntityMetadataKeeper.getAlterIdRefColumnStatement(this.dest));
                    }
                    catch (Exception)
                    {
                        logger.trace("COULD NOT EXECUTE ALTER: " + projectEntityMetadataKeeper.getAlterIdRefColumnStatement(this.dest));
                    }
                    this.progress.incrementProgress(1);
                    string str = projectEntityMetadataKeeper.getInsertIntoBySelectNoForeignKeysStatement(this.dest);
                    logger.trace("\nINSERT: " + str);
                    executeUpdateQuery(this.sourceConnection, str);
                    this.progress.incrementProgress(1);
                }
                foreach (ProjectEntityMetadataKeeper projectEntityMetadataKeeper in list2)
                {
                    string str = projectEntityMetadataKeeper.getUpdateBySelectForeignKeysStatement(this.dest);
                    logger.trace("\nFK UPDATE: " + str);
                    executeUpdateQuery(this.sourceConnection, str);
                    this.progress.incrementProgress(1);
                }
                updateFixedReferences(this.sourceConnection);
            }
            catch (Exception exception)
            {
                this.progress.Indeterminate = true;
                this.sourceConnection.close();
                throw exception;
            }
            this.progress.Indeterminate = true;
            if (!@bool)
            {
                this.sourceConnection.close();
            }
        }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void initialize() throws Exception
        private void initialize()
        {
            this.progress.Indeterminate = true;
            string str = "";

            if (this.sourceConnection != null || this.destConnection != null)
            {
                str = ";useLOBs=false";
            }
            if (this.sourceConnection == null)
            {
                this.sourceConnection            = ProjectSessionFactory.getConnection(this.source.Url + str, this.source.Username, this.source.Password);
                this.sourceConnection.AutoCommit = false;
            }
            if (this.destConnection == null)
            {
                this.destConnection            = ProjectSessionFactory.getConnection(this.dest.Url + str, this.dest.Username, this.dest.Password);
                this.destConnection.AutoCommit = false;
            }
        }
Пример #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void initialize() throws Exception
        private void initialize()
        {
            this.progress.Indeterminate = true;
            this.connection             = ProjectSessionFactory.getConnection(this.urlTable);
        }
Пример #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void moveDataSameInstanceAppendProjects() throws Exception
        private void moveDataSameInstanceAppendProjects()
        {
            this.progress.Indeterminate = true;
            bool @bool = (this.sourceConnection != null) ? 1 : 0;

            if (!@bool)
            {
                this.sourceConnection            = ProjectSessionFactory.getConnection(this.source);
                this.sourceConnection.AutoCommit = false;
            }
            try
            {
                System.Collections.IList list1 = this.helper.listEntities();
                System.Collections.IList list2 = this.helper.listEntitiesWithForeignKeys();
                this.progress.Indeterminate = false;
                this.progress.TotalTimes    = list1.Count * 2 + list2.Count;
                logger.trace("SOURCE ID: " + this.source.ProjectUrlId + " DEST ID: " + this.dest.ProjectUrlId);
                foreach (ProjectEntityMetadataKeeper projectEntityMetadataKeeper in list1)
                {
                    if (projectEntityMetadataKeeper.TableName.Equals("XCELLFILE") || projectEntityMetadataKeeper.TableName.Equals("PROJECTTEMPLATE") || projectEntityMetadataKeeper.TableName.Equals("PROJECTSPECVAR") || projectEntityMetadataKeeper.TableName.Equals("RATEBUILDUP") || projectEntityMetadataKeeper.TableName.Equals("RATEBUILDUPCOLS") || projectEntityMetadataKeeper.TableName.Equals("RATEDISTRIB") || projectEntityMetadataKeeper.TableName.Equals("PROJECTWBS") || projectEntityMetadataKeeper.TableName.Equals("PROJECTWBS2") || projectEntityMetadataKeeper.TableName.Equals("PRJPROP") || projectEntityMetadataKeeper.TableName.Equals("PRJUSERPROP"))
                    {
                        continue;
                    }
                    try
                    {
                        executeUpdateQuery(this.sourceConnection, projectEntityMetadataKeeper.getAlterIdRefColumnStatement(this.dest));
                    }
                    catch (Exception)
                    {
                        logger.trace("COULD NOT EXECUTE ALTER: " + projectEntityMetadataKeeper.getAlterIdRefColumnStatement(this.dest));
                    }
                    this.progress.incrementProgress(1);
                    string str = projectEntityMetadataKeeper.getInsertIntoBySelectNoForeignKeysStatementAppendProjects(this.dest);
                    logger.trace("\nINSERT: " + str);
                    executeUpdateQuery(this.sourceConnection, str);
                    this.progress.incrementProgress(1);
                }
                foreach (ProjectEntityMetadataKeeper projectEntityMetadataKeeper in list2)
                {
                    if (projectEntityMetadataKeeper.TableName.Equals("XCELLFILE") || projectEntityMetadataKeeper.TableName.Equals("PROJECTTEMPLATE") || projectEntityMetadataKeeper.TableName.Equals("PROJECTSPECVAR") || projectEntityMetadataKeeper.TableName.Equals("RATEBUILDUP") || projectEntityMetadataKeeper.TableName.Equals("RATEBUILDUPCOLS") || projectEntityMetadataKeeper.TableName.Equals("RATEDISTRIB") || projectEntityMetadataKeeper.TableName.Equals("PROJECTWBS") || projectEntityMetadataKeeper.TableName.Equals("PROJECTWBS2") || projectEntityMetadataKeeper.TableName.Equals("PRJPROP") || projectEntityMetadataKeeper.TableName.Equals("PRJUSERPROP"))
                    {
                        continue;
                    }
                    string str = projectEntityMetadataKeeper.getUpdateBySelectForeignKeysStatement(this.dest);
                    logger.trace("\nFK UPDATE: " + str);
                    executeUpdateQuery(this.sourceConnection, str);
                    this.progress.incrementProgress(1);
                }
            }
            catch (Exception exception)
            {
                this.progress.Indeterminate = true;
                this.sourceConnection.close();
                throw exception;
            }
            this.progress.Indeterminate = true;
            if (!@bool)
            {
                this.sourceConnection.close();
            }
        }