コード例 #1
0
        private void ActualizaControls()
        {
            try
            {
                idPro = projecto.getIDFromNomeProjetos(AutoComplete1.Text);

                if (idPro.Trim() == "")
                {
                    combo_BD.SelectedIndex    = 0;
                    combo_BD.IsHitTestVisible = false;
                    return;
                }
                else
                {
                    int count = basesDados.Existe_Databases_Projetos(idPro);
                    combo_BD.IsHitTestVisible = true;
                    if (count < 1)
                    {
                        System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show("Não existem Bases de Dados associadas a esse projeto!\n Deseja criar uma?",
                                                                                                        "Aviso!", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Warning);

                        switch (result)
                        {
                        case System.Windows.Forms.DialogResult.Yes:
                            PainelCentro.Escolhe_Painel(1, false);
                            PainelCentro.Escolhe_Painel(8, true);
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        try
                        {
                            bd2 = basesDados.BD_Projetos(idPro);
                            lock (combo_BD)
                            {
                                ComboListBD.Clear();
                                combo_BD.ItemsSource   = ComboListBD;
                                combo_BD.SelectedIndex = 0;
                            }

                            ComboListBD.Add(" ");

                            foreach (BasesDados b in bd2)
                            {
                                ComboListBD.Add(b.Initialcatalog.ToString());
                            }

                            combo_BD.ItemsSource   = ComboListBD;
                            combo_BD.SelectedIndex = 0;
                        }
                        catch
                        {
                            combo_BD.SelectedIndex    = 0;
                            combo_BD.IsHitTestVisible = false;
                        }
                    }
                }
            }
            catch
            {
            }
        }
コード例 #2
0
        public void Preenche(string id)
        {
            ViewModels.Projeto projeto = new ViewModels.Projeto();

            id_Projeto = id;

            var ls = projeto.getProjetosDetails(id);

            NomeProjeto.Text       = ls.Nome;
            MoradaProjeto.Text     = ls.Morada;
            LocalidadeProjeto.Text = ls.Localidade;
            CodPostalProjeto.Text  = ls.CodPostal;
            TelemovelProjeto.Text  = ls.Telemovel;
            TelefoneProjeto.Text   = ls.Telefone;
            FaxProjeto.Text        = ls.Fax;
            EmailProjeto.Text      = ls.Email;
            SiteProjeto.Text       = ls.Site;
            DescricaoProjeto.Text  = ls.Descricacao;
            AutoComplete2.Text     = ls.NomeConsultor;

            Entidade e2 = new Entidade();

            string[] name = e2.NomeEntidade(ls.StampEntidade);
            AutoComplete1.Text = name[0];

            int num = databases.Existe_Databases_Projetos(id_Projeto);

            if (num > 0)
            {
                tabDatabases.Visibility = System.Windows.Visibility.Visible;
                dgbd = new Controls.DataGridDatabases(databases.BD_Projetos(id_Projeto), PainelCentro);
                tabDatabases.Content = dgbd;
            }
            else
            {
                TabCentro.Items.Remove(tabDatabases);
            }

            num = conhecimento.Existe_Conhecimento_Projeto(id_Projeto);

            if (num > 0)
            {
                tabConhecimento.Visibility = System.Windows.Visibility.Visible;
                dgc = new Controls.DataGridConhecimento(conhecimento.getConhecimentoProjeto(id_Projeto), PainelCentro);
                tabConhecimento.Content = dgc;
            }
            else
            {
                TabCentro.Items.Remove(tabConhecimento);
            }

            if (AutoComplete1.Text.Trim() != "")
            {
                AutoComplete1.BorderBrush = Brushes.Gray;
            }

            if (NomeProjeto.Text.Trim() != "")
            {
                NomeProjeto.BorderBrush = Brushes.Gray;
            }

            if (AutoComplete1.Text.Trim() != "" && NomeProjeto.Text.Trim() != "")
            {
                buttonsDetails.AlterDataButtonSave(1);
            }
        }
コード例 #3
0
 protected void RefreshBD(object sender, EventArgs e)
 {
     dgbd.ActualizaItemSource(databases.BD_Projetos(id_Emp));
 }