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();
        }
        private void BTEXCLUIR_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Tem certeza que deseja Excluir esse Registro ?", "Excluír Registro", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
            {
                if (txtIDMEDICO.Text == string.Empty)
                {
                    MessageBox.Show(" Verifique campos em Branco !", "Falha ao Excluír !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    int resultado = 0;

                    resultado = MedicoDAL.Excluir(Convert.ToInt16(txtIDMEDICO.Text));

                    if (resultado == 1)
                    {
                        MessageBox.Show("Registro excluido com sucesso ! ! !");
                    }
                    else
                    {
                        MessageBox.Show("O Médico : " + txtNOMEMEDICO.Text + " ainda possui Consultas !", "Falha na Exclusão");
                    }
                }
            }


            this.tabela_load();
        }
        private void btPESQUISAR_Click(object sender, EventArgs e)
        {
            DataSet ds = MedicoDAL.pesquisa(txtPESQUISA.Text);

            tabela.DataSource = ds;
            tabela.DataMember = ds.Tables[0].TableName;
        }
        private void tabela_load()
        {
            DataSet ds = MedicoDAL.atualizaTabela();

            tabela.DataSource = ds;
            tabela.DataMember = ds.Tables[0].TableName;
        }
Exemple #5
0
        public MedicoDTO CarregaMedicoDTO(int med_id)
        {
            MedicoDAL dalObj = new MedicoDAL(conexao);

            dalObj.CarregaMedicoDTO(med_id);

            return(dalObj.CarregaMedicoDTO(med_id));
        }
Exemple #6
0
        public DataTable Pesquisar(String med_nome)
        {
            MedicoDAL dalObj = new MedicoDAL(conexao);

            dalObj.Pesquisar(med_nome);

            return(dalObj.Pesquisar(med_nome));
        }
Exemple #7
0
        public async Task <List <Medico> > GetMedicosAsync()
        {
            MedicoDAL dal = new MedicoDAL();

            ListaMedicos = await dal.GetMedicosAsync();

            return(ListaMedicos);
        }
Exemple #8
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);
        }
        private void BTCADASTRAR_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtNOMEMEDICO.Text) && string.IsNullOrEmpty(txtCRM.Text))
            {
                MessageBox.Show(" Verifique campos em Branco !", "Falha ao Inserir !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                int resultado = 0;

                resultado = MedicoDAL.Cadastrar(txtNOMEMEDICO.Text, txtCRM.Text);

                if (resultado == 1)
                {
                    MessageBox.Show("Registro inserido com sucesso ! ! !");
                }
                else
                {
                    MessageBox.Show("Falha ao inserir o registro  ! ! !");
                }
            }
            this.tabela_load();
        }
Exemple #10
0
        public void Excluir(int med_id)
        {
            MedicoDAL dalObj = new MedicoDAL(conexao);

            dalObj.Excluir(med_id);
        }
Exemple #11
0
        public async Task <int> EliminarMedicoAsync(string cmp)
        {
            var dal = new MedicoDAL();

            return(await dal.EliminarMedicoAsync(cmp));
        }
Exemple #12
0
        public async Task <int> ActualizarMedicoAsync(Medico medico)
        {
            MedicoDAL dal = new MedicoDAL();

            return(await dal.ActualizarMedicoAsync(medico));
        }
Exemple #13
0
        public async Task <int> InsertMedicoAsync(Medico medico)
        {
            MedicoDAL dal = new MedicoDAL();

            return(await dal.InsertarMedicoAsync(medico));
        }