コード例 #1
0
        private void BTALTERAR_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Tem certeza que deseja Alterar esse Registro ?", "Alterar Registro", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
            {
                if ((txtIDMEDICO.Text == string.Empty) && (txtNOMEMEDICO.Text == string.Empty) && (txtCRM.Text == string.Empty))
                {
                    MessageBox.Show(" Verifique campos em Branco !", "Falha ao Alterar !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    int resultado = 0;

                    resultado = MedicoDAL.Alterar(txtNOMEMEDICO.Text, txtCRM.Text, Convert.ToInt16(txtIDMEDICO.Text));


                    if (resultado == 1)
                    {
                        MessageBox.Show("Registro alterado com sucesso ! ! !");
                    }
                    else
                    {
                        MessageBox.Show("Falha ao alterar o registro  ! ! !");
                    }
                }
            }
            this.tabela_load();
        }
コード例 #2
0
        public void Alterar(MedicoDTO medBllCrud)
        {
            if (medBllCrud.Med_nome.Trim().Length == 0) //verifica se foi informado o nome animal e ou se esta vazio
            {
                throw new Exception("O nome do médico é obrigatório");
            }

            medBllCrud.Med_nome = medBllCrud.Med_nome.ToUpper(); //coloca em maiusculo

            MedicoDAL dalObj = new MedicoDAL(conexao);

            dalObj.Alterar(medBllCrud);
        }