コード例 #1
0
        private void BOTAOSALVAR_Click(object sender, EventArgs e)
        {
            if (validaDados())
            {
                SeguradoraModelo seguradora = new SeguradoraModelo();
                if (EDITCODIGO.Text != "" && EDITCODIGO.Text != null)
                {
                    seguradora.codigo = Convert.ToInt32(EDITCODIGO.Text);
                }

                seguradora.nome     = EDITNOME.Text;
                seguradora.ddd      = EDITDDD.Text;
                seguradora.telefone = EDITTELEFONE.Text;

                SeguradoraControle seguradoracontrole = new SeguradoraControle();
                if (EDITCODIGO.Text != "" || (EDITCODIGO.Text == null))
                {
                    seguradoracontrole.alterar(seguradora);
                }
                else
                {
                    seguradoracontrole.salvar(seguradora);
                }
                MessageBox.Show("Cadastro realizado com sucesso", "Cadastro de Seguradoras");


                limpaTela();
            }
        }