private void bunifuThinButton24_Click(object sender, EventArgs e)
        {
            if (nometratamento.Text == ("") || plano.Text == ("") || precotratamento.Text == ("") || iniciotermino.Text == ("") || descricaotratamento.Text == ("") || dentesregiao.Text == (""))
            {
                MessageBox.Show("Campo invalido ou vazio");
            }
            else
            {
                Construtor C  = new Construtor();
                Dal        C1 = new Dal();
                C.idpacientetratamento = Convert.ToString(ID_Paciente);
                C.plano               = plano.Text;
                C.nometratamento      = nometratamento.Text;
                C.dentesregiao        = dentesregiao.Text;
                C.precotratamento     = precotratamento.Text;
                C.descricaotratamento = descricaotratamento.Text;
                C.iniciotratamento    = iniciotermino.Text;
                C1.AdicionarTratamento(C);

                plano.Text               = "";
                nometratamento.Text      = "";
                dentesregiao.Text        = "";
                precotratamento.Text     = "";
                descricaotratamento.Text = "";
                iniciotermino.Text       = "";


                String          caminhobd = "Server=127.0.0.1;DATABASE=tcc_consultorio;UID=root;PASSWORD=";
                MySqlConnection con       = new MySqlConnection(caminhobd);
                con.Open();
                tratamentoTableAdapter.FillBy_Tipo(tcc_consultorioDataSet3.tratamento, ID_Paciente);
                this.pacienteTableAdapter.Fill(tcc_consultorioDataSet.paciente);
                con.Close();
            }
        }
Exemple #2
0
        private void bunifuThinButton23_Click(object sender, EventArgs e)
        {
            Construtor C  = new Construtor();
            Dal        C1 = new Dal();

            C.nomedentista     = Nome_Dentista.Text;
            C.rgdentista       = RG_Dentista.Text;
            C.cpfdentista      = CPF_Dentista.Text;
            C.nascdentista     = Data.Value.ToShortDateString();
            C.celdentista      = Celular_Dentista.Text;
            C.teldentista      = Telefone_Dentista.Text;
            C.enderecodentista = Endereco_Dentista.Text;
            C.emaildentista    = Email_Dentista.Text;
            C.primeiraarea     = Especialidade1.Text;
            C.segundaarea      = Especialidade2.Text;
            C1.CadastrarDentista(C);
            Nome_Dentista.Text     = "";
            RG_Dentista.Text       = "";
            CPF_Dentista.Text      = "";
            Data.Value             = DateTime.Today;
            Celular_Dentista.Text  = "";
            Telefone_Dentista.Text = "";
            Endereco_Dentista.Text = "";
            Email_Dentista.Text    = "";
            Especialidade1.Text    = "";
            Especialidade2.Text    = "";
        }
        private void bunifuThinButton23_Click_1(object sender, EventArgs e)
        {
            Construtor C  = new Construtor();
            Dal        C1 = new Dal();

            C.idtratamento = ID_Tratamento;
            C1.ExcluirTratamento(C);

            plano.Text               = "";
            nometratamento.Text      = "";
            dentesregiao.Text        = "";
            precotratamento.Text     = "";
            descricaotratamento.Text = "";
            iniciotermino.Text       = "";


            String          caminhobd = "Server=127.0.0.1;DATABASE=tcc_consultorio;UID=root;PASSWORD="******"Dados excluidos com sucesso");
        }
        private void Alterar_Click(object sender, EventArgs e)
        {
            if (Id_Paciente.Text == (""))
            {
                panel1.Show();
                MessageBox.Show("Seleciona um profissional");
            }
            else
            {
                Construtor C  = new Construtor();
                Dal        C1 = new Dal();
                C.idpaciente        = Convert.ToInt32(Id_Paciente.Text);
                C.nomepaciente      = nome_paciente.Text;
                C.rgpaciente        = rg_paciente.Text;
                C.cpfpaciente       = cpf_paciente.Text;
                C.nascpaciente      = nasc_paciente.Text;
                C.celpaciente       = cel_paciente.Text;
                C.telpaciente       = tel_paciente.Text;
                C.enderecopaciente  = endereco_paciente.Text;
                C.emailpaciente     = email_paciente.Text;
                C.estcivilpaciente  = estcivil_paciente.SelectedText;
                C.profissaopaciente = profissao_paciente.Text;

                C1.AlterarPaciente(C);
                MessageBox.Show("Dados alterados com sucesso");

                Id_Paciente.Text        = "";
                nome_paciente.Text      = "";
                rg_paciente.Text        = "";
                cpf_paciente.Text       = "";
                nasc_paciente.Text      = "";
                cel_paciente.Text       = "";
                tel_paciente.Text       = "";
                endereco_paciente.Text  = "";
                email_paciente.Text     = "";
                estcivil_paciente.Text  = "";
                profissao_paciente.Text = "";
                anotacoes_paciente.Text = "";
                String          caminhobd = "Server=127.0.0.1;DATABASE=tcc_consultorio;UID=root;PASSWORD="******"0";
                tratamentoTableAdapter.FillBy_tratamento(tcc_consultorioDataSet5.tratamento, Convert.ToInt32(Id_Paciente.Text));
                con.Close();


                Alterar.Visible = false;
                Excluir.Visible = false;
                Limpar.Hide();
            }
        }
        // Excluir Paciente

        public void ExcluirPaciente(Construtor C)
        {
            String caminhobd = "Server=127.0.0.1;DATABASE=tcc_consultorio;UID=root;PASSWORD="******"delete from tratamento where ID_Paciente_Tratamento = '" + C.idpaciente + "'; delete from paciente where id_paciente = '" + C.idpaciente + ";'";
                MySqlCommand    command         = new MySqlCommand(excluirpaciente, con);
                MySqlDataReader myreader;
                myreader = command.ExecuteReader();
            }
            catch (Exception ex)
            {
                throw new Exception("Deu merda mermao " + ex.Message);
            }
        }
        // Consulta/Tratamento adicionar
        public void AdicionarTratamento(Construtor C)
        {
            String caminhobd = "Server=127.0.0.1;DATABASE=tcc_consultorio;UID=root;PASSWORD="******"insert into tratamento(ID_Paciente_Tratamento, Nome, Dentes, Inicio, Descricao, Preco, Plano)" + "values(" + C.idpacientetratamento + ",'" + C.nometratamento + "','" + C.dentesregiao + "','" + C.iniciotratamento + "','" + C.descricaotratamento + "','" + C.precotratamento + "','" + C.plano + "')";
                MySqlCommand    command             = new MySqlCommand(adicionartratamento, con);
                MySqlDataReader myreader;
                myreader = command.ExecuteReader();
                System.Windows.Forms.MessageBox.Show("Dados gravados com sucesso");
            }
            catch (Exception ex)
            {
                throw new Exception("Deu merda mermao " + ex.Message);
            }
        }
        //alterar paciente
        public void AlterarPaciente(Construtor C)
        {
            String caminhobd = "Server=127.0.0.1;DATABASE=tcc_consultorio;UID=root;PASSWORD="******"update paciente set id_paciente = '" + C.idpaciente + "',nome_paciente = '" + C.nomepaciente + "', rg_paciente ='" + C.rgpaciente + "', cpf_paciente='" + C.cpfpaciente + "', nasc_paciente= '" + C.nascpaciente + "', cel_paciente='" + C.celpaciente + "', tel_paciente ='" + C.telpaciente + "', endereco_paciente ='" + C.enderecopaciente + "', email_paciente ='" + C.emailpaciente + "', estcivil_paciente ='" + C.estcivilpaciente + "', profissao_paciente ='" + C.profissaopaciente + "', anotacoes_paciente='" + C.anotacoespaciente + "'where id_paciente ='" + C.idpaciente + "';";
                MySqlCommand    command         = new MySqlCommand(alterarpaciente, con);
                MySqlDataReader myreader;
                myreader = command.ExecuteReader();
            }
            catch (Exception ex)
            {
                throw new Exception("Deu merda mermao " + ex.Message);
            }
        }
        //Cadastrar Paciente
        public void CadastrarPaciente(Construtor C)
        {
            String caminhobd = "Server=127.0.0.1;DATABASE=tcc_consultorio;UID=root;PASSWORD="******"insert into paciente(nome_paciente, rg_paciente, cpf_paciente, nasc_paciente, cel_paciente,tel_paciente, endereco_paciente, email_paciente, estcivil_paciente, profissao_paciente, anotacoes_paciente)" + "values('" + C.nomepaciente + "','" + C.rgpaciente + "','" + C.cpfpaciente + "','" + C.nascpaciente + "','" + C.celpaciente + "','" + C.telpaciente + "','" + C.enderecopaciente + "','" + C.emailpaciente + "','" + C.estcivilpaciente + "','" + C.profissaopaciente + "','" + C.anotacoespaciente + "')";
                MySqlCommand    command           = new MySqlCommand(adicionarpaciente, con);
                MySqlDataReader myreader;
                myreader = command.ExecuteReader();
            }
            catch (Exception ex)
            {
                throw new Exception("Deu merda mermao " + ex.Message);
            }
        }
        //dal do usuario
        public void CadastrarUsuario(Construtor A)
        {
            String caminhobd = "Server=127.0.0.1;DATABASE=tcc_consultorio;UID=root;PASSWORD="******"insert into usuario(login,senha)" + "values('" + A.login + "','" + A.senha + "')";
                MySqlCommand    command   = new MySqlCommand(adicionar, conexao);
                MySqlDataReader myreader;
                myreader = command.ExecuteReader();
            }
            catch (Exception ex)
            {
                throw new Exception("Deu merda mermao " + ex.Message);
            }
        }
        //Cadastrar Dentista
        public void CadastrarDentista(Construtor C)
        {
            String caminhobd = "Server=127.0.0.1;DATABASE=tcc_consultorio;UID=root;PASSWORD="******"insert into dentista(nome_dentista, rg_dentista, cpf_dentista, nasc_dentista, cel_dentista,tel_dentista, endereco_dentista, email_dentista, 1area, 2area)" + "values('" + C.nomedentista + "','" + C.rgdentista + "','" + C.cpfdentista + "','" + C.nascdentista + "','" + C.celdentista + "','" + C.teldentista + "','" + C.enderecodentista + "','" + C.emaildentista + "','" + C.primeiraarea + "','" + C.segundaarea + "')";
                MySqlCommand    command           = new MySqlCommand(adicionardentista, con);
                MySqlDataReader myreader;
                myreader = command.ExecuteReader();
                con.Close();
            }
            catch (Exception ex)
            {
                throw new Exception("Deu merda mermao " + ex.Message);
            }
        }
        // Consulta/Tratamento alterar

        public void AlterarTratamento(Construtor C)
        {
            String caminhobd = "Server=127.0.0.1;DATABASE=tcc_consultorio;UID=root;PASSWORD="******"update tratamento set ID_Tratamento = '" + C.idtratamento + "', Nome ='" + C.nometratamento + "', Dentes='" + C.dentesregiao + "', Inicio = '" + C.iniciotratamento + "', Descricao='" + C.descricaotratamento + "', Preco ='" + C.precotratamento + "', Plano ='" + C.plano + "'where ID_Tratamento ='" + C.idtratamento + "';";
                MySqlCommand    command           = new MySqlCommand(alterartratamento, con);
                MySqlDataReader myreader;
                myreader = command.ExecuteReader();
                con.Close();
            }
            catch (Exception ex)
            {
                throw new Exception("Deu merda mermao " + ex.Message);
            }
        }
        private void bunifuThinButton22_Click(object sender, EventArgs e)
        {
            Construtor A  = new Construtor();
            Dal        A1 = new Dal();

            A.login = bunifuMaterialTextbox1.Text;
            A.senha = bunifuMaterialTextbox2.Text;
            A1.CadastrarUsuario(A);

            if (bunifuMaterialTextbox1.Text == ("") || bunifuMaterialTextbox2.Text == (""))
            {
                MessageBox.Show("Login ou Senha vazio!!!");
            }

            else
            {
                MessageBox.Show("Cadastrado com Sucesso!!!");
                panel_cadastro.Hide();
                panel_login.Show();
            }
        }
        private void alterartratamento_Click(object sender, EventArgs e)
        {
            Construtor C  = new Construtor();
            Dal        C1 = new Dal();

            C.idtratamento        = ID_Tratamento;
            C.plano               = plano.Text;
            C.nometratamento      = nometratamento.Text;
            C.dentesregiao        = dentesregiao.Text;
            C.precotratamento     = precotratamento.Text;
            C.descricaotratamento = descricaotratamento.Text;
            C.iniciotratamento    = iniciotermino.Text;
            C1.AlterarTratamento(C);

            String          caminhobd = "Server=127.0.0.1;DATABASE=tcc_consultorio;UID=root;PASSWORD="******"Dados alterados com sucesso");
        }