Ejemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void toXML(ProjectDBUtil paramProjectDBUtil, java.io.File paramFile) throws Exception
        public virtual void toXML(ProjectDBUtil paramProjectDBUtil, File paramFile)
        {
            StreamWriter fileWriter  = new StreamWriter(paramFile);
            Session      session     = paramProjectDBUtil.currentSession();
            Transaction  transaction = session.beginTransaction();

            try
            {
                System.Collections.IEnumerator iterator = session.createQuery("from BoqItemTable as o where o.projectId = :prjId order by boqitemId asc").setLong("prjId", paramProjectDBUtil.ProjectUrlId.Value).iterate();
                while (iterator.MoveNext())
                {
                    this.o_xStream.toXML(((BoqItemTable)iterator.Current).deepCopy(false), fileWriter);
                }
                fileWriter.Flush();
                fileWriter.Close();
                transaction.commit();
            }
            catch (Exception exception)
            {
                transaction.rollback();
                paramProjectDBUtil.closeSession();
                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
                throw exception;
            }
            paramProjectDBUtil.closeSession();
        }
Ejemplo n.º 2
0
 public ProjectDBProperties(ProjectDBUtil paramProjectDBUtil, bool paramBoolean)
 {
     createDBProperties();
     this.o_prjDBUtil = paramProjectDBUtil;
     if (paramBoolean)
     {
         reloadProperties();
     }
 }
Ejemplo n.º 3
0
 public static void closeAllProjects()
 {
     System.Collections.IEnumerator iterator = s_utilInstanceMap.Keys.GetEnumerator();
     while (iterator.MoveNext())
     {
         ProjectDBUtil projectDBUtil = (ProjectDBUtil)s_utilInstanceMap[iterator.Current];
         projectDBUtil.closeProject();
     }
     s_utilInstanceMap.Clear();
 }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public CostOSBimEngineFileDBUtil(String paramString) throws Exception
        public CostOSBimEngineFileDBUtil(string paramString)
        {
            initSessionFactory();
            this.projectFolder = paramString;
            string str = "jdbc:hsqldb:" + paramString + "/modelDB;shutdown=true";

            ProjectDBUtil.initDriver(ProjectDBUtil.HSQL_DBMS);
            this.connectionProperties = new Properties();
            this.connectionProperties.setProperty("user", "SA");
            this.connectionProperties.setProperty("password", "");
            this.connectionProperties.setProperty("shutdown", "true");
            this.schemaUpdateProperties = new Properties();
            this.schemaUpdateProperties.setProperty("hibernate.dialect", "Desktop.common.nomitech.common.db.dialect.HSQLDialect");
            this.schemaUpdateProperties.setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver");
            this.schemaUpdateProperties.setProperty("hibernate.connection.url", str);
            this.schemaUpdateProperties.setProperty("hibernate.connection.username", "SA");
            this.schemaUpdateProperties.setProperty("hibernate.connection.password", "");
            HSQLSchemaUpdate hSQLSchemaUpdate = new HSQLSchemaUpdate(configuration, this.schemaUpdateProperties);

            hSQLSchemaUpdate.execute(true, true);
            this.connection = DriverManager.getConnection(str, this.connectionProperties);
        }
Ejemplo n.º 5
0
        public ProjectDBProperties(ProjectDBUtil paramProjectDBUtil, string paramString)
        {
            this.o_prjDBUtil = paramProjectDBUtil;
            File file = new File(paramString);

            if (file.File)
            {
                try
                {
                    loadDBProperties(new FileStream(file, FileMode.Open, FileAccess.Read));
                    storeDBProperties();
                }
                catch (Exception)
                {
                    createDBProperties();
                    try
                    {
                        storeDBProperties();
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            else
            {
                createDBProperties();
                try
                {
                    storeDBProperties();
                }
                catch (Exception)
                {
                }
            }
        }
Ejemplo n.º 6
0
 public virtual decimal getCustomFuelPrice(EquipmentTable paramEquipmentTable)
 {
     if (paramEquipmentTable.FuelType.Equals(this.DIESEL_PRICE_KEY))
     {
         string str = ProjectDBUtil.currentProjectDBUtil().Properties.getProperty("project.diesel.price");
         return(new BigDecimalFixed(str));
     }
     if (paramEquipmentTable.FuelType.Equals(this.OTHER_PRICE_KEY))
     {
         string str = ProjectDBUtil.currentProjectDBUtil().Properties.getProperty("project.other.energy.price");
         return(new BigDecimalFixed(str));
     }
     if (paramEquipmentTable.FuelType.Equals(this.ELECTRIC_PRICE_KEY))
     {
         string str = ProjectDBUtil.currentProjectDBUtil().Properties.getProperty("project.electricity.price");
         return(new BigDecimalFixed(str));
     }
     if (paramEquipmentTable.FuelType.Equals(this.PETROL_PRICE_KEY))
     {
         string str = ProjectDBUtil.currentProjectDBUtil().Properties.getProperty("project.petrol.price");
         return(new BigDecimalFixed(str));
     }
     return(null);
 }
Ejemplo n.º 7
0
 public PropertyAnonymousInnerClass(ProjectDBUtil outerInstance)
 {
     this.outerInstance = outerInstance;
     lType = new LongType();
 }
Ejemplo n.º 8
0
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
 //ORIGINAL LINE: public static void closeProject(ProjectDBUtil paramProjectDBUtil) throws Exception
 public static void closeProject(ProjectDBUtil paramProjectDBUtil)
 {
     paramProjectDBUtil.closeProject();
     s_utilInstanceMap.Remove(paramProjectDBUtil.UniqueId);
 }
Ejemplo n.º 9
0
 public virtual bool hasCustomFuelPrices()
 {
     return((ProjectDBUtil.currentProjectDBUtil() != null) ? ProjectDBUtil.currentProjectDBUtil().Properties.getBooleanProperty("project.energy.prices.use") : 0);
 }
Ejemplo n.º 10
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void loadDB() throws Exception
        public override void loadDB()
        {
            if (DBLoaded)
            {
                return;
            }
            if (syncToEventDispatch && !SwingUtilities.EventDispatchThread)
            {
                this.o_retException = null;
                SwingUtilities.invokeAndWait(new RunnableAnonymousInnerClass(this));
                if (this.o_retException != null)
                {
                    throw this.o_retException;
                }
                return;
            }
            if (this.o_properties != null && !string.ReferenceEquals(this.o_properties.PreviousVersion, null))
            {
                if (this.o_properties.isOlderVersionFrom(this.o_properties.PreviousVersion, "4.0.1"))
                {
                    Console.WriteLine("Deleting indexes prior to 4.0.1 from version " + this.o_properties.PreviousVersion);
                    try
                    {
                        Console.WriteLine("deleting: " + new File(installDir + "project/" + this.o_projectFolderName + "/indexBase"));
                        deleteDirectory(new File(installDir + "project/" + this.o_projectFolderName + "/indexBase"));
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception.ToString());
                        Console.Write(exception.StackTrace);
                    }
                }
                if (this.o_properties.isOlderVersionFrom(this.o_properties.PreviousVersion, "4.2.7"))
                {
                    Properties properties = new Properties();
                    properties.setProperty("user", "SA");
                    properties.setProperty("password", "");
                    properties.setProperty("shutdown", "true");
                    initDriver(HSQL_DBMS);
                    Connection connection = DriverManager.getConnection("jdbc:hsqldb:" + installDir + "project/" + this.o_projectFolderName + "/projectDB", properties);
                    if (!connection.AutoCommit)
                    {
                        connection.commit();
                    }
                    Statement statement = connection.createStatement();
                    try
                    {
                        Console.WriteLine("Renaming the Condition Table to CNDON...");
                        statement.execute("DROP TABLE IF EXISTS CNDON");
                        statement.execute("ALTER TABLE CONDITION RENAME TO CNDON");
                        Console.WriteLine("OK!");
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception.ToString());
                        Console.Write(exception.StackTrace);
                        Console.WriteLine("TABLE WITH NAME CONDITION NOT FOUND!");
                    }
                    statement.close();
                    connection.close();
                }
                if (this.o_properties.isOlderVersionFrom(this.o_properties.PreviousVersion, "4.6.0"))
                {
                    Properties properties = new Properties();
                    properties.setProperty("user", "SA");
                    properties.setProperty("password", "");
                    properties.setProperty("shutdown", "true");
                    initDriver(HSQL_DBMS);
                    Connection connection = DriverManager.getConnection("jdbc:hsqldb:" + installDir + "project/" + this.o_projectFolderName + "/projectDB", properties);
                    if (!connection.AutoCommit)
                    {
                        connection.commit();
                    }
                    Statement statement = connection.createStatement();
                    try
                    {
                        Console.WriteLine("Updating data integrity...");
                        statement.execute("ALTER TABLE BOQITEM ALTER COLUMN DESCRIPTION LONGVARCHAR");
                        statement.execute("ALTER TABLE BOQITEM ALTER COLUMN NOTES LONGVARCHAR");
                        statement.execute("ALTER TABLE EQUIPMENT ALTER COLUMN DESCRIPTION LONGVARCHAR");
                        statement.execute("ALTER TABLE EQUIPMENT ALTER COLUMN NOTES LONGVARCHAR");
                        statement.execute("ALTER TABLE ASSEMBLY ALTER COLUMN DESCRIPTION LONGVARCHAR");
                        statement.execute("ALTER TABLE ASSEMBLY ALTER COLUMN NOTES LONGVARCHAR");
                        statement.execute("ALTER TABLE MATERIAL ALTER COLUMN DESCRIPTION LONGVARCHAR");
                        statement.execute("ALTER TABLE MATERIAL ALTER COLUMN NOTES LONGVARCHAR");
                        statement.execute("ALTER TABLE SUBCONTRACTOR ALTER COLUMN DESCRIPTION LONGVARCHAR");
                        statement.execute("ALTER TABLE SUBCONTRACTOR ALTER COLUMN NOTES LONGVARCHAR");
                        statement.execute("ALTER TABLE QUOTEITEM ALTER COLUMN TITLE LONGVARCHAR");
                        Console.WriteLine("OK!");
                    }
                    catch (Exception)
                    {
                    }
                    statement.close();
                    connection.close();
                }
            }
            closeSession();
            this.o_configuration = new Configuration();
            this.o_configuration.configure(configXML);
            ISet <object> set = this.o_configuration.Properties.Keys;

            string[] arrayOfString = (string[])set.toArray(new string[set.Count]);
            foreach (string str in arrayOfString)
            {
                if (str.IndexOf("search.default", StringComparison.Ordinal) != -1)
                {
                    this.o_configuration.Properties.remove(str);
                }
            }
            this.o_configuration.setProperty("hibernate.connection.isolation", "1");
            this.o_configuration.setProperty("hibernate.cache.jdbc.batch_size", "50");
            this.o_configuration.setProperty("hibernate.cache.use_second_level_cache", "false");
            this.o_configuration.setProperty("hibernate.cache.use_query_cache", "false");
            this.o_configuration.setProperty("hibernate.cache.provider_class", "org.hibernate.cache.NoCacheProvider");
            this.o_configuration.setProperty("hibernate.search.indexing_strategy", "manual");
            this.o_configuration.setProperty("hibernate.search.autoregister_listeners", "false");
            this.o_configuration.setProperty("hibernate.temp.use_jdbc_metadata_defaults", "false");
            this.o_configuration.registerTypeOverride(new CostOSString256Type(), new string[] { "costos_string" });
            this.o_configuration.registerTypeOverride(new CostOSTextType());
            this.o_configuration.registerTypeOverride(new UnitAliasType(ProjectGroupCodesProvider, "unit_alias"));
            for (sbyte b = 1; b <= 9; b++)
            {
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)10, b, "eps_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-1, b, "wbs1_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-2, b, "wbs2_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-3, b, "location_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-4, b, "paramitem_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)10, b, "eps_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-1, b, "wbs1_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-2, b, "wbs2_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-3, b, "location_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-4, b, "paramitem_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-1, b, "wbs1_level" + b + "_item_code", (short)5));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-2, b, "wbs2_level" + b + "_item_code", (short)5));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-1, b, "wbs1_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-2, b, "wbs2_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-1, b, "wbs1_level" + b + "_qty", (short)6));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-2, b, "wbs2_level" + b + "_qty", (short)6));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)1, b, "groupcode1_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)2, b, "groupcode2_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)3, b, "groupcode3_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)4, b, "groupcode4_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)5, b, "groupcode5_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)6, b, "groupcode6_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)7, b, "groupcode7_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)8, b, "groupcode8_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)9, b, "groupcode9_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)1, b, "groupcode1_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)2, b, "groupcode2_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)3, b, "groupcode3_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)4, b, "groupcode4_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)5, b, "groupcode5_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)6, b, "groupcode6_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)7, b, "groupcode7_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)8, b, "groupcode8_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)9, b, "groupcode9_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)1, b, "groupcode1_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)2, b, "groupcode2_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)3, b, "groupcode3_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)4, b, "groupcode4_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)5, b, "groupcode5_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)6, b, "groupcode6_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)7, b, "groupcode7_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)8, b, "groupcode8_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)9, b, "groupcode9_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)1, b, "groupcode1_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)2, b, "groupcode2_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)3, b, "groupcode3_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)4, b, "groupcode4_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)5, b, "groupcode5_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)6, b, "groupcode6_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)7, b, "groupcode7_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)8, b, "groupcode8_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)9, b, "groupcode9_level" + b + "_unit", (short)4));
            }
            this.o_configuration.setListener("post-update", null);
            this.o_configuration.setListener("post-insert", null);
            this.o_configuration.setListener("post-delete", null);
            this.o_configuration.setProperty("hibernate.connection.url", "jdbc:hsqldb:" + installDir + "project/" + this.o_projectFolderName + "/projectDB;hsqldb.write_delay=false");
            this.o_sessionFactory = this.o_configuration.buildSessionFactory();
            Session session = currentSession();

            if (ProjectSchemaUpdateUtil.checkRequiresProjectIdUpdates(this))
            {
                ProjectSchemaUpdateUtil.processProjectIdUpdates(this);
            }
            closeSession();
            ProjectDBUtil projectDBUtil;

            (projectDBUtil = ProjectDBUtil.currentProjectDBUtil()).CurrentProjectDBUtil = this;
            File file = new File(installDir + "project" + File.separator + this.o_projectFolderName + File.separator + "projectDB.details");

            if (!file.exists())
            {
                this.b_isDBLoaded = true;
                if (this.o_properties == null)
                {
                    this.o_properties = new ProjectDBProperties(this, true);
                }
                else
                {
                    this.o_properties.reloadProperties();
                }
                if (!string.ReferenceEquals(this.o_properties.PreviousVersion, null))
                {
                    updateNewerDatabase();
                }
                ProjectGroupCodesProvider.initializeProjectCaches();
            }
            ProjectDBUtil.CurrentProjectDBUtil = projectDBUtil;
        }
Ejemplo n.º 11
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void loadDB() throws Exception
        public override void loadDB()
        {
            if (DBLoaded)
            {
                return;
            }
            if (syncToEventDispatch && !SwingUtilities.EventDispatchThread)
            {
                this.o_retException = null;
                loadDB();
                SwingUtilities.invokeAndWait(new RunnableAnonymousInnerClass(this));
                if (this.o_retException != null)
                {
                    throw this.o_retException;
                }
                return;
            }
            closeSession();
            this.dbmsType = this.o_urlTable.Dbms.Value;
            if (this.requiresAlters)
            {
                this.o_configuration = ProjectSessionFactoryBuilder.Instance.createConfigurationFromUrl(configXML, this.o_urlTable, ProjectGroupCodesProvider, this.requiresAlters, this.o_urlTable.TablePrefix);
                long l = DateTimeHelper.CurrentUnixTimeMillis();
                Console.WriteLine("  BUILDING SESSION FACTORY...");
                this.o_sessionFactory = this.o_configuration.buildSessionFactory();
                Console.WriteLine("DONE IN: " + ((DateTimeHelper.CurrentUnixTimeMillis() - l) / 1000L));
            }
            else
            {
                if (ProjectSessionFactory.GroupCodesProvider == null)
                {
                    ProjectSessionFactory.UpGroupCodesProvider = s_providerFactory.createSharedFactory();
                }
                this.sharedGroupCodesProvider = (ProjectGroupCodesProvider)ProjectSessionFactory.GroupCodesProvider;
                long l = DateTimeHelper.CurrentUnixTimeMillis();
                Console.WriteLine("  GETTING SESSION FACTORY...");
                this.o_configuration  = ProjectSessionFactory.getConfiguration(this.dbmsType);
                this.o_sessionFactory = ProjectSessionFactory.getSessionFactory(this.dbmsType);
                Console.WriteLine("DONE IN: " + ((DateTimeHelper.CurrentUnixTimeMillis() - l) / 1000L));
            }
            currentSession();
            closeSession();
            this.b_isDBLoaded = true;
            ProjectDBUtil projectDBUtil;

            (projectDBUtil = ProjectDBUtil.currentProjectDBUtil()).CurrentProjectDBUtil = this;
            if (this.o_properties == null)
            {
                this.o_properties = new ProjectDBProperties(this, true);
            }
            else
            {
                this.o_properties.reloadProperties();
            }
            if (!string.ReferenceEquals(this.o_properties.PreviousVersion, null) && this.requiresAlters && !(s_providerFactory is nomitech.ces.utils.DummyProjectGroupCodesProviderFactory))
            {
                updateNewerDatabase();
            }
            if (this.sharedGroupCodesProvider == null)
            {
                ProjectGroupCodesProvider.initializeProjectCaches();
            }
            else
            {
                ((WBSCache)Wbs1Cache).initCache();
                ((WBS2Cache)Wbs2Cache).initCache();
                try
                {
                    ((ParamItemCache)ParamItemCache).initializeCache();
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception.ToString());
                    Console.Write(exception.StackTrace);
                }
            }
            ProjectVariableCache.initCache();
            ProjectDBUtil.CurrentProjectDBUtil = projectDBUtil;
        }
Ejemplo n.º 12
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private Desktop.common.nomitech.common.db.local.ProjectUrlTable makeNewDB(String paramString1, String paramString2, String paramString3, String paramString4, int paramInt, String paramString5, String paramString6, String paramString7, java.util.Properties paramProperties, System.Nullable<bool> paramBoolean) throws Exception
        private ProjectUrlTable makeNewDB(string paramString1, string paramString2, string paramString3, string paramString4, int paramInt, string paramString5, string paramString6, string paramString7, Properties paramProperties, bool?paramBoolean)
        {
            initDriver(paramInt);
            this.dbmsType = paramInt;
            string str1 = CryptUtil.Instance.decryptHexString(paramString6);
            string str2 = AddOnUtil.Instance.decryptHexString(paramString7);

            if (!StringUtils.isNullOrBlank(paramString5) && (paramBoolean == null || paramBoolean.Value == true))
            {
                string str3 = null;
                string str4 = null;
                if (paramInt == ProjectDBUtil.MYSQL_DBMS)
                {
                    str3 = "CREATE DATABASE " + paramString3;
                    str4 = "mysql";
                }
                else if (paramInt == ProjectDBUtil.SQLSERVER_DBMS)
                {
                    paramInt = ProjectDBUtil.SQLSERVER_DBMS;
                    str3     = "CREATE DATABASE " + paramString3;
                    str4     = "master";
                }
                else if (paramInt == ProjectDBUtil.ORACLE_DBMS)
                {
                    paramInt = ProjectDBUtil.ORACLE_DBMS;
                    str3     = "CREATE DATABASE " + paramString3;
                    str4     = "sys";
                }
                string     str5       = createJdbcUrl(paramString1, str4, paramString2, paramInt);
                Connection connection = null;
                Statement  statement  = null;
                try
                {
                    connection = DriverManager.getConnection(str5, str1, str2);
                    statement  = connection.createStatement();
                }
                catch (Exception)
                {
                    str5       = ProjectDBUtil.createJdbcUrl(paramString1, "CostOS", paramString2, paramInt);
                    connection = DriverManager.getConnection(str5, str1, str2);
                    statement  = connection.createStatement();
                }
                try
                {
                    statement.executeUpdate(str3);
                }
                catch (Exception exception)
                {
                    if (exception.Message.IndexOf("exists") == -1)
                    {
                        Console.WriteLine(exception.ToString());
                        Console.Write(exception.StackTrace);
                        statement.close();
                        connection.close();
                        throw exception;
                    }
                }
                statement.close();
                connection.close();
            }
            else
            {
                Connection connection = DriverManager.getConnection(paramString4, str1, str2);
                if (!connection.AutoCommit)
                {
                    connection.commit();
                }
                connection.close();
            }
            this.o_properties = new ProjectDBProperties(this, false);
            if (paramProperties != null)
            {
                this.o_properties.Properties = paramProperties;
            }
            this.o_urlTable                     = new ProjectUrlTable();
            this.o_urlTable.Hostname            = paramString1;
            this.o_urlTable.Port                = paramString2;
            this.o_urlTable.Dbms                = Convert.ToInt32(paramInt);
            this.o_urlTable.Username            = paramString6;
            this.o_urlTable.Password            = paramString7;
            this.o_urlTable.DbmsName            = paramString5;
            this.o_urlTable.Url                 = paramString4;
            this.o_urlTable.DatabaseName        = paramString3;
            this.o_urlTable.CreateDate          = DateTime.Now;
            this.o_urlTable.CreateUserId        = DatabaseDBUtil.Properties.UserId;
            this.o_urlTable.LastUpdate          = this.o_urlTable.CreateDate;
            this.o_urlTable.CreateUserId        = this.o_urlTable.CreateUserId;
            this.o_urlTable.Frozen              = false;
            this.o_urlTable.CreatesNewDatabases = paramBoolean;
            return(this.o_urlTable);
        }
Ejemplo n.º 13
0
 public ProjectDBInterceptor(ProjectDBUtil paramProjectDBUtil)
 {
     this.prjDBUtil = paramProjectDBUtil;
 }