Esempio n. 1
0
        private void cmd_inserir_Click(object sender, EventArgs e)
        {
            Geral.AtualizaListaDeContatos();
            var frmInserirEditar = new frmInserirEditar();

            frmInserirEditar.ShowDialog();
        }
Esempio n. 2
0
        private void cmd_editar_Click(object sender, EventArgs e)
        {
            var contato = Geral.BuscarContatoLista(LB_lista_contatos.SelectedIndex);

            text_nome.Text     = contato.nome;
            text_numero.Text   = contato.numero;
            cmd_gravar.Enabled = true;
            text_nome.Focus();
        }
Esempio n. 3
0
 private void cmd_apagar_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Tem certeza que deseja apagar o registro ?", "Atenção!", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
     {
         Geral.ApagaContadoLista(LB_lista_contatos.SelectedIndex);
         CarregarDadosLista();
         LimparDadosTextBox();
         cmd_gravar.Enabled = true;
     }
 }
Esempio n. 4
0
        public frmMenu()
        {
            InitializeComponent();

            //Carrega a lista de contatos
            Geral.AtualizaListaDeContatos();

            //Apresenta a versão do programa
            label_versao.Text = Geral.versao;
        }
Esempio n. 5
0
        private void frmResultado_Load(object sender, EventArgs e)
        {
            var lst = Geral.BuscarContatoLista(texto);

            lista_resultado_pesquisa.Items.Clear();

            foreach (var contato in lst)
            {
                lista_resultado_pesquisa.Items.Add($"{contato.nome.PadRight(25)} ({int.Parse(contato.numero).ToString(@"0000-0000")})");
            }

            label_numero_registros.Text = $"Qtd Registros: {lst.Count}";
        }
Esempio n. 6
0
        private void cmd_gravar_Click(object sender, EventArgs e)
        {
            //Verifica se todos os campos foram preenchidos

            if (text_nome.Text == "" || text_numero.Text == "")
            {
                MessageBox.Show("É necessario que todos os campos estejam preenchidos");
                return;
            }

            if (text_numero.Text.Length < 8)
            {
                MessageBox.Show("É necessario que o telefone tenha no mínimo 8 dígitos");
                return;
            }


            if (Geral.VerificaDulicidadeContato(text_nome.Text.ToUpper(), text_numero.Text))
            {
                MessageBox.Show("Já existe um contato registrado com este Nome e Numero.");
                return;
            }

            if (LB_lista_contatos.SelectedIndex != -1)
            {
                Geral.InserirContatoLista(text_nome.Text.ToUpper(), text_numero.Text, LB_lista_contatos.SelectedIndex);
                Geral.AtualizaArquivoBancoDeDados();
                CarregarDadosLista();
                LimparDadosTextBox();
                return;
            }

            Geral.InserirContatoLista(text_nome.Text.ToUpper(), text_numero.Text);
            CarregarDadosLista();
            LimparDadosTextBox();
        }