Exemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private ProjectDBDataMover(nomitech.common.ui.UIProgress paramUIProgress, nomitech.common.db.local.ProjectUrlTable paramProjectUrlTable1, nomitech.common.db.local.ProjectUrlTable paramProjectUrlTable2) throws Exception
        private ProjectDBDataMover(UIProgress paramUIProgress, ProjectUrlTable paramProjectUrlTable1, ProjectUrlTable paramProjectUrlTable2) : base(paramProjectUrlTable1.Dbms.Value, paramProjectUrlTable2.Dbms.Value)
        {
            this.progress = paramUIProgress;
            this.source   = paramProjectUrlTable1;
            this.dest     = paramProjectUrlTable2;
            this.helper   = new ProjectDBSchemaHelper(paramProjectUrlTable1);
        }
Exemplo n.º 2
0
 protected internal virtual void setProjectDatabaseSession(Session paramSession, ProjectUrlTable paramProjectUrlTable)
 {
     this.projectSession = paramSession;
     this.urlTable       = paramProjectUrlTable;
     if (paramSession == null)
     {
         return;
     }
     System.Collections.IList list = paramSession.createQuery("from ProjectVariableTable as o where o.projectId = :projectId").setLong("projectId", paramProjectUrlTable.ProjectUrlId.Value).list();
     foreach (ProjectVariableTable projectVariableTable in list)
     {
         string str1 = projectVariableTable.Name;
         string str2 = null;
         if (projectVariableTable.Number.Value)
         {
             str2 = projectVariableTable.StoredValueNum;
         }
         else
         {
             str2 = projectVariableTable.StoredValue;
         }
         if (string.ReferenceEquals(str2, null))
         {
             continue;
         }
         this.projectVariableNameValueMap[str1] = str2;
     }
 }
Exemplo n.º 3
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        //ORIGINAL LINE: public static ProjectDBUtil getOpenedProjectInstance(Desktop.common.nomitech.common.db.local.ProjectUrlTable paramProjectUrlTable) throws Exception
        public static ProjectDBUtil getOpenedProjectInstance(ProjectUrlTable paramProjectUrlTable)
        {
            string str = paramProjectUrlTable.Url + ";" + paramProjectUrlTable.Id;

            Console.WriteLine("Getting project instance: " + str);
            return((ProjectDBUtil)s_utilInstanceMap[str]);
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.boris.expr.Expr evaluate(org.boris.expr.IEvaluationContext paramIEvaluationContext, org.boris.expr.Expr[] paramArrayOfExpr) throws org.boris.expr.ExprException
        public virtual Expr evaluate(IEvaluationContext paramIEvaluationContext, Expr[] paramArrayOfExpr)
        {
            assertArgCount(paramArrayOfExpr, 0);
            try
            {
                string str = null;
                if (paramIEvaluationContext is ExprAbstractEvaluationContext)
                {
                    ProjectUrlTable projectUrlTable = ((ExprAbstractEvaluationContext)paramIEvaluationContext).ProjectUrlTable;
                    if (projectUrlTable != null)
                    {
                        str = projectUrlTable.ProjectInfoTable.Code;
                    }
                    else if (string.ReferenceEquals(str, null))
                    {
                        str = ProjectDBUtil.currentProjectDBUtil().Properties.getProperty("project.code");
                    }
                }
                return((string.ReferenceEquals(str, null)) ? new ExprString("") : new ExprString(str));
            }
            catch (Exception)
            {
                return(new ExprString("-"));
            }
        }
Exemplo n.º 5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.boris.expr.Expr evaluate(org.boris.expr.IEvaluationContext paramIEvaluationContext, org.boris.expr.Expr[] paramArrayOfExpr) throws org.boris.expr.ExprException
        public virtual Expr evaluate(IEvaluationContext paramIEvaluationContext, Expr[] paramArrayOfExpr)
        {
            assertArgCount(paramArrayOfExpr, 0);
            try
            {
                long?long = null;
                if (paramIEvaluationContext is ExprAbstractEvaluationContext)
                {
                    ProjectUrlTable projectUrlTable = ((ExprAbstractEvaluationContext)paramIEvaluationContext).ProjectUrlTable;
                    if (projectUrlTable != null)
                    {
                        long = projectUrlTable.Id;
                    }
                    else if (long == null)
                    {
                        long = ProjectDBUtil.currentProjectDBUtil().ProjectUrlId;
                    }
                }
                return(new ExprInteger(long.Value));
            }
            catch (Exception)
            {
                return(new ExprString("-"));
            }
        }
Exemplo n.º 6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private java.util.List<nomitech.common.db.local.ProjectUrlTable> getAllProjectUrls(java.sql.Connection paramConnection, java.util.Set<String> paramSet, boolean paramBoolean) throws Exception
        private IList <ProjectUrlTable> getAllProjectUrls(Connection paramConnection, ISet <string> paramSet, bool paramBoolean)
        {
            List <object> arrayList = new List <object>();

            try
            {
                ResultSet resultSet = executeSelectQuery(paramConnection, "SELECT PROJECTURLID, URL, DBUSR, DBPSWD, DBNAME, NAME, DBSRV, DBSINGLE, DBHOST, DBPORT FROM PROJECTURL WHERE DBSINGLE = 1 AND DBSRV = 3" + (paramBoolean ? " OR DBSRV = 0" : ""));
                while (resultSet.next())
                {
                    string str = resultSet.getString(5);
                    if (paramSet != null && paramSet.Count > 0 && !paramSet.Contains(str))
                    {
                        continue;
                    }
                    ProjectUrlTable projectUrlTable = new ProjectUrlTable();
                    projectUrlTable.ProjectUrlId        = Convert.ToInt64(resultSet.getLong(1));
                    projectUrlTable.Url                 = resultSet.getString(2);
                    projectUrlTable.Username            = resultSet.getString(3);
                    projectUrlTable.Password            = resultSet.getString(4);
                    projectUrlTable.DatabaseName        = resultSet.getString(5);
                    projectUrlTable.Name                = resultSet.getString(6);
                    projectUrlTable.Dbms                = Convert.ToInt32(resultSet.getInt(7));
                    projectUrlTable.CreatesNewDatabases = Convert.ToBoolean(resultSet.getBoolean(8));
                    projectUrlTable.Hostname            = resultSet.getString(9);
                    projectUrlTable.Port                = resultSet.getString(10);
                    arrayList.Add(projectUrlTable);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
            }
            return(arrayList);
        }
        private bool checkRequiresAltering(ProjectUrlTable paramProjectUrlTable)
        {
            if (paramProjectUrlTable.CreatesNewDatabases != null && !paramProjectUrlTable.CreatesNewDatabases.Value)
            {
                return(false);
            }
            Session session = DatabaseDBUtil.currentSession();

            try
            {
                string str1 = "SELECT PVAL as VER FROM  " + paramProjectUrlTable.DatabaseName + ".dbo.PRJPROP WHERE PKEY LIKE 'costos.estimating.version' and PRJID = " + ProjectUrlId;
                string str2 = (string)session.createSQLQuery(str1).addScalar("VER", StringType.INSTANCE).uniqueResult();
                if (string.ReferenceEquals(str2, null))
                {
                    DatabaseDBUtil.closeSession();
                    return(true);
                }
                if (StringUtils.checkEquality(str2, ProjectDBProperties.PROPERTIES_VERSION))
                {
                    DatabaseDBUtil.closeSession();
                    return(false);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
            }
            DatabaseDBUtil.closeSession();
            return(true);
        }
Exemplo n.º 8
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        //ORIGINAL LINE: public static ProjectServerDBUtil createNewProject(Desktop.common.nomitech.common.db.local.ProjectUrlTable paramProjectUrlTable, java.util.Properties paramProperties) throws Exception
        public static ProjectServerDBUtil createNewProject(ProjectUrlTable paramProjectUrlTable, Properties paramProperties)
        {
            ProjectServerDBUtil projectServerDBUtil = new ProjectServerDBUtil(paramProjectUrlTable, paramProperties);

            s_utilInstanceMap[projectServerDBUtil.UniqueId] = projectServerDBUtil;
            return(projectServerDBUtil);
        }
Exemplo n.º 9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.boris.expr.Expr evaluate(org.boris.expr.IEvaluationContext paramIEvaluationContext, org.boris.expr.Expr[] paramArrayOfExpr) throws org.boris.expr.ExprException
        public virtual Expr evaluate(IEvaluationContext paramIEvaluationContext, Expr[] paramArrayOfExpr)
        {
            assertArgCount(paramArrayOfExpr, 0);
            try
            {
                string str = null;
                if (paramIEvaluationContext is ExprAbstractEvaluationContext)
                {
                    ProjectUrlTable projectUrlTable = ((ExprAbstractEvaluationContext)paramIEvaluationContext).ProjectUrlTable;
                    if (projectUrlTable != null)
                    {
                        str = projectUrlTable.DatabaseName;
                    }
                    else if (string.ReferenceEquals(str, null))
                    {
                        str = ((ProjectServerDBUtil)ProjectDBUtil.currentProjectDBUtil()).ProjectUrl.DatabaseName;
                    }
                }
                return((string.ReferenceEquals(str, null)) ? new ExprString("") : new ExprString(str));
            }
            catch (Exception)
            {
                return(new ExprString("-"));
            }
        }
Exemplo n.º 10
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        //ORIGINAL LINE: public static ProjectFileDBUtil createNewFileProject(Desktop.common.nomitech.common.db.local.ProjectUrlTable paramProjectUrlTable) throws Exception
        public static ProjectFileDBUtil createNewFileProject(ProjectUrlTable paramProjectUrlTable)
        {
            ProjectFileDBUtil projectFileDBUtil = new ProjectFileDBUtil(paramProjectUrlTable);

            s_utilInstanceMap[projectFileDBUtil.UniqueId] = projectFileDBUtil;
            return(projectFileDBUtil);
        }
Exemplo n.º 11
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.boris.expr.Expr evaluate(org.boris.expr.IEvaluationContext paramIEvaluationContext, org.boris.expr.Expr[] paramArrayOfExpr) throws org.boris.expr.ExprException
        public virtual Expr evaluate(IEvaluationContext paramIEvaluationContext, Expr[] paramArrayOfExpr)
        {
            assertArgCount(paramArrayOfExpr, 0);
            DateTime date = null;

            try
            {
                if (paramIEvaluationContext is ExprAbstractEvaluationContext)
                {
                    ProjectUrlTable projectUrlTable = ((ExprAbstractEvaluationContext)paramIEvaluationContext).ProjectUrlTable;
                    if (projectUrlTable != null)
                    {
                        date = projectUrlTable.ProjectInfoTable.SubmissionDate;
                    }
                    else if (date == null)
                    {
                        date = ProjectDBUtil.currentProjectDBUtil().Properties.getDateProperty("project.submission.date");
                    }
                }
                return((date == null) ? new ExprDouble(ExcelDate.toExcelDate((DateTime.Now).Ticks)) : new ExprDouble(ExcelDate.toExcelDate(date.Ticks)));
            }
            catch (Exception)
            {
                return(new ExprDouble(ExcelDate.toExcelDate(date.Ticks)));
            }
        }
Exemplo n.º 12
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.boris.expr.Expr evaluate(org.boris.expr.IEvaluationContext paramIEvaluationContext, org.boris.expr.Expr[] paramArrayOfExpr) throws org.boris.expr.ExprException
        public virtual Expr evaluate(IEvaluationContext paramIEvaluationContext, Expr[] paramArrayOfExpr)
        {
            assertArgCount(paramArrayOfExpr, 0);
            try
            {
                int?integer = null;
                if (paramIEvaluationContext is ExprAbstractEvaluationContext)
                {
                    ProjectUrlTable projectUrlTable = ((ExprAbstractEvaluationContext)paramIEvaluationContext).ProjectUrlTable;
                    if (projectUrlTable != null)
                    {
                        integer = projectUrlTable.ProjectInfoTable.PaymentDuration;
                    }
                    else if (integer == null)
                    {
                        integer = Convert.ToInt32(ProjectDBUtil.currentProjectDBUtil().Properties.getIntProperty("project.constructionduration"));
                    }
                }
                return((integer == null) ? new ExprInteger(1) : new ExprInteger(integer.Value));
            }
            catch (Exception)
            {
                return(new ExprInteger(1));
            }
        }
        public virtual Configuration createConfigurationFromUrl(URL paramURL, ProjectUrlTable paramProjectUrlTable, GroupCodesProvider paramGroupCodesProvider, bool paramBoolean, string paramString)
        {
            string str1 = paramProjectUrlTable.Url;
            string str2 = CryptUtil.Instance.decryptHexString(paramProjectUrlTable.Username);
            string str3 = AddOnUtil.Instance.decryptHexString(paramProjectUrlTable.Password);
            int    i    = paramProjectUrlTable.Dbms.Value;

            return(createConfiguration(paramURL, i, paramGroupCodesProvider, paramBoolean, str1, str2, str3, paramString));
        }
Exemplo n.º 14
0
        public static ProjectUrlTable getFileUrl(string paramString)
        {
            ProjectUrlTable projectUrlTable = new ProjectUrlTable();

            projectUrlTable.Dbms     = Convert.ToInt32(CEP_FILE);
            projectUrlTable.Url      = paramString;
            projectUrlTable.Revision = "";
            return(projectUrlTable);
        }
Exemplo n.º 15
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public ProjectFileDBUtil(Desktop.common.nomitech.common.db.local.ProjectUrlTable paramProjectUrlTable) throws Exception
        public ProjectFileDBUtil(ProjectUrlTable paramProjectUrlTable)
        {
            if (configXML == null)
            {
                configXML = this.GetType().getResource("projectDB.xml");
            }
            this.urlTable = paramProjectUrlTable;
            ProjectUrlId  = paramProjectUrlTable.ProjectUrlId;
            makeNewDB();
        }
Exemplo n.º 16
0
        public static async Task SaveProject(
            Type projectType,
            Project toml,
            int userId,
            SqlDefaultDatabase db,
            ProjectStudentTable projectTable,
            CustomGroupTable groupTable,
            ProjectUrlTable projectUrl
            )
        {
            using (SqlStandardCallContext ctx = new SqlStandardCallContext())
            {
                // letter of project type
                string type;
                if (projectType.Name == "ProjectPi")
                {
                    type = "I";
                }
                else if (projectType.Name == "ProjectPfh")
                {
                    type = "H";
                }
                else
                {
                    type = "¤";
                }

                if (type == "I")
                {
                    ProjectPi project = toml as ProjectPi;

                    // register the project
                    (UserQueries userQueries, TimedUserQueries timedUserQueries, ProjectStudentStruct ProjectCreate, TimedUserData timedUser) = await SaveProjectPi(project, projectTable, userId, db, ctx, type, projectUrl, groupTable);

                    // link members to the project
                    if (toml.team.members.Length > 0)
                    {
                        await LinkMembersToProject(project, userQueries, timedUserQueries, ProjectCreate, timedUser, groupTable, ctx);
                    }
                }
                else if (type == "H")
                {
                    ProjectPfh project = toml as ProjectPfh;
                    // register the project
                    (UserQueries userQueries, TimedUserQueries timedUserQueries, ProjectStudentStruct ProjectCreate, TimedUserData timedUser) = await SaveProjectPfh(project, projectTable, userId, db, ctx, type, projectUrl, groupTable);

                    // link members to the project
                    if (toml.team.members.Length > 0)
                    {
                        await LinkMembersToProject(project, userQueries, timedUserQueries, ProjectCreate, timedUser, groupTable, ctx);
                    }
                }
            }
        }
Exemplo n.º 17
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public ProjectServerDBUtil(Desktop.common.nomitech.common.db.local.ProjectUrlTable paramProjectUrlTable, Desktop.common.nomitech.common.base.ProjectGroupCodesProviderFactory paramProjectGroupCodesProviderFactory) throws Exception
        public ProjectServerDBUtil(ProjectUrlTable paramProjectUrlTable, ProjectGroupCodesProviderFactory paramProjectGroupCodesProviderFactory)
        {
            if (configXML == null)
            {
                configXML = this.GetType().getResource("projectDB.xml");
                Console.WriteLine("xml is " + configXML);
            }
            this.o_overridenFactory = paramProjectGroupCodesProviderFactory;
            ProjectUrlId            = paramProjectUrlTable.ProjectUrlId;
            connectDB(paramProjectUrlTable);
        }
Exemplo n.º 18
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        //ORIGINAL LINE: public static ProjectFileDBUtil openProjectFromFile(java.io.File paramFile, Desktop.common.nomitech.common.db.local.ProjectUrlTable paramProjectUrlTable, Desktop.common.nomitech.common.base.ProjectGroupCodesProviderFactory paramProjectGroupCodesProviderFactory) throws Exception
        public static ProjectFileDBUtil openProjectFromFile(File paramFile, ProjectUrlTable paramProjectUrlTable, ProjectGroupCodesProviderFactory paramProjectGroupCodesProviderFactory)
        {
            ProjectFileDBUtil projectFileDBUtil = (ProjectFileDBUtil)s_utilInstanceMap[paramFile.AbsoluteFile + ";" + paramProjectUrlTable.Id];

            if (projectFileDBUtil == null)
            {
                projectFileDBUtil = new ProjectFileDBUtil(paramFile, paramProjectUrlTable, paramProjectGroupCodesProviderFactory);
                s_utilInstanceMap[projectFileDBUtil.UniqueId] = projectFileDBUtil;
                return(projectFileDBUtil);
            }
            throw new ProjectDBException();
        }
Exemplo n.º 19
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        //ORIGINAL LINE: public static ProjectDBUtil openProjectFromUrl(Desktop.common.nomitech.common.db.local.ProjectUrlTable paramProjectUrlTable, Desktop.common.nomitech.common.base.ProjectGroupCodesProviderFactory paramProjectGroupCodesProviderFactory) throws Exception
        public static ProjectDBUtil openProjectFromUrl(ProjectUrlTable paramProjectUrlTable, ProjectGroupCodesProviderFactory paramProjectGroupCodesProviderFactory)
        {
            if (paramProjectUrlTable.Dbms.Equals(Convert.ToInt32(CEP_FILE)))
            {
                return(openProjectFromFile(new File(paramProjectUrlTable.Url), paramProjectUrlTable, paramProjectGroupCodesProviderFactory));
            }
            ProjectServerDBUtil projectServerDBUtil = (ProjectServerDBUtil)s_utilInstanceMap[paramProjectUrlTable.Url + ";" + paramProjectUrlTable.Id];

            if (projectServerDBUtil == null || !projectServerDBUtil.DBLoaded)
            {
                projectServerDBUtil = new ProjectServerDBUtil(paramProjectUrlTable, paramProjectGroupCodesProviderFactory);
                s_utilInstanceMap[projectServerDBUtil.UniqueId] = projectServerDBUtil;
                return(projectServerDBUtil);
            }
            throw new ProjectDBException();
        }
Exemplo n.º 20
0
 private bool initialize(ProjectUrlTable paramProjectUrlTable1, ProjectUrlTable paramProjectUrlTable2)
 {
     this.sourceDbms = paramProjectUrlTable1.Dbms.Value;
     this.source     = paramProjectUrlTable1;
     this.destDbms   = paramProjectUrlTable2.Dbms.Value;
     this.dest       = paramProjectUrlTable2;
     if (this.helper == null)
     {
         this.helper = new ProjectDBSchemaHelper(this.source);
     }
     else
     {
         ((ProjectDBSchemaHelper)this.helper).UrlTable = paramProjectUrlTable1;
     }
     this.sourceConnection = null;
     this.destConnection   = null;
     return(true);
 }
Exemplo n.º 21
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private Desktop.common.nomitech.common.db.local.ProjectUrlTable connectDB(Desktop.common.nomitech.common.db.local.ProjectUrlTable paramProjectUrlTable) throws Exception
        private ProjectUrlTable connectDB(ProjectUrlTable paramProjectUrlTable)
        {
            initDriver(paramProjectUrlTable.Dbms.Value);
            if (paramProjectUrlTable.Dbms.Value == SQLSERVER_DBMS)
            {
                if (!(s_providerFactory is nomitech.ces.utils.DummyProjectGroupCodesProviderFactory))
                {
                    this.requiresAlters = checkRequiresAltering(paramProjectUrlTable);
                }
                else
                {
                    this.requiresAlters = true;
                }
            }
            this.o_urlTable = paramProjectUrlTable;
            loadDB();
            return(paramProjectUrlTable);
        }
Exemplo n.º 22
0
        public async Task <IActionResult> SubmitProject([FromBody] SubmitProjectModel project)
        {
            ProjectStudentTable projectTable = _stObjMap.StObjs.Obtain <ProjectStudentTable>();
            SqlDefaultDatabase  db           = _stObjMap.StObjs.Obtain <SqlDefaultDatabase>();
            CustomGroupTable    groupTable   = _stObjMap.StObjs.Obtain <CustomGroupTable>();
            ProjectUrlTable     projectUrl   = _stObjMap.StObjs.Obtain <ProjectUrlTable>();

            return(Ok(await TomlHelpers.TomlHelpers.RegisterProject(
                          project.Link,
                          project.ProjectType,
                          projectTable,
                          project.UserId,
                          db,
                          groupTable,
                          _stObjMap,
                          projectUrl
                          )));
        }
Exemplo n.º 23
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public ProjectFileDBUtil(java.io.File paramFile, Desktop.common.nomitech.common.db.local.ProjectUrlTable paramProjectUrlTable, Desktop.common.nomitech.common.base.ProjectGroupCodesProviderFactory paramProjectGroupCodesProviderFactory) throws Exception
        public ProjectFileDBUtil(File paramFile, ProjectUrlTable paramProjectUrlTable, ProjectGroupCodesProviderFactory paramProjectGroupCodesProviderFactory)
        {
            if (configXML == null)
            {
                configXML = this.GetType().getResource("projectDB.xml");
            }
            ProjectUrlId            = paramProjectUrlTable.ProjectUrlId;
            this.o_overridenFactory = paramProjectGroupCodesProviderFactory;
            this.urlTable           = paramProjectUrlTable;
            if (paramFile.exists())
            {
                this.o_openedFile = paramFile;
                extractDBFile(paramFile);
            }
            else
            {
                throw new Exception("project not found in path: " + paramFile.AbsolutePath);
            }
        }
Exemplo n.º 24
0
        public static ProjectInfoTable findProjectInfoFromUrl(ProjectUrlTable paramProjectUrlTable)
        {
            Query query = DatabaseDBUtil.currentSession().createQuery("select prjInfo from ProjectInfoTable as prjInfo join prjInfo.urlSet as urlTable with urlTable.projectUrlId = :urlid");

            query.setLong("urlid", paramProjectUrlTable.ProjectUrlId.Value);
            System.Collections.IEnumerator iterator = query.iterate();
            //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            if (!iterator.hasNext())
            {
                DatabaseDBUtil.closeSession();
                return(null);
            }
            //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            ProjectInfoTable projectInfoTable = (ProjectInfoTable)DatabaseDBUtil.currentSession().load(typeof(ProjectInfoTable), ((ProjectInfoTable)iterator.next()).Id);

            projectInfoTable = projectInfoTable.copyWithAssignments();
            DatabaseDBUtil.closeSession();
            return(projectInfoTable);
        }
Exemplo n.º 25
0
        public static ProjectUrlTable getUrlFromProperties(Properties paramProperties)
        {
            ProjectUrlTable projectUrlTable = new ProjectUrlTable();

            if (paramProperties.getProperty("project.connection.server") == null || paramProperties.getProperty("project.connection.server").Equals("false"))
            {
                projectUrlTable.Dbms = Convert.ToInt32(CEP_FILE);
                projectUrlTable.Url  = paramProperties.getProperty("project.init.file");
                projectUrlTable.CreatesNewDatabases = Convert.ToBoolean(true);
            }
            else
            {
                projectUrlTable.Dbms         = Convert.ToInt32((new int?(paramProperties.getProperty("project.connection.dbmsType"))));
                projectUrlTable.DbmsName     = paramProperties.getProperty("project.connection.dbmsName");
                projectUrlTable.Url          = paramProperties.getProperty("project.connection.url");
                projectUrlTable.Hostname     = paramProperties.getProperty("project.connection.hostname");
                projectUrlTable.Username     = paramProperties.getProperty("project.connection.username");
                projectUrlTable.Password     = paramProperties.getProperty("project.connection.password");
                projectUrlTable.Port         = paramProperties.getProperty("project.connection.port");
                projectUrlTable.DatabaseName = paramProperties.getProperty("project.connection.databaseName");
                if (paramProperties.getProperty("project.connection.singleProjectDatabase") == null || paramProperties.getProperty("project.connection.singleProjectDatabase").Equals("true"))
                {
                    projectUrlTable.CreatesNewDatabases = Convert.ToBoolean(true);
                }
                else
                {
                    projectUrlTable.CreatesNewDatabases = Convert.ToBoolean(false);
                }
            }
            if (paramProperties.containsKey("project.name"))
            {
                projectUrlTable.Name = paramProperties.getProperty("project.name");
            }
            if (paramProperties.containsKey("project.revision"))
            {
                projectUrlTable.Revision = paramProperties.getProperty("project.revision");
            }
            if (paramProperties.containsKey("project.description"))
            {
                projectUrlTable.Description = paramProperties.getProperty("project.description");
            }
            return(projectUrlTable);
        }
Exemplo n.º 26
0
 public static bool checkDatabaseExists(ProjectUrlTable paramProjectUrlTable)
 {
     if (paramProjectUrlTable.Dbms.Equals(Convert.ToInt32(CEP_FILE)))
     {
         return(Directory.Exists(paramProjectUrlTable.Url) || File.Exists(paramProjectUrlTable.Url));
     }
     try
     {
         initDriver(paramProjectUrlTable.Dbms.Value);
         string     str1       = CryptUtil.Instance.decryptHexString(paramProjectUrlTable.Username);
         string     str2       = AddOnUtil.Instance.decryptHexString(paramProjectUrlTable.Password);
         Connection connection = DriverManager.getConnection(paramProjectUrlTable.Url, str1, str2);
         connection.close();
     }
     catch (Exception)
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 27
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public ProjectServerDBUtil(Desktop.common.nomitech.common.db.local.ProjectUrlTable paramProjectUrlTable, java.util.Properties paramProperties) throws Exception
        public ProjectServerDBUtil(ProjectUrlTable paramProjectUrlTable, Properties paramProperties)
        {
            if (configXML == null)
            {
                configXML = this.GetType().getResource("projectDB.xml");
            }
            string str1  = paramProjectUrlTable.Hostname;
            string str2  = paramProjectUrlTable.Port;
            string str3  = paramProjectUrlTable.DatabaseName;
            int    i     = paramProjectUrlTable.Dbms.Value;
            string str4  = paramProjectUrlTable.DbmsName;
            string str5  = paramProjectUrlTable.Username;
            string str6  = paramProjectUrlTable.Password;
            string str7  = paramProjectUrlTable.Url;
            bool?  @bool = paramProjectUrlTable.CreatesNewDatabases;
            long?long = paramProjectUrlTable.ProjectUrlId;

            ProjectUrlId = long;
            makeNewDB(str1, str2, str3, str7, i, str4, str5, str6, paramProperties, @bool);
            this.requiresAlters = @bool.Value;
        }
Exemplo n.º 28
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static void moveDataNotSameInstanceAppendProjects(nomitech.common.ui.UIProgress paramUIProgress, nomitech.common.ProjectDBUtil paramProjectDBUtil1, nomitech.common.ProjectDBUtil paramProjectDBUtil2) throws Exception
        public static void moveDataNotSameInstanceAppendProjects(UIProgress paramUIProgress, ProjectDBUtil paramProjectDBUtil1, ProjectDBUtil paramProjectDBUtil2)
        {
            ProjectUrlTable projectUrlTable = paramProjectDBUtil2.ProjectUrl;

            if (projectUrlTable.ProjectUrlId == null)
            {
                projectUrlTable.ProjectUrlId = Convert.ToInt64(DateTimeHelper.CurrentUnixTimeMillis());
            }
            ProjectDBDataMover projectDBDataMover = new ProjectDBDataMover(paramUIProgress, paramProjectDBUtil1.ProjectUrl, paramProjectDBUtil2.ProjectUrl);

            if (paramProjectDBUtil1 is nomitech.common.ProjectFileDBUtil)
            {
                projectDBDataMover.sourceConnection            = paramProjectDBUtil1.createJdbcConnection();
                projectDBDataMover.sourceConnection.AutoCommit = false;
            }
            if (paramProjectDBUtil2 is nomitech.common.ProjectFileDBUtil)
            {
                projectDBDataMover.destConnection            = paramProjectDBUtil2.createJdbcConnection();
                projectDBDataMover.destConnection.AutoCommit = false;
            }
            projectDBDataMover.moveDataNotSameInstanceAppendProjects();
        }
Exemplo n.º 29
0
        public static void dropUrl(ProjectUrlTable paramProjectUrlTable)
        {
            if (paramProjectUrlTable.CreatesNewDatabases != null && !paramProjectUrlTable.CreatesNewDatabases.Value)
            {
                return;
            }
            if (paramProjectUrlTable.Dbms.Equals(Convert.ToInt32(CEP_FILE)))
            {
                File file = new File(paramProjectUrlTable.Url);
                if (file.exists())
                {
                    file.delete();
                }
                return;
            }
            string str1 = null;
            string str2 = null;

            if (paramProjectUrlTable.Dbms.Equals(Convert.ToInt32(MYSQL_DBMS)))
            {
                str1 = "DROP DATABASE " + paramProjectUrlTable.DatabaseName;
                str2 = "mysql";
            }
            else if (paramProjectUrlTable.Dbms.Equals(Convert.ToInt32(SQLSERVER_DBMS)))
            {
                str1 = "DROP DATABASE " + paramProjectUrlTable.DatabaseName;
                str2 = "master";
            }
            else if (paramProjectUrlTable.Dbms.Equals(Convert.ToInt32(ORACLE_DBMS)))
            {
                str1 = "DROP DATABASE " + paramProjectUrlTable.DatabaseName;
                str2 = "sys";
            }
            Connection connection = null;
            Statement  statement  = null;

            try
            {
                initDriver(paramProjectUrlTable.Dbms.Value);
                string str = createJdbcUrl(paramProjectUrlTable.Hostname, str2, paramProjectUrlTable.Port, paramProjectUrlTable.Dbms.Value);
                try
                {
                    string str3 = CryptUtil.Instance.decryptHexString(paramProjectUrlTable.Username);
                    string str4 = AddOnUtil.Instance.decryptHexString(paramProjectUrlTable.Password);
                    connection = DriverManager.getConnection(str, str3, str4);
                    statement  = connection.createStatement();
                }
                catch (Exception)
                {
                    str        = createJdbcUrl(paramProjectUrlTable.Hostname, "CostOS", paramProjectUrlTable.Port, paramProjectUrlTable.Dbms.Value);
                    connection = DriverManager.getConnection(str, paramProjectUrlTable.Username, paramProjectUrlTable.Password);
                    statement  = connection.createStatement();
                }
                if (paramProjectUrlTable.Dbms.Equals(Convert.ToInt32(SQLSERVER_DBMS)))
                {
                    statement.executeUpdate("ALTER DATABASE " + paramProjectUrlTable.DatabaseName + " SET SINGLE_USER WITH ROLLBACK IMMEDIATE");
                }
                statement.executeUpdate(str1);
                statement.close();
                connection.close();
                Console.WriteLine("SUCCESSFULLY DROPPED: " + paramProjectUrlTable.DatabaseName);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
                if (statement != null)
                {
                    try
                    {
                        statement.close();
                    }
                    catch (SQLException sQLException)
                    {
                        Console.WriteLine(sQLException.ToString());
                        Console.Write(sQLException.StackTrace);
                    }
                }
                if (connection != null)
                {
                    try
                    {
                        connection.close();
                    }
                    catch (SQLException sQLException)
                    {
                        Console.WriteLine(sQLException.ToString());
                        Console.Write(sQLException.StackTrace);
                    }
                }
            }
        }
Exemplo n.º 30
0
        public static void deleteProjectData(UIProgress paramUIProgress, ProjectUrlTable paramProjectUrlTable)
        {
            ProjectDBDataDeleter projectDBDataDeleter = new ProjectDBDataDeleter(paramUIProgress, paramProjectUrlTable);

            projectDBDataDeleter.deleteProjectData();
        }