Exemplo n.º 1
0
        public EAP_STATUS createNewStdDatabase(String aDataBaseName)
        {
            EAP_STATUS status = EAP_STATUS.OK;

            status = this.createNewEmptyDatabase(aDataBaseName);
            if (EAP_STATUS.OK == status)
            {
                //status = this.populateStdWPTypesTable();
                cEAPWSProjectTypesTable projectTypesTable = new cEAPWSProjectTypesTable(m_DatabaseConnection);
                status = projectTypesTable.stdPopulateTable();
            }
            if (EAP_STATUS.OK == status)
            {
                //status = this.populateStdCompetenceTypesTable();
                cEAPWSCompetenceTypesTable competenceTypesTable = new cEAPWSCompetenceTypesTable(m_DatabaseConnection);
                status = competenceTypesTable.stdPopulateTable();
            }

            if (EAP_STATUS.OK == status)
            {
                //status = this.populateStdEndTimeTables();
            }
            return(status);
        }
Exemplo n.º 2
0
        public EAP_STATUS createNewEmptyDatabase(String aDataBaseName)
        {
            try
            {
                string connString = "Server=" + m_server + ";user="******";port=" + m_port + ";password="******"Connecting to MySQL...");
                    this.m_DatabaseConnection.Open();
                    //*** Drop database if it already exist
                    MySqlCommand cmd = this.m_DatabaseConnection.CreateCommand();
                    cmd.CommandText = "DROP DATABASE IF EXISTS " + aDataBaseName;
                    Console.WriteLine("Droping database " + aDataBaseName + "if it exist");
                    cmd.ExecuteNonQuery();
                    //*** Create New database if it not exist
                    cmd.CommandText = "CREATE DATABASE IF NOT EXISTS " + aDataBaseName;
                    Console.WriteLine("Creating database " + aDataBaseName + "if it not exist");
                    cmd.ExecuteNonQuery();
                    m_database = aDataBaseName;
                    //*** Close connection to server
                    Console.WriteLine("Closinng connection to SQL server");
                    m_DatabaseConnection.Close();
                    //*** Connect to the newly created database
                    connString = "Server=" + m_server + ";database=" + m_database + ";user="******";port=" + m_port + ";password="******"Connecting to MySQL Database " + m_database);
                    this.m_DatabaseConnection.Open();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
                cEAPWSProjectTypesTable projectTypesTable = new cEAPWSProjectTypesTable(m_DatabaseConnection);
                projectTypesTable.createTable();

                cEAPWSCompetenceTypesTable competenceTypesTable = new cEAPWSCompetenceTypesTable(m_DatabaseConnection);
                competenceTypesTable.createTable();

                cEAPWSWPTable wpTable = new cEAPWSWPTable(m_DatabaseConnection);
                wpTable.createTable();

                cEAPWSEstTimePeriodTable estTimePeriodTable = new cEAPWSEstTimePeriodTable(m_DatabaseConnection);
                estTimePeriodTable.createTable();

                cEAPWSJobsTable jobsTable = new cEAPWSJobsTable(m_DatabaseConnection);
                jobsTable.createTable();

                cEAPWSEstTimesTable estTimesTable = new cEAPWSEstTimesTable(m_DatabaseConnection);
                estTimesTable.createTable();

                cEAPWSCalenderTable calenderTable = new cEAPWSCalenderTable(m_DatabaseConnection);
                calenderTable.createTable();

                cEAPWSCalenderItemTable calenderItemTable = new cEAPWSCalenderItemTable(m_DatabaseConnection);
                calenderItemTable.createTable();

                cEAPWSNewestEstView newestEstView = new cEAPWSNewestEstView(m_DatabaseConnection);
                newestEstView.createView();

                cEAPWSJobEstView jobEstView = new cEAPWSJobEstView(m_DatabaseConnection);
                jobEstView.createView();

                cEAPWSWPJobEstView wpJobEstView = new cEAPWSWPJobEstView(m_DatabaseConnection);
                wpJobEstView.createView();

                cEAPWSNewestWPJobEstView newestWPJobEstView = new cEAPWSNewestWPJobEstView(m_DatabaseConnection);
                newestWPJobEstView.createView();

                cEAPWSCalenderedNewestWPJobEstView caledNewestWPJobEstView = new cEAPWSCalenderedNewestWPJobEstView(m_DatabaseConnection);
                caledNewestWPJobEstView.createView();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            return(EAP_STATUS.OK);
        }