private void Row_DoubleClick(object sender, RoutedEventArgs e)
        {
            var o = this.data1.SelectedItem;

            try
            {
                Utilizadores utilizador = (Utilizadores)data1.SelectedItem;
                if (utilizador.StampUtilizador.Trim() != "")
                {
                    PainelCentro.id_utilizador = utilizador.StampUtilizador;
                    PainelCentro.Escolhe_Painel(13, false);
                }
            }
            catch { }
        }
Beispiel #2
0
        private void Row_DoubleClick(object sender, RoutedEventArgs e)
        {
            var o = this.data1.SelectedItem;

            try
            {
                Pessoas pessoa = (Pessoas)data1.SelectedItem;
                if (pessoa.StampPessoa.Trim() != "")
                {
                    PainelCentro.bi = pessoa.StampPessoa;
                    PainelCentro.Escolhe_Painel(5, false);
                }
            }
            catch { }
        }
Beispiel #3
0
        private void Row_DoubleClick(object sender, RoutedEventArgs e)
        {
            var o = this.data1.SelectedItem;

            try
            {
                Projetos projeto = (Projetos)data1.SelectedItem;

                if (projeto.StampProjeto.Trim() != "")
                {
                    PainelCentro.id_projeto = projeto.StampProjeto;
                    PainelCentro.Escolhe_Painel(6, false);
                }
            }
            catch { }
        }
        private void Row_DoubleClick(object sender, RoutedEventArgs e)
        {
            var o = this.data1.SelectedItem;

            try
            {
                BasesDados bd = (BasesDados)data1.SelectedItem;

                if (bd.StampBaseDados.Trim() != "")
                {
                    PainelCentro.id_bd = bd.StampBaseDados;
                    PainelCentro.Escolhe_Painel(8, false);
                }
            }
            catch { }
        }
        private void Row_DoubleClick(object sender, RoutedEventArgs e)
        {
            try
            {
                object selectedItem = ((DataGrid)data1).SelectedItem;
                Type   type2        = selectedItem.GetType();

                string id_tab = (string)type2.GetProperty("ID_Conhecimento").GetValue(selectedItem, null);

                if (id_tab != "")
                {
                    PainelCentro.id_conhecimento = id_tab;
                    PainelCentro.Escolhe_Painel(10, false);
                }
            }
            catch { }
        }
        public void Add_Edit_Subtype()
        {
            if (AutoComplete1.Text.Trim() == "")
            {
                System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show("Tem que preencher o tipo!\n Deseja criar um tipo novo?",
                                                                                                "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(11, true);
                    break;

                default:
                    break;
                }
            }
            else
            {
                if (textbox_Nome.Text.Trim() == "")
                {
                    System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show("Tem que preencher o Nome!",
                                                                                                    "Aviso!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
                }
                else
                {
                    if (textbox_Nome.IsReadOnly == false)
                    {
                        bool          done = true, window = true;
                        string        msg = "";
                        List <string> ls  = new List <string>();

                        if (AutoComplete1.Text != " ")
                        {
                            string nr = type.getIDFromNomeTipo(AutoComplete1.Text);

                            if (nr != "")
                            {
                                ls.Add("");
                                ls.Add(Convert.ToString(nr));
                                ls.Add(textbox_Nome.Text);
                                ls.Add(DescricaoTipo.Text);
                                ls.Add("");
                                ls.Add("");
                                ls.Add("");
                                ls.Add("");
                                ls.Add("");
                                ls.Add("");
                                ls.Add("");

                                if (id_subtype == "")
                                {
                                    done = subtype.InsertSubtipo(ls);

                                    if (done == true)
                                    {
                                        msg = "Adicionado com sucesso!";
                                    }
                                    else
                                    {
                                        msg = "Erro ao adicionar!\nVerifique se já existe esse subtipo.";
                                    }
                                }
                                else
                                {
                                    System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show("Tem a certeza que pretende alterar os dados?",
                                                                                                                    "Pergunta!", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);

                                    switch (result)
                                    {
                                    case System.Windows.Forms.DialogResult.Yes:

                                        done = subtype.UpdateSubtipo(id_subtype, ls);

                                        if (done == true)
                                        {
                                            msg = "Editado com sucesso!";
                                        }
                                        else
                                        {
                                            msg = "Erro ao fazer update!";
                                        }

                                        break;

                                    default:
                                        window = false;
                                        break;
                                    }
                                }


                                if (window == true)
                                {
                                    System.Windows.Forms.MessageBox.Show(msg,
                                                                         "Informação!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
                                    ActualizaItemSource(subtype.getSubtipo());

                                    if (done == true)
                                    {
                                        AutoComplete1.Text        = "";
                                        textbox_Nome.Text         = "";
                                        DescricaoTipo.Text        = "";
                                        AutoComplete1.BorderBrush = Brushes.Red;
                                        textbox_Nome.BorderBrush  = Brushes.Red;
                                    }
                                }
                            }
                            else
                            {
                                System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show("O tipo inserido é inválido!\n Deseja criar um tipo novo?",
                                                                                                                "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(11, true);
                                    break;

                                default:
                                    break;
                                }
                            }
                        }
                        else
                        {
                            System.Windows.Forms.MessageBox.Show("Tem que seleccionar um tipo!",
                                                                 "Informação!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
                        }
                    }
                }
            }
        }