コード例 #1
0
ファイル: PaginaInicial.cs プロジェクト: ITICH/sad
        //string utilizadorLogadopw = Login.dadosLoginPwd;

        private void PaginaInicial_Load(object sender, EventArgs e)
        {
            //string queryADM = "SELECT perfil FROM Empresa WHERE perfil = 1";//AINDA NÃO FUNCIONA CORRETAMENTE POR CAUSA DA ENCRIPTAÇÃO
            string    queryADM        = "SELECT e_mail, perfil FROM Empresa WHERE e_mail='" + utilizadorLogado + "' AND perfil = 1";//AINDA NÃO FUNCIONA CORRETAMENTE POR CAUSA DA ENCRIPTAÇÃO
            DataTable dadosUtilizador = ConecaoSQLServer.ExecutaSql(queryADM);

            if (dadosUtilizador.Rows.Count > 0)
            {
                //button_addParque.Enabled = true;
                button_addParque.Visible = true;
            }
            else
            {
                //button_addParque.Enabled = false;
                button_addParque.Visible = false;
            }
            //mostra o nome da empresa
            string    queryNomeUser  = "******" + utilizadorLogadoId + "'";
            DataTable nomeUtilizador = ConecaoSQLServer.ExecutaSql(queryNomeUser);

            label_nomeEmpresa.Text = nomeUtilizador.Rows[0][0].ToString();

            //verifica que o utilizador é ADM para mostrar o botão do form ValidarContas
            string    queryUserADM = "SELECT perfil FROM Empresa WHERE id_empresa = '" + utilizadorLogadoId + "';";
            DataTable perfilUser   = ConecaoBD.ConecaoSQLServer.ExecutaSql(queryUserADM);

            if (Int32.Parse(perfilUser.Rows[0][0].ToString()).Equals(1))
            {
                button_ValidarContas.Visible = true;
            }
        }
コード例 #2
0
ファイル: RegistoForm.cs プロジェクト: ITICH/sad
        //Override do metodo Refresh
        public override void Refresh()
        {
            this.Enabled       = false;
            comboBox_Area.Text = "Selecione Área...";
            comboBox_Area.Items.Clear();
            dataTable = ConecaoSQLServer.ExecutaSql("SELECT * FROM Nome_area");
            foundRows = dataTable.Select();
            for (int i = 0; i < foundRows.Length; i++)
            {
                comboBox_Area.Items.Add(foundRows[i][1].ToString());
            }
            foreach (string item in areas)
            {
                comboBox_Area.Items.Remove(item);
            }

            comboBox_Dominio.Text = "Selecione Domínio...";
            comboBox_Dominio.Items.Clear();
            dataTable = ConecaoSQLServer.ExecutaSql("SELECT * FROM Nome_dominio");
            foundRows = dataTable.Select();
            for (int i = 0; i < foundRows.Length; i++)
            {
                comboBox_Dominio.Items.Add(foundRows[i][1].ToString());
            }
            foreach (string item in dominios)
            {
                comboBox_Dominio.Items.Remove(item);
            }


            base.Refresh();
            this.Enabled = true;
        }
コード例 #3
0
ファイル: tab1.cs プロジェクト: ITICH/sad
        private void dadosGraficos(string sql, int i)
        {
            DataTable dt = ConecaoSQLServer.ExecutaSql(sql);

            if (i == 1)
            {
                chart1.DataSource = dt;
                chart1.Series["Volume"].ChartType           = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedColumn;
                chart1.Series["Volume"].XValueMember        = "nome_parque";
                chart1.Series["Volume"].YValueMembers       = "patrimonio_acossiativo_e_capital_social";
                chart1.Series["Volume"].IsValueShownAsLabel = true;
                chart1.DataBind();
            }
            else if (i == 2)
            {
                // chart_fDesenvolvimento.Series["Area"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedColumn;
                chart_fDesenvolvimento.Series["Areas"].XValueMember  = "nome_area";
                chart_fDesenvolvimento.Series["Areas"].YValueMembers = "total";
                //chart1.Series["Volume"].IsValueShownAsLabel = true;
                chart_fDesenvolvimento.DataSource = dt;
                chart_fDesenvolvimento.DataBind();
            }
            else
            {
                // chart_fDesenvolvimento.Series["Area"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedColumn;
                chart_fases.Series["Fases"].XValueMember  = "nome_fase";
                chart_fases.Series["Fases"].YValueMembers = "fases";
                //chart1.Series["Volume"].IsValueShownAsLabel = true;
                chart_fases.DataSource = dt;
                chart_fases.DataBind();
            }

            /*string[] x = new string[dt.Rows.Count];
             * int[] y = new int[dt.Rows.Count];
             *
             * for(int i = 0; i < dt.Rows.Count; i++)
             * {
             *  x[i] = dt.Rows[i][0].ToString();
             *  y[i] = Convert.ToInt32(dt.Rows[i][1]);
             * }
             * chart1.Series[0].Points.DataBindXY(x, y);*/


            /*int i = 0;
             * foreach (DataRow dr in dt.Rows)
             * {
             *  //string res = dr["nome_parque"].ToString();
             *  //string res2 = dr["patrimonio_acossiativo_e_capital_social"].ToString();
             *
             *  this.chart1.DataSource = dt.Rows[i];
             *  this.chart1.Series["Volume"].XValueMember = "nome_parque";
             *  this.chart1.Series["Volume"].YValueMembers = "patrimonio_acossiativo_e_capital_social";
             *  //this.chart1.Series["Volume"].IsValueShownAsLabel = true;
             *  this.chart1.DataBind();
             *  i+=1;
             * }*/
        }
コード例 #4
0
ファイル: Registo.cs プロジェクト: ITICH/sad
        private void button_registar_Click(object sender, EventArgs e)
        {
            //Chama metodo para encriptar a pwd
            string pwdEncriptada = Encriptarpwd(textBox_pwd.Text);

            //verifica se os campos estão preenchidos
            if (string.IsNullOrEmpty(textBox_nomeEmpresa.Text) || string.IsNullOrEmpty(textBox_contacto.Text) || string.IsNullOrEmpty(textBox_email.Text) || string.IsNullOrEmpty(textBox_pwd.Text) || string.IsNullOrEmpty(textBox_pwd2.Text))
            {
                MessageBox.Show("Preencha todos os campos!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                textBox_nomeEmpresa.Select();
            }
            else if (FormatacaoEmail.IsValidEmail(textBox_email.Text) == false)
            {
                MessageBox.Show("Introduza um email correto!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                textBox_email.Select();
            }
            else if (textBox_pwd.Text != textBox_pwd2.Text)
            {
                MessageBox.Show("As palavras-passe não correspodem uma à outra!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                textBox_pwd.Clear();
                textBox_pwd2.Clear();
                textBox_pwd.Select();
            }
            else
            {
                //verifica se o nome e o email da empresa já exitem
                string    dadosUtilizador = "SELECT e_mail, nome_empresa FROM Empresa WHERE e_mail = '" + textBox_email.Text + "' OR nome_empresa = '" + textBox_nomeEmpresa.Text + "'";
                DataTable dt = ConecaoSQLServer.ExecutaSql(dadosUtilizador);

                if (dt.Rows.Count >= 1)
                {
                    MessageBox.Show("O nome da empresa ou o email já existem!");
                }
                else
                {
                    //verifica se já exite ou não o nome ou o email (se já existirem não deixa inserir) e depois insere os dados se não existirem
                    string dadosInseridos = "IF NOT EXISTS(SELECT nome_empresa, e_mail FROM Empresa WHERE nome_empresa = '" + textBox_nomeEmpresa.Text + "' OR e_mail = '" + textBox_email.Text + "') INSERT INTO Empresa(nome_empresa,contacto_tel,e_mail,password,perfil, validada) VALUES('" + textBox_nomeEmpresa.Text + "','" + textBox_contacto.Text + "','" + textBox_email.Text + "','" + pwdEncriptada + "','" + perfilEMP + "', '0')";
                    ConecaoSQLServer.ExecutaSql(dadosInseridos);

                    textBox_nomeEmpresa.Clear();
                    textBox_pwd.Clear();
                    textBox_pwd2.Clear();
                    textBox_contacto.Clear();
                    textBox_email.Clear();

                    Hide();

                    Login login = new Login(); //-------- ALTERAR NOVAMENTE SE NECESSARIO PARA PAGINA INICIAL----------!!!!!!!!!!!
                    login.ShowDialog();

                    Show();
                    textBox_nomeEmpresa.Select();
                }
            }
        }
コード例 #5
0
        private void dadosDataGrid(string sql)
        {
            DataTable dadosParques = ConecaoSQLServer.ExecutaSql(sql);

            dataGridView1.DataSource            = dadosParques;
            dataGridView1.Columns[0].HeaderText = "Parque Científico";
            dataGridView1.Columns[1].HeaderText = "Localidade";
            dataGridView1.Columns[2].HeaderText = "Email";
            dataGridView1.Columns[0].Width      = 212;
            dataGridView1.Columns[1].Width      = 213;
            dataGridView1.Columns[2].Width      = 213;
        }
コード例 #6
0
        public static void SaveXml(string xmlFileName)//metodo que guarda na base de dados o XML
        {
            //verifica qual é o utilizador que está logado
            int utilizadorLogadoId = Login.dadosLoginID;

            // read your XML
            //string xmlContent = File.ReadAllText(@"C:\Users\Asus\Source\Repos\sad\ITICH\ITICH\Xml\" + xmlFileName);

            // set up query
            string insertQuery = "INSERT INTO Resultados_simulacao(id_empresa, resultado) VALUES ('" + utilizadorLogadoId + "', '" + xmlFileName + "')";

            ConecaoSQLServer.ExecutaSql(insertQuery);
        }
コード例 #7
0
ファイル: NovoSimulacao.cs プロジェクト: ITICH/sad
 public NovoSimulacao()
 {
     InitializeComponent();
     //dados na comboBox fases
     dataTable = ConecaoSQLServer.ExecutaSql("SELECT * FROM Fases_desenvolvimento");
     foundRows = dataTable.Select();
     for (int i = 0; i < foundRows.Length; i++)
     {
         comboBox2_fase.Items.Add(foundRows[i][1].ToString());
     }
     //dados na comboBox distritos
     comboBox1.DataSource = distritos;
     //dados na comboBox fases
     comboBox2.DataSource = volNeg;
     //dados na comboBox fases
     comboBox5.DataSource = tipoInst;
     Refresh();
 }
コード例 #8
0
ファイル: AdicionarAD.cs プロジェクト: ITICH/sad
        private void button_Confirmar_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(textBox_AdicionarAD.Text) || String.IsNullOrEmpty(textBox_AdicionarAD.Text))
            {
                MessageBox.Show("Submissão inválida.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                switch (escolha)
                {
                case Tipo.Area:
                    DataTable dtArea = ConecaoSQLServer.ExecutaSql("SELECT * FROM Nome_area WHERE nome_area = '" + textBox_AdicionarAD.Text + "'");
                    if (dtArea.Rows.Count > 0)
                    {
                        MessageBox.Show("Já existe uma área com este nome.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        ConecaoSQLServer.ExecutaSql("INSERT INTO Nome_area (nome_area) VALUES ('" + textBox_AdicionarAD.Text + "')");
                        MessageBox.Show("Área criada com sucesso!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    Close();
                    break;

                case Tipo.Dominio:
                    DataTable dtDominio = ConecaoSQLServer.ExecutaSql("SELECT * FROM Nome_dominio WHERE nome_dominio = '" + textBox_AdicionarAD.Text + "'");
                    if (dtDominio.Rows.Count > 0)
                    {
                        MessageBox.Show("Já existe um domínio com este nome.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        ConecaoSQLServer.ExecutaSql("INSERT INTO Nome_dominio (nome_dominio) VALUES ('" + textBox_AdicionarAD.Text + "')");
                        MessageBox.Show("Domínio criado com sucesso!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                    Close();
                    break;
                }
            }
        }
コード例 #9
0
        private void Historico_Load(object sender, EventArgs e)
        {
            string    mostrarResSimulacoes = "SELECT resultado FROM Resultados_simulacao WHERE id_empresa = '" + utilizadorLogadoId + "'";
            DataTable dt = ConecaoSQLServer.ExecutaSql(mostrarResSimulacoes);

            dataGridView1.DataSource            = dt;
            dataGridView1.Columns[0].HeaderText = "Simulações";
            dataGridView1.Columns[0].Width      = 880;

            button_abrir.Visible = false;
            richTextBox1.Visible = false;

            if (dataGridView1.SelectedCells.Count == 1)
            {
                //button_abrir.Visible = true;
            }
            else
            {
                //False statement
            }
        }
コード例 #10
0
ファイル: RegistoForm.cs プロジェクト: ITICH/sad
        public RegistoForm()
        {
            InitializeComponent();

            this.FormClosing += new FormClosingEventHandler(RegistoForm_FormClosing);

            //Popular com os dados encontrados na base de dados
            dataTable = ConecaoSQLServer.ExecutaSql("SELECT * FROM Carateristicas_juridicas");
            foundRows = dataTable.Select();
            for (int i = 0; i < foundRows.Length; i++)
            {
                comboBox_JuridicialGeral.Items.Add(foundRows[i][1].ToString());
            }
            dataTable = ConecaoSQLServer.ExecutaSql("SELECT * FROM Fases_desenvolvimento");
            foundRows = dataTable.Select();
            for (int i = 0; i < foundRows.Length; i++)
            {
                comboBox_FaseGeral.Items.Add(foundRows[i][1].ToString());
            }

            Refresh();
        }
コード例 #11
0
 private void testeDB()
 {
     try
     {
         //Ler valor do endereço no ficheiro XML
         XmlDocument doc = new XmlDocument();
         doc.Load("appinfo.xml");
         XmlNode node = doc.DocumentElement.SelectSingleNode("connection");
         if (node.InnerText.Length > 0)
         {
             ConecaoSQLServer.stringConecao = @"Data Source = " + node.InnerText + @"; Initial Catalog = ITICH; Integrated Security = True; Integrated Security = True;";
             DataTable dt = ConecaoSQLServer.ExecutaSql("SELECT * FROM Parques_cientificos");
             if (dt != null)
             {
                 //Continuar para login
                 Login login = new Login();
                 login.ShowDialog();
             }
         }
     }
     catch
     {
     }
 }
コード例 #12
0
ファイル: RegistoForm.cs プロジェクト: ITICH/sad
        //Criar Parque
        private void criarParque()
        {
            if (areas.Count > 0)
            {
                for (int i = 0; i < areas.Count; i++)
                {
                    dataTable = ConecaoSQLServer.ExecutaSql("SELECT id_nome_area FROM Nome_area WHERE(nome_area = '" + areas[i] + "');");
                    foundRows = dataTable.Select();
                    areas[i]  = foundRows[0][0].ToString();
                }
            }
            if (dominios.Count > 0)
            {
                for (int i = 0; i < dominios.Count; i++)
                {
                    dataTable   = ConecaoSQLServer.ExecutaSql("SELECT id_nome_dominio FROM Nome_dominio WHERE(nome_dominio = '" + dominios[i] + "');");
                    foundRows   = dataTable.Select();
                    dominios[i] = foundRows[0][0].ToString();
                }
            }

            ConecaoSQLServer.ExecutaSql("INSERT INTO Localizacao (distrit, concelh, morada) VALUES ('" + textBox_DistritoGeral.Text + "', '" + textBox_ConcelhoGeral.Text + "', '" + textBox_MoradaGeral.Text + "');");
            dataTable = ConecaoSQLServer.ExecutaSql("SELECT MAX(id_localizacao) FROM Localizacao");
            foundRows = dataTable.Select();
            int indexLocalizacao = Convert.ToInt32(foundRows[0][0]);

            int finsGeral       = checkBox_FinsGeral.Checked ? 1 : 0;
            int interesseGeral  = checkBox_InteresseGeral.Checked ? 1 : 0;
            int juridicialGeral = comboBox_JuridicialGeral.SelectedIndex == -1 ? 0 : comboBox_JuridicialGeral.SelectedIndex;
            int faseGeral       = comboBox_FaseGeral.SelectedIndex == -1 ? 0 : comboBox_FaseGeral.SelectedIndex;
            int temIncubadora   = dataGridView_Incubadora.Rows.Count > 0 ? temIncubadora = 1 : temIncubadora = 0;

            ConecaoSQLServer.ExecutaSql("INSERT INTO Parques_cientificos (entidade_gestora, fins_lucrativos, interesse_publico, contacto_tel, ano_de_inicio, " +
                                        "patrimonio_acossiativo_e_capital_social, id_fase_de_desenvolvimento, id_carateristica_juridica, id_localizacao, nome_parque, " +
                                        "e_mail, temIncubadora) VALUES (" +
                                        "'" + textBox_EntidadeGeral.Text + "', " +
                                        "'" + finsGeral + "', " +
                                        "'" + interesseGeral + "', " +
                                        "'" + textBox_TelefoneGeral.Text + "', " +
                                        "'" + dateTimePicker_AnoGeral.Text + "', " +
                                        "'" + textBox_CapitalGeral.Text + "', " +
                                        "'" + faseGeral + "', " +
                                        "'" + juridicialGeral + "', " +
                                        "'" + indexLocalizacao + "', " +
                                        "'" + textBox_NomeGeral.Text + "', " +
                                        "'" + textBox_EmailGeral.Text + "', " +
                                        "'" + temIncubadora + "')"
                                        );

            dataTable = ConecaoSQLServer.ExecutaSql("SELECT MAX(id_parque) FROM Parques_cientificos");
            foundRows = dataTable.Select();
            int indexParque = Convert.ToInt32(foundRows[0][0]);

            if (areas.Count > 0)
            {
                foreach (string item in areas)
                {
                    ConecaoSQLServer.ExecutaSql("INSERT INTO Areas_negocios (id_parque, id_nome_area) VALUES (" +
                                                "'" + indexParque + "', " +
                                                "'" + item + "')"
                                                );
                }
            }
            if (dominios.Count > 0)
            {
                foreach (string item in dominios)
                {
                    ConecaoSQLServer.ExecutaSql("INSERT INTO Dominios_cientificos_tecnologicos (id_parque, id_nome_dominio) VALUES (" +
                                                "'" + indexParque + "', " +
                                                "'" + item + "')"
                                                );
                }
            }

            if (temIncubadora == 1)
            {
                for (int i = 0; i < dataGridView_Incubadora.Rows.Count; i++)
                {
                    ConecaoSQLServer.ExecutaSql("INSERT INTO Incubadoras (volume_negocios, numero_de_pessoas, nom_inc, id_parque) VALUES (" +
                                                "'" + dataGridView_Incubadora.Rows[i].Cells[1].Value.ToString() + "', " +
                                                "'" + dataGridView_Incubadora.Rows[i].Cells[2].Value.ToString() + "', " +
                                                "'" + dataGridView_Incubadora.Rows[i].Cells[0].Value.ToString() + "', " +
                                                "'" + indexParque + "')"
                                                );
                    dataTable = ConecaoSQLServer.ExecutaSql("SELECT MAX(id_incubadora) FROM Incubadoras");
                    foundRows = dataTable.Select();
                    int indexIncubadora = Convert.ToInt32(foundRows[0][0]);

                    DataGridViewComboBoxCell espacoCell = (DataGridViewComboBoxCell)dataGridView_Incubadora[4, i];
                    for (int k = 0; k < espacoCell.Items.Count; k++)
                    {
                        ConecaoSQLServer.ExecutaSql("INSERT INTO Espacos_incubadora (tipo_espaco, id_incubadora) VALUES (" +
                                                    "'" + espacoCell.Items[k].ToString() + "', " +
                                                    "'" + indexIncubadora + "')"
                                                    );
                    }

                    DataGridViewComboBoxCell servicoCell = (DataGridViewComboBoxCell)dataGridView_Incubadora[3, i];
                    for (int k = 0; k < servicoCell.Items.Count; k++)
                    {
                        ConecaoSQLServer.ExecutaSql("INSERT INTO Servicos_incubadora (tipo_servico, id_incubadora) VALUES (" +
                                                    "'" + servicoCell.Items[k].ToString() + "', " +
                                                    "'" + indexIncubadora + "')"
                                                    );
                    }
                }
            }

            if (dataGridView_Instalacao.Rows.Count > 0)
            {
                for (int i = 0; i < dataGridView_Instalacao.Rows.Count; i++)
                {
                    int estacionamento = dataGridView_Instalacao.Rows[i].Cells[5].Value.ToString() == "Checked" ? estacionamento = 1 : estacionamento = 0;
                    int vigilancia     = dataGridView_Instalacao.Rows[i].Cells[6].Value.ToString() == "Checked" ? vigilancia = 1 : vigilancia = 0;
                    int seguranca      = dataGridView_Instalacao.Rows[i].Cells[7].Value.ToString() == "Checked" ? seguranca = 1 : seguranca = 0;

                    ConecaoSQLServer.ExecutaSql("INSERT INTO Carateristicas_instalacoes (num_lotes, num_lotes_ocupados, estacionamento, videovigilancia, seguranca, tipo_de_rede) VALUES (" +
                                                "'" + dataGridView_Instalacao.Rows[i].Cells[3].Value.ToString() + "', " +
                                                "'" + dataGridView_Instalacao.Rows[i].Cells[4].Value.ToString() + "', " +
                                                "'" + estacionamento + "', " +
                                                "'" + vigilancia + "', " +
                                                "'" + seguranca + "', " +
                                                "'" + dataGridView_Instalacao.Rows[i].Cells[8].Value.ToString() + "')"
                                                );

                    dataTable = ConecaoSQLServer.ExecutaSql("SELECT MAX(id_carateristicas) FROM Carateristicas_instalacoes");
                    foundRows = dataTable.Select();
                    int indexCaracteristicas = Convert.ToInt32(foundRows[0][0]);

                    ConecaoSQLServer.ExecutaSql("INSERT INTO Instalacoes (id_carateristicas, id_parque, designaca, localidad, concelh) VALUES (" +
                                                "'" + indexCaracteristicas + "', " +
                                                "'" + indexParque + "', " +
                                                "'" + dataGridView_Instalacao.Rows[i].Cells[0].Value.ToString() + "', " +
                                                "'" + dataGridView_Instalacao.Rows[i].Cells[1].Value.ToString() + "', " +
                                                "'" + dataGridView_Instalacao.Rows[i].Cells[2].Value.ToString() + "')"
                                                );
                }
            }

            areas.Clear();
            dominios.Clear();
        }
コード例 #13
0
        public static string CriarXML(string dt) //metodo que cria o ficheiro XML e guarda localmente
        {
            string idParque = "SELECT P.id_parque, P.nome_parque FROM Parques_cientificos P WHERE P.e_mail = '" + dt + "'";

            Console.WriteLine(idParque);
            DataTable id  = ConecaoSQLServer.ExecutaSql(idParque);
            int       id1 = Int32.Parse(id.Rows[0][0].ToString());

            Console.WriteLine("\n");
            //query que busca a morada
            string    queryLocal = "SELECT L.morada FROM Parques_cientificos P, Localizacao L WHERE P.id_localizacao = '" + id1 + "'";
            DataTable local      = ConecaoSQLServer.ExecutaSql(queryLocal);
            string    l          = local.Rows[0][0].ToString();
            //query que busca a fase
            string    queryFase = "SELECT F.nome_fase FROM Parques_cientificos P, Fases_desenvolvimento F WHERE P.id_fase_de_desenvolvimento = F.id_fase_desenvolvimento AND P.id_parque = '" + id1 + "'";
            DataTable fase      = ConecaoSQLServer.ExecutaSql(queryFase);
            string    f         = fase.Rows[0][0].ToString();
            //query que busca o vol Negocios
            string    queryVol = "SELECT P.patrimonio_acossiativo_e_capital_social AS[VolumeNegocios]  FROM Parques_cientificos P WHERE P.id_parque = '" + id1 + "'";
            DataTable vol      = ConecaoSQLServer.ExecutaSql(queryVol);
            string    v        = vol.Rows[0][0].ToString();
            //query que busca a area
            string    queryArea = "SELECT N.nome_area FROM Areas_negocios A, Nome_area N WHERE N.id_nome_area = A.id_nome_area AND A.id_parque='" + id1 + "'";
            DataTable area      = ConecaoSQLServer.ExecutaSql(queryArea);

            string[] a = new string[area.Rows.Count];
            for (int j = 0; j <= area.Rows.Count - 1; j++)
            {
                a[j] = area.Rows[j][0].ToString();
            }
            //query que busca servicos e espaço
            string    queryInc = "SELECT S.tipo_servico FROM Servicos_incubadora S, Incubadoras I WHERE I.id_incubadora = S.id_incubadora AND I.id_parque = '" + id1 + "'";
            DataTable inc      = ConecaoSQLServer.ExecutaSql(queryInc);

            string[] inc1 = new string[inc.Rows.Count];
            for (int j = 0; j <= inc.Rows.Count - 1; j++)
            {
                inc1[j] = inc.Rows[j][0].ToString();
            }
            string    queryInc2 = "SELECT E.tipo_espaco FROM Espacos_incubadora E, Incubadoras I WHERE I.id_incubadora = E.id_incubadora AND I.id_parque = '" + id1 + "'";
            DataTable inc2      = ConecaoSQLServer.ExecutaSql(queryInc2);

            string[] inc22 = new string[inc2.Rows.Count];
            for (int j = 0; j <= inc2.Rows.Count - 1; j++)
            {
                inc22[j] = inc2.Rows[j][0].ToString();
            }
            //query que busca a designação
            string    queryTi = "SELECT I.designaca FROM Instalacoes I WHERE I.id_parque = '" + id1 + "' ";
            DataTable ti      = ConecaoSQLServer.ExecutaSql(queryTi);

            string[] tist = new string[ti.Rows.Count];
            for (int j = 0; j <= ti.Rows.Count - 1; j++)
            {
                tist[j] = ti.Rows[j][0].ToString();
            }

            //Documento XML ********************************************************
            XmlDocument doc     = new XmlDocument();
            XmlNode     docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);

            doc.AppendChild(docNode);
            //nome do parque
            XmlNode      parqueNode  = doc.CreateElement("parque");
            XmlAttribute pqAttribute = doc.CreateAttribute("nome");

            pqAttribute.Value = id.Rows[0][1].ToString();
            parqueNode.Attributes.Append(pqAttribute);
            doc.AppendChild(parqueNode);

            //morada
            XmlNode localNode = doc.CreateElement("Morada");

            localNode.AppendChild(doc.CreateTextNode(l));//
            parqueNode.AppendChild(localNode);

            //fase desenvolvimento
            XmlNode faseNode = doc.CreateElement("FaseDesenvolvimento");

            faseNode.AppendChild(doc.CreateTextNode(f));//
            parqueNode.AppendChild(faseNode);

            //volNegocios
            XmlNode volNode = doc.CreateElement("VolumeNegocios");

            volNode.AppendChild(doc.CreateTextNode(v));//
            parqueNode.AppendChild(volNode);

            //areas
            XmlNode areaN = doc.CreateElement("Areas");

            parqueNode.AppendChild(areaN);
            for (int j = 0; j <= area.Rows.Count - 1; j++)
            {
                XmlNode areaNode = doc.CreateElement("AreaNegocio");
                areaNode.AppendChild(doc.CreateTextNode(a[j]));//
                areaN.AppendChild(areaNode);
            }

            //incubadoras
            XmlNode incN = doc.CreateElement("TipoDeServicos");

            parqueNode.AppendChild(incN);
            for (int j = 0; j <= inc.Rows.Count - 1; j++)
            {
                XmlNode incNode = doc.CreateElement("Sercico");
                incNode.AppendChild(doc.CreateTextNode(inc1[j]));//
                incN.AppendChild(incNode);
            }
            XmlNode inc2N = doc.CreateElement("TiposDeEspaco");

            parqueNode.AppendChild(inc2N);
            for (int j = 0; j <= inc2.Rows.Count - 1; j++)
            {
                XmlNode inc2Node = doc.CreateElement("Espaco");
                inc2Node.AppendChild(doc.CreateTextNode(inc22[j]));//
                inc2N.AppendChild(inc2Node);
            }

            //ti
            XmlNode tiN = doc.CreateElement("Instalacoes");

            parqueNode.AppendChild(tiN);
            for (int j = 0; j <= ti.Rows.Count - 1; j++)
            {
                XmlNode instNode = doc.CreateElement("TipoDeInstalacao");
                instNode.AppendChild(doc.CreateTextNode(tist[j]));//
                tiN.AppendChild(instNode);
            }

            string nomeDoc = id.Rows[0][1].ToString().Replace(" ", "") + "_XMLparque.xml";//nome documento

            //string caminho = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
            //doc.Save(@"C:\Users\Asus\Source\Repos\sad\ITICH\ITICH\Xml" + nomeDoc);

            //string root = @"C:\Users\Asus\Desktop\XMLparques";
            string root = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\XMLparques\";

            // If directory does not exist, create it.
            if (!Directory.Exists(root))
            {
                Directory.CreateDirectory(root);
                //string caminho = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                string filePath = root + @"\" + nomeDoc;
                //doc.Save(@"\Users\Asus\Desktop\XMLparques" + nomeDoc);
                doc.Save(filePath);
                SaveXml(nomeDoc);//Guarda na bd
            }
            else if (Directory.Exists(root))
            {
                string caminho = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                //doc.Save(@"\Users\Asus\Desktop\XMLparques" + nomeDoc);
                string filePath = caminho + @"\XMLparques\" + nomeDoc;
                doc.Save(filePath);
                SaveXml(nomeDoc);//Guarda na bd
            }

            return(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\XMLparques\" + nomeDoc);
        }
コード例 #14
0
        private void button1_Click(object sender, EventArgs e)
        {
            //variavel usada para guardar e identificar o utilizador depois do login
            string userAtual = textBox_nome.Text;

            //seleciona os utitilizadores com perfil de Empresa
            string queryLoginEMP = "SELECT id_empresa, e_mail, password, perfil, validada FROM Empresa WHERE e_mail = '" + textBox_nome.Text + "' " +
                                   "AND password = '******' AND perfil = 2";
            //seleciona os utitilizadores com perfil de Administrador
            string queryLoginADM = "SELECT id_empresa, e_mail, password, perfil, validada FROM Empresa WHERE e_mail = '" + textBox_nome.Text + "' " +
                                   "AND password = '******' AND perfil = 1";

            DataTable dadosUtilizador    = ConecaoSQLServer.ExecutaSql(queryLoginEMP);
            DataTable dadosUtilizadorADM = ConecaoSQLServer.ExecutaSql(queryLoginADM);

            if (string.IsNullOrEmpty(textBox_nome.Text) || string.IsNullOrEmpty(textBox_pw.Text))
            {
                MessageBox.Show("Introduza o email ou a palavra passe!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                textBox_nome.Select();
            }
            //chama metodo que verifica se o email está na forma correta ex.: [email protected]
            else if (FormatacaoEmail.IsValidEmail(textBox_nome.Text) == false)
            {
                MessageBox.Show("Introduza um email correto!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                textBox_nome.Select();
            }
            else
            {
                //se o utilizador existir e os dados estiverem corretos vai entra na app
                if (dadosUtilizador.Rows.Count > 0)
                {
                    //Verificação para ver se a conta foi validada
                    if (dadosUtilizador.Rows[0][4].ToString().Equals("True"))
                    {
                        dadosLogin    = userAtual;
                        dadosLoginID  = Int32.Parse(dadosUtilizador.Rows[0][0].ToString());
                        dadosLoginPwd = textBox_pw.Text;
                        this.textBox_nome.Clear();
                        this.textBox_pw.Clear();
                        this.checkBox1.Checked = false;

                        this.Hide();

                        PaginaInicial paginaInicial = new PaginaInicial();
                        paginaInicial.ShowDialog();
                    }
                    //Mensagem de aviso caso a conta não tenha sido validada
                    else
                    {
                        MessageBox.Show("A conta ainda não foi validada!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                //só pode ser acedido pelo perfil do ADM
                else if (dadosUtilizadorADM.Rows.Count > 0)
                {
                    //guarda o id e a password da conta para saber que conta foi usada para o login

                    dadosLogin    = userAtual;
                    dadosLoginID  = Int32.Parse(dadosUtilizadorADM.Rows[0][0].ToString());
                    dadosLoginPwd = textBox_pw.Text;

                    this.textBox_nome.Clear();
                    this.textBox_pw.Clear();
                    this.checkBox1.Checked = false;

                    dadosLogin = userAtual;

                    this.Hide();

                    PaginaInicial paginaInicial = new PaginaInicial();
                    paginaInicial.ShowDialog();

                    //this.Show();
                    //this.textBox_nome.Select();
                }
                else
                {
                    MessageBox.Show("O nome ou a palavra passe errada!", "", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    textBox_nome.Focus();
                    textBox_nome.SelectAll();
                }
            }
        }
コード例 #15
0
ファイル: NovoSimulacao.cs プロジェクト: ITICH/sad
        private void button_ConfirmarDados_Click(object sender, EventArgs e)
        {
            //Matriz com a importancia dos critérios
            valCriterios = new double[] { 1, ((KeyValuePair <int, string>)comboBox_Fd.SelectedItem).Key, ((KeyValuePair <int, string>)comboBox_area.SelectedItem).Key, ((KeyValuePair <int, string>)comboBox_Vn.SelectedItem).Key, ((KeyValuePair <int, string>)comboBox_CInst.SelectedItem).Key,
                                          ((KeyValuePair <int, string>)comboBox_Inc.SelectedItem).Key, ((KeyValuePair <int, string>)comboBox_TInt.SelectedItem).Key, 1 / ((KeyValuePair <int, string>)comboBox_Fd.SelectedItem).Key, 1, ((KeyValuePair <int, string>)comboBox2_a.SelectedItem).Key, ((KeyValuePair <int, string>)comboBox2_vn.SelectedItem).Key,
                                          ((KeyValuePair <int, string>)comboBox2_ci.SelectedItem).Key, ((KeyValuePair <int, string>)comboBox2_i.SelectedItem).Key, ((KeyValuePair <int, string>)comboBox2_ti.SelectedItem).Key, 1 / ((KeyValuePair <int, string>)comboBox_area.SelectedItem).Key, 1 / ((KeyValuePair <int, string>)comboBox2_a.SelectedItem).Key,
                                          1, ((KeyValuePair <int, string>)comboBox3_vn.SelectedItem).Key, ((KeyValuePair <int, string>)comboBox3_ci.SelectedItem).Key, ((KeyValuePair <int, string>)comboBox3_i.SelectedItem).Key, ((KeyValuePair <int, string>)comboBox3_ti.SelectedItem).Key, 1 / ((KeyValuePair <int, string>)comboBox_Vn.SelectedItem).Key,
                                          1 / ((KeyValuePair <int, string>)comboBox2_vn.SelectedItem).Key, 1 / ((KeyValuePair <int, string>)comboBox3_vn.SelectedItem).Key, 1, ((KeyValuePair <int, string>)comboBox4_ci.SelectedItem).Key, ((KeyValuePair <int, string>)comboBox4_i.SelectedItem).Key, ((KeyValuePair <int, string>)comboBox4_ti.SelectedItem).Key,
                                          1 / ((KeyValuePair <int, string>)comboBox_CInst.SelectedItem).Key, 1 / ((KeyValuePair <int, string>)comboBox2_ci.SelectedItem).Key, 1 / ((KeyValuePair <int, string>)comboBox3_ci.SelectedItem).Key, 1 / ((KeyValuePair <int, string>)comboBox4_ci.SelectedItem).Key, 1,
                                          ((KeyValuePair <int, string>)comboBox5_i.SelectedItem).Key, ((KeyValuePair <int, string>)comboBox5_ti.SelectedItem).Key, 1 / ((KeyValuePair <int, string>)comboBox_Inc.SelectedItem).Key, 1 / ((KeyValuePair <int, string>)comboBox2_i.SelectedItem).Key, 1 / ((KeyValuePair <int, string>)comboBox3_i.SelectedItem).Key,
                                          1 / ((KeyValuePair <int, string>)comboBox4_i.SelectedItem).Key, 1 / ((KeyValuePair <int, string>)comboBox5_i.SelectedItem).Key, 1, ((KeyValuePair <int, string>)comboBox6_ti.SelectedItem).Key, 1 / ((KeyValuePair <int, string>)comboBox_TInt.SelectedItem).Key,
                                          1 / ((KeyValuePair <int, string>)comboBox2_ti.SelectedItem).Key, 1 / ((KeyValuePair <int, string>)comboBox3_ti.SelectedItem).Key, 1 / ((KeyValuePair <int, string>)comboBox4_ti.SelectedItem).Key, 1 / ((KeyValuePair <int, string>)comboBox5_ti.SelectedItem).Key,
                                          1 / ((KeyValuePair <int, string>)comboBox6_ti.SelectedItem).Key, 1 };

            double[,] matrizCriterios = new double[numCriterios, numCriterios];

            int conta = 0;

            for (int i = 0; i < numCriterios; i++)//Preeche a matriz de Criterios
            {
                for (int j = 0; j < numCriterios; j++)
                {
                    matrizCriterios[i, j] = valCriterios[conta];
                    conta += 1;
                }
            }

            double[] resCaclCriterios = new double[numCriterios];
            resCaclCriterios = CalcSimulacao.CalcCriteriosAhp(matrizCriterios, numCriterios);

            string    parques   = "SELECT COUNT(id_parque) as numParques FROM Parques_cientificos";//busca o numero de parques / opções
            DataTable dtParques = ConecaoSQLServer.ExecutaSql(parques);

            numParques = Int32.Parse(dtParques.Rows[0][0].ToString());

            //colocar comentario-------------VERIFICAR PQ É QUE SE NÃO TIVER TUDO PREENCHIDO CONTINUA COM O CALC E FICA INVERTIDA A MATRIZ E COM O VAL 8
            if (string.IsNullOrEmpty(label_ImpLocal.Text) || string.IsNullOrEmpty(label_impArea.Text) ||
                string.IsNullOrEmpty(label_impFdesenv.Text) || string.IsNullOrEmpty(label_impVol.Text) ||
                string.IsNullOrEmpty(label_impInst.Text) || string.IsNullOrEmpty(label_impSerInc.Text) ||
                string.IsNullOrEmpty(label_impTpInst.Text))
            {
                MessageBox.Show("Preencha todos os campos!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            else
            {
                local            = Int32.Parse(label_ImpLocal.Text);
                area             = Int32.Parse(label_impArea.Text);
                fDesenvolvimento = Int32.Parse(label_impFdesenv.Text);
                volNegocios      = Int32.Parse(label_impVol.Text);
                cartInstalacao   = Int32.Parse(label_impInst.Text);
                serIncubadora    = Int32.Parse(label_impSerInc.Text);
                tipoInstalacao   = Int32.Parse(label_impTpInst.Text);
            }

            //busca o id de TODOS os parques / opções
            string    parquesTodos   = "SELECT id_parque, nome_parque, e_mail FROM Parques_cientificos";
            DataTable dtParquesTodos = ConecaoSQLServer.ExecutaSql(parquesTodos);

            int[]    tdParques    = new int[dtParquesTodos.Rows.Count];
            string[] nomeParques  = new string[dtParquesTodos.Rows.Count];
            string[] emailParques = new string[dtParquesTodos.Rows.Count];
            for (int i = 0; i < dtParquesTodos.Rows.Count; i++)
            {
                tdParques[i]    = Int32.Parse(dtParquesTodos.Rows[i][0].ToString()); //id de todos os parques
                nomeParques[i]  = dtParquesTodos.Rows[i][1].ToString();              //todos os nomes dos parques
                emailParques[i] = dtParquesTodos.Rows[i][2].ToString();              //email dos parques
            }

            //########################################################################################################################################################################
            //busca os parques com o mesmo local na comboBox
            string queryLocalizacao = "SELECT P.id_parque, L.distrit FROM Parques_cientificos P, Localizacao L " +
                                      "WHERE P.id_localizacao = L.id_localizacao AND L.distrit = '" + comboBox1.Text + "'";
            DataTable dtLocal = ConecaoSQLServer.ExecutaSql(queryLocalizacao);

            int[] locaisMaisImp = new int[dtLocal.Rows.Count];
            for (int i = 0; i < dtLocal.Rows.Count; i++)
            {
                locaisMaisImp[i] = Int32.Parse(dtLocal.Rows[i][0].ToString());
            }

            //preenche a matriz LOCALIDADE e calcula a matriz com o metodo ahp e retorna um vetor com os RESULTADOS
            double[] resCaclMatrizLocal = new double[tdParques.Length];
            resCaclMatrizLocal = CalcSimulacao.PreencheMatriz(tdParques, locaisMaisImp, local);
            //Console.Write("[{0}]", string.Join(";", resCaclMatrizLocal));

            //########################################################################################################################################################################
            //busca os parques com a mesma fase na comboBox
            string    queryFases = "SELECT P.id_parque, F.nome_fase FROM Parques_cientificos P, Fases_desenvolvimento F WHERE P.id_fase_de_desenvolvimento = F.id_fase_desenvolvimento AND F.nome_fase = '" + comboBox2_fase.SelectedText + "'";
            DataTable dtFases    = ConecaoSQLServer.ExecutaSql(queryFases);

            int[] fasesMaisImp = new int[dtFases.Rows.Count];
            for (int i = 0; i < dtFases.Rows.Count; i++)
            {
                fasesMaisImp[i] = Int32.Parse(dtFases.Rows[i][0].ToString());
            }

            //preenche a matriz FASES e calcula a matriz com o metodo ahp e retorna um vetor com os RESULTADOS
            double[] resCaclMatrizFase = new double[tdParques.Length];
            resCaclMatrizFase = CalcSimulacao.PreencheMatriz(tdParques, fasesMaisImp, fDesenvolvimento);

            //########################################################################################################################################################################
            //busca os parques com a mesma Area na comboBox
            int[] areasMaisImp = new int[areas.Count];
            if (areas.Count > 0)
            {
                for (int i = 0; i < areas.Count; i++)
                {
                    string queryAreas = "SELECT P.id_parque FROM Parques_cientificos P, Areas_negocios A, Nome_area N WHERE N.id_nome_area = A.id_nome_area AND N.nome_area ='" + areas[i] + "'";
                    dataTable       = ConecaoSQLServer.ExecutaSql(queryAreas);
                    foundRows       = dataTable.Select();
                    areasMaisImp[i] = Int32.Parse(foundRows[0][0].ToString());
                }
            }
            double[] resCaclMatrizAreas = new double[tdParques.Length];
            resCaclMatrizAreas = CalcSimulacao.PreencheMatriz(tdParques, areasMaisImp, area);

            //########################################################################################################################################################################
            //busca os parques com o mesmo ou maior volumeNegocios na comboBox
            string    queryVolNegocios = "SELECT P.id_parque, P.nome_parque FROM Parques_cientificos P WHERE P.patrimonio_acossiativo_e_capital_social >= '" + comboBox2.SelectedText + "'";
            DataTable dtVol            = ConecaoSQLServer.ExecutaSql(queryVolNegocios);

            int[] volNegMaisImp = new int[dtVol.Rows.Count];
            for (int i = 0; i < dtVol.Rows.Count; i++)
            {
                volNegMaisImp[i] = Int32.Parse(dtVol.Rows[i][0].ToString());
            }

            //preenche a matriz VOL. NEGOCIOS e calcula a matriz com o metodo ahp e retorna um vetor com os RESULTADOS
            double[] resCaclMatrizVolNeg = new double[tdParques.Length];
            resCaclMatrizVolNeg = CalcSimulacao.PreencheMatriz(tdParques, volNegMaisImp, volNegocios);

            //########################################################################################################################################################################
            //busca os parques com as mesmas carateristica da instalação selceionadas
            _ = checkBox_EstacionamentoInstalacao.Checked ? estacionamentoInst = 1 : estacionamentoInst = 0;
            _ = checkBox_SegurancaInstalacao.Checked ? segurancaInst = 1 : segurancaInst = 0;
            _ = checkBox_VigilanciaInstalacao.Checked ? vigilanciaInst = 1 : vigilanciaInst = 0;

            double[] resCaclMatrizCartInst = new double[tdParques.Length];
            if (segurancaInst == 1 && estacionamentoInst == 1 && vigilanciaInst == 1)
            {
                string    queryInstalacoes = "SELECT P.id_parque FROM Instalacoes I, Parques_cientificos P, Carateristicas_instalacoes C WHERE I.id_carateristicas = C.id_carateristicas AND C.estacionamento = 1 AND C.videovigilancia = 1 AND C.seguranca = 1 AND C.tipo_de_rede = '" + textBox_RedeInstalacao.Text + "'";
                DataTable dtInstalacoes    = ConecaoSQLServer.ExecutaSql(queryInstalacoes);
                int[]     cartInstMaisImp  = new int[dtInstalacoes.Rows.Count];
                for (int i = 0; i < dtInstalacoes.Rows.Count; i++)
                {
                    cartInstMaisImp[i] = Int32.Parse(dtInstalacoes.Rows[i][0].ToString());
                }

                //preenche a matriz Caract. Instalações e calcula a matriz com o metodo ahp e retorna um vetor com os RESULTADOS
                resCaclMatrizCartInst = CalcSimulacao.PreencheMatriz(tdParques, cartInstMaisImp, cartInstalacao);
            }
            else if (segurancaInst == 1 || estacionamentoInst == 1 || vigilanciaInst == 1)
            {
                string    queryInstalacoes = "SELECT P.id_parque FROM Instalacoes I, Parques_cientificos P, Carateristicas_instalacoes C WHERE I.id_carateristicas = C.id_carateristicas AND C.estacionamento = 1 OR C.videovigilancia = 1 OR C.seguranca = 1 AND C.tipo_de_rede = '" + textBox_RedeInstalacao.Text + "'";
                DataTable dtInstalacoes    = ConecaoSQLServer.ExecutaSql(queryInstalacoes);
                int[]     cartInstMaisImp  = new int[dtInstalacoes.Rows.Count];
                for (int i = 0; i < dtInstalacoes.Rows.Count; i++)
                {
                    cartInstMaisImp[i] = Int32.Parse(dtInstalacoes.Rows[i][0].ToString());
                }

                //preenche a matriz Caract. Instalações e calcula a matriz com o metodo ahp e retorna um vetor com os RESULTADOS
                resCaclMatrizCartInst = CalcSimulacao.PreencheMatriz(tdParques, cartInstMaisImp, cartInstalacao);
            }

            //########################################################################################################################################################################
            //busca os parques com o incubadoras
            double[] resCaclMatrizInc = new double[tdParques.Length];;
            if (checkBox1.Checked)
            {
                temIncubadora = 0;
                string    querySerIncubadora = "SELECT P.id_parque, P.nome_parque FROM Parques_cientificos P WHERE P.temIncubadora = 0";
                DataTable dtSerIncubadora    = ConecaoSQLServer.ExecutaSql(querySerIncubadora);
                int[]     incMaisImp         = new int[dtSerIncubadora.Rows.Count];
                for (int i = 0; i < dtSerIncubadora.Rows.Count; i++)
                {
                    incMaisImp[i] = Int32.Parse(dtSerIncubadora.Rows[i][0].ToString());
                }

                //preenche a matriz INCUBADORA e calcula a matriz com o metodo ahp e retorna um vetor com os RESULTADOS
                resCaclMatrizInc = CalcSimulacao.PreencheMatriz(tdParques, incMaisImp, serIncubadora);
            }
            else if (checkBox2.Checked)
            {
                temIncubadora = 1;
                string    querySerIncubadora = "SELECT P.id_parque, P.nome_parque FROM Parques_cientificos P WHERE P.temIncubadora = 1";
                DataTable dtSerIncubadora    = ConecaoSQLServer.ExecutaSql(querySerIncubadora);
                int[]     incMaisImp         = new int[dtSerIncubadora.Rows.Count];
                for (int i = 0; i < dtSerIncubadora.Rows.Count; i++)
                {
                    incMaisImp[i] = Int32.Parse(dtSerIncubadora.Rows[i][0].ToString());
                }

                //preenche a matriz INCUBADORA e calcula a matriz com o metodo ahp e retorna um vetor com os RESULTADOS
                resCaclMatrizInc = CalcSimulacao.PreencheMatriz(tdParques, incMaisImp, serIncubadora);
            }

            //#######################################################################################################################################################################
            //busca os parques com o mesmo tipo de instalação na comboBox  //ALTERAR PARAO TIPO DE ESPAÇO DA INCUBADORA????????????
            string    queryTipoInst = "SELECT P.id_parque FROM Instalacoes I, Parques_cientificos P WHERE I.id_parque = P.id_parque AND I.designaca = '" + comboBox5.SelectedText + "'";
            DataTable dtTipoInst    = ConecaoSQLServer.ExecutaSql(queryTipoInst);

            int[] tipoInstMaisImp = new int[dtTipoInst.Rows.Count];
            for (int i = 0; i < dtTipoInst.Rows.Count; i++)
            {
                tipoInstMaisImp[i] = Int32.Parse(dtTipoInst.Rows[i][0].ToString());
            }

            //preenche a matriz TIPO INSTALAÇÃO e calcula a matriz com o metodo ahp e retorna um vetor com os RESULTADOS
            double[] resCaclMatrizTipoInst = new double[tdParques.Length];
            resCaclMatrizTipoInst = CalcSimulacao.PreencheMatriz(tdParques, tipoInstMaisImp, tipoInstalacao);

            //#######################################################################################################################################################################
            //RESULTADO da SIMULAÇÃO
            resSimulacao = CalcSimulacao.CalcSimulacaoAhp(resCaclCriterios, resCaclMatrizLocal, resCaclMatrizFase, resCaclMatrizAreas, resCaclMatrizVolNeg, resCaclMatrizCartInst, resCaclMatrizInc, resCaclMatrizTipoInst, tdParques.Length);
            dadosDataGrid(resSimulacao, tdParques, nomeParques, emailParques);//mostra resultado no datagrid

            button_guardar.Visible = true;
            label39.Visible        = true;
            //button3.Visible = true;
            //button_ConfirmarDados.Enabled = false;
        }