private void btnExcluir_Click(object sender, EventArgs e)
        {
            SqlConnection conexao = new SqlConnection(Banco.enderecoBanco());
            SqlCommand    query   = new SqlCommand();

            query.Connection = conexao;
            conexao.Open();

            query.Parameters.AddWithValue("@pkAluno", pkAluno);

            //query.CommandText = "UPDATE aluno SET statusCadastro = 999 where pkAluno = @pkAluno";
            //query.ExecuteNonQuery();

            query.CommandText = "UPDATE usuario SET statusCadastro = 999 where fkAluno = @pkAluno";

            int cont = query.ExecuteNonQuery();

            if (cont > 0)
            {
                MessageBox.Show("Removido com sucesso");
            }
            else
            {
                MessageBox.Show("Erro ao remover");
            }


            FormCadastroAluno_Load(null, null);
            conexao.Close();
            Limpar.limparComponentes(this);
        }
Exemple #2
0
    public static void Servidor_Dados()
    {
        // Limpa os dados
        Limpar.Servidor_Dados();

        // Se o arquivo não existir, não é necessário carregá-lo
        if (!Diretórios.Servidor_Dados.Exists)
        {
            Escrever.Servidor_Dados();
            return;
        }

        // Cria um sistema binário para a manipulação dos dados
        BinaryReader Binário = new BinaryReader(Diretórios.Servidor_Dados.OpenRead());

        // Lê os dados
        Listas.Servidor_Dados.Game_Nome       = Binário.ReadString();
        Listas.Servidor_Dados.Mensagem        = Binário.ReadString();
        Listas.Servidor_Dados.Porta           = Binário.ReadInt16();
        Listas.Servidor_Dados.Máx_Jogadores   = Binário.ReadByte();
        Listas.Servidor_Dados.Máx_Personagens = Binário.ReadByte();
        Listas.Servidor_Dados.Num_Classes     = Binário.ReadByte();
        Listas.Servidor_Dados.Num_Azulejos    = Binário.ReadByte();
        Listas.Servidor_Dados.Num_Mapas       = Binário.ReadInt16();
        Listas.Servidor_Dados.Num_NPCs        = Binário.ReadInt16();
        Listas.Servidor_Dados.Num_Itens       = Binário.ReadInt16();

        // Fecha o sistema
        Binário.Dispose();
    }
Exemple #3
0
    private void butLimpar_Click(object sender, EventArgs e)
    {
        // Limpa os dados
        Limpar.NPC(Selecionado);

        // Atualiza os valores
        lstLista.Items[Selecionado - 1] = Globais.Numeração(Selecionado, lstLista.Items.Count) + ":";
        Atualizar();
    }
Exemple #4
0
    public static void Paineis_Dados()
    {
        Listas.Painel = new Listas.Estruturas.Paineis[Listas.Cliente_Dados.Num_Paineis + 1];

        // Limpa e lê os dados
        for (byte i = 1; i <= Listas.Painel.GetUpperBound(0); i++)
        {
            Limpar.Painel(i);
            Painel_Dados(i);
        }
    }
Exemple #5
0
    public static void Botões_Dados()
    {
        Listas.Botão = new Listas.Estruturas.Botões[Listas.Cliente_Dados.Num_Botões + 1];

        // Limpa e lê os dados
        for (byte i = 1; i <= Listas.Botão.GetUpperBound(0); i++)
        {
            Limpar.Botão(i);
            Botão_Dados(i);
        }
    }
Exemple #6
0
    public static void Marcadores_Dados()
    {
        Listas.Marcador = new Listas.Estruturas.Marcadores[Listas.Cliente_Dados.Num_Marcadores + 1];

        // Limpa e lê os dados
        for (byte i = 1; i <= Listas.Marcador.GetUpperBound(0); i++)
        {
            Limpar.Marcador(i);
            Marcador_Dados(i);
        }
    }
Exemple #7
0
    public static void NPCs()
    {
        Listas.NPC = new Listas.Estruturas.NPCs[Listas.Servidor_Dados.Num_NPCs + 1];

        // Limpa e lê os dados
        for (byte i = 1; i <= Listas.NPC.GetUpperBound(0); i++)
        {
            Limpar.NPC(i);
            NPC(i);
        }
    }
Exemple #8
0
    public static void Itens()
    {
        Listas.Item = new Listas.Estruturas.Itens[Listas.Servidor_Dados.Num_Itens + 1];

        // Limpa e lê os dados
        for (byte i = 1; i <= Listas.Item.GetUpperBound(0); i++)
        {
            Limpar.Item(i);
            Item(i);
        }
    }
Exemple #9
0
    public static void Classes()
    {
        Listas.Classe = new Listas.Estruturas.Classes[Listas.Servidor_Dados.Num_Classes + 1];

        // Limpa e lê os dados
        for (byte i = 1; i <= Listas.Classe.GetUpperBound(0); i++)
        {
            Limpar.Classe(i);
            Classe(i);
        }
    }
Exemple #10
0
    public static void Mapas()
    {
        Listas.Mapa = new Listas.Estruturas.Mapas[Listas.Servidor_Dados.Num_Mapas + 1];

        // Limpa e lê os dados
        for (short i = 1; i <= Listas.Mapa.GetUpperBound(0); i++)
        {
            Limpar.Mapa(i);
            Mapa(i);
        }
    }
Exemple #11
0
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            SqlConnection conexao = new SqlConnection(Banco.enderecoBanco());
            SqlCommand    comando = new SqlCommand();

            comando.Connection  = conexao;
            comando.CommandType = CommandType.Text;
            comando.CommandText = "select * from usuario where usuario = @usuario and senha = @senha and statusCadastro=0";
            comando.Parameters.AddWithValue("@usuario", txtUsuario.Text);
            comando.Parameters.AddWithValue("@senha", txtSenha.Text);
            conexao.Open();

            SqlDataReader consulta = comando.ExecuteReader(CommandBehavior.CloseConnection);

            if (!consulta.Read())
            {
                MessageBox.Show("Usuário ou senha inválido");
                Limpar.limparComponentes(this);
            }
            else
            {
                consulta.Close();
                conexao.Open();

                comando.CommandText = "SELECT levelPermissao, fkprofessor, fkaluno FROM usuario WHERE usuario = '" + txtUsuario.Text + "' and senha = '" + txtSenha.Text + "'";
                SqlDataAdapter adaptador = new SqlDataAdapter(comando);
                DataTable      tabela    = new DataTable();
                adaptador.Fill(tabela);

                //string lvl = tabela.Rows[0]["levelPermissao"].ToString();
                //int levelPermissao = Convert.ToInt32(lvl);



                Autenticacao.levelPermissao = Convert.ToInt32(tabela.Rows[0]["levelPermissao"].ToString());

                if (Autenticacao.levelPermissao == 1) //professor
                {
                    Autenticacao.pkProfessorLogado = Convert.ToInt32(tabela.Rows[0]["fkProfessor"].ToString());
                }
                else if (Autenticacao.levelPermissao == 2) //aluno
                {
                    Autenticacao.pkAlunoLogado = Convert.ToInt32(tabela.Rows[0]["fkAluno"].ToString());
                }

                //Autenticacao.levelPermissao = Convert.ToInt32(consulta.GetValue(3));

                Limpar.limparComponentes(this);
                Principal formMenu = new Principal();
                formMenu.Show();
                this.Hide();
            }
            conexao.Close();
        }
Exemple #12
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            desabilita();
            if (textBox1.Text != "" && textBox2.Text != "  /  /" && textBox3.Text != "  /  /" && comboBox1.Text != "" && textBox4.Text != "" && textBox5.Text != "  /  /")
            {
                try
                {
                    string id = dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[0].Value.ToString();

                    try
                    {
                        string[]             dmss     = textBox5.Text.Split('/');
                        DateTime             demissao = new DateTime(Convert.ToInt32(dmss[2]), Convert.ToInt32(dmss[1]), Convert.ToInt32(dmss[0]));
                        string[]             admss    = dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[4].Value.ToString().Split('/');
                        DateTime             admissao = new DateTime(Convert.ToInt32(admss[2]), Convert.ToInt32(admss[1]), Convert.ToInt32(admss[0]));
                        EnfermeiroController ec       = new EnfermeiroController();

                        if (Data.saida(admissao, demissao) && ec.delete(id, demissao))
                        {
                            MessageBox.Show("Enfermeiro excluído com sucesso!");
                            MySqlCommand sql = new MySqlCommand();
                            if (Session.stt)
                            {
                                sql.CommandText = "select id as 'Id', nome as 'Nome',  date_format(nascimento,'%d/%m/%Y') as 'Nascimento', sexo as 'Sexo', date_format(dataAdmissao,'%d/%m/%Y') as 'Admissão', login as 'Login' from enfermeiro where (dataDemissao is null or dataDemissao = @demissao)";
                            }
                            else
                            {
                                sql.CommandText = "select id as 'Id', nome as 'Nome',  date_format(nascimento,'%d/%m/%Y') as 'Nascimento', sexo as 'Sexo', date_format(dataAdmissao,'%d/%m/%Y') as 'Admissão', login as 'Login' from enfermeiro where (dataDemissao is null or dataDemissao = @demissao) and stt = false";
                            }
                            sql.Parameters.AddWithValue("@demissao", Convert.ToDateTime(null));
                            Grid.grid(dataGridView1, sql);
                            Limpar.limpar(this);
                        }
                        else
                        {
                            MessageBox.Show("Enfermeiro não pôde ser excluído!");
                        }
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Selecione algum enfermeiro para ser excluído em uma data!");
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Selecione um enfermeiro para ser excluído em uma data!");
                }
            }
            else
            {
                MessageBox.Show("Selecione algum enfermeiro para ser excluído em uma data!");
            }
        }
        private void btnCadastrar_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "" && textBox2.Text != "  /  /" && textBox3.Text != "  /  /" && comboBox1.Text != "")
            {
                try
                {
                    string             id   = dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[0].Value.ToString();
                    string             sexo = comboBox1.Text[0].ToString();
                    PacienteController pc   = new PacienteController();
                    Model.Paciente     p    = pc.search("id", id)[0];
                    p.nome = textBox1.Text;
                    p.sexo = sexo;

                    try
                    {
                        string[] nasc           = textBox2.Text.Split('/');
                        DateTime dataNascimento = new DateTime(Convert.ToInt32(nasc[2]), Convert.ToInt32(nasc[1]), Convert.ToInt32(nasc[0]));
                        string[] entr           = textBox3.Text.Split('/');
                        DateTime dataEntrada    = new DateTime(Convert.ToInt32(entr[2]), Convert.ToInt32(entr[1]), Convert.ToInt32(entr[0]));
                        p.nascimento  = dataNascimento;
                        p.dataEntrada = dataEntrada;

                        if (Data.nascimento(dataNascimento) && pc.update(p))
                        {
                            MessageBox.Show("Paciente atualizado com sucesso!");
                            Limpar.limpar(this);
                            MySqlCommand sql = new MySqlCommand();
                            sql.CommandText = "select id as 'Id', nome as 'Nome', date_format(nascimento,'%d/%m/%Y') as 'Nascimento', sexo as 'Sexo', date_format(dataEntrada,'%d/%m/%Y') as 'Entrada' from paciente where (dataSaida is null or dataSaida = @saida) and id = @id";
                            sql.Parameters.AddWithValue("@id", p.id);
                            sql.Parameters.AddWithValue("@saida", Convert.ToDateTime(null));
                            Grid.grid(dataGridView1, sql);
                        }
                        else
                        {
                            MessageBox.Show("Paciente não pôde ser atualizado!");
                        }
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Preencha tudo corretamente!");
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Selecione um paciente para ser atualizado!");
                }
            }
            else
            {
                MessageBox.Show("Preencha todos os campos!");
            }
        }
        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();
            }
        }
Exemple #15
0
    public static void Azulejos()
    {
        Listas.Servidor_Dados.Num_Azulejos = (byte)Gráficos.Tex_Azulejo.GetUpperBound(0);
        Listas.Azulejo = new Listas.Estruturas.Azulejos_Azulejo[Listas.Servidor_Dados.Num_Azulejos + 1];

        // Salva a quantidade dos azulejos
        Escrever.Servidor_Dados();

        // Limpa e lê os dados
        for (byte i = 1; i <= Listas.Azulejo.GetUpperBound(0); i++)
        {
            Limpar.Azulejo(i);
            Azulejo(i);
        }
    }
        private void btnAtualizar_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "" && textBox2.Text != "")
            {
                try
                {
                    string id        = dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[0].Value.ToString();
                    string nome      = textBox1.Text;
                    string descricao = textBox2.Text;

                    ProblemaController pc   = new ProblemaController();
                    Model.Problema     prob = pc.search("id", id)[0];
                    prob.nome      = nome;
                    prob.descricao = descricao;

                    try
                    {
                        if (pc.update(prob))
                        {
                            MessageBox.Show("Problema atualizado com sucesso!");
                            Limpar.limpar(this);

                            MySqlCommand sql = new MySqlCommand();
                            sql.CommandText = "select id as 'Id', stt as 'Status', nome as 'Nome', descricao as 'Descrição' from problema where id = @id or descricao like concat('%',@descricao,'%')";
                            sql.Parameters.AddWithValue("@id", id);
                            sql.Parameters.AddWithValue("@descricao", descricao);
                            Grid.grid(dataGridView1, sql);
                        }
                        else
                        {
                            MessageBox.Show("Problema não pôde ser atualizado!");
                        }
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Preencha tudo corretamente!");
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Selecione um problema para ser atualizado!");
                }
            }
            else
            {
                MessageBox.Show("Preencha todos os campos!");
            }
        }
    private void butLimpar_Click(object sender, EventArgs e)
    {
        // Reseta os valores
        switch ((Globais.Ferramentas_Tipos)cmbFerramentas.SelectedIndex)
        {
        case Globais.Ferramentas_Tipos.Botão: Limpar.Botão(Selecionado); break;

        case Globais.Ferramentas_Tipos.Digitalizador: Limpar.Digitalizador(Selecionado); break;

        case Globais.Ferramentas_Tipos.Painel: Limpar.Painel(Selecionado); break;

        case Globais.Ferramentas_Tipos.Marcador: Limpar.Marcador(Selecionado); break;
        }

        Atualizar();
    }
Exemple #18
0
    public static void Azulejo(byte Índice)
    {
        FileInfo Arquivo         = new FileInfo(Diretórios.Azulejos_Dados.FullName + Índice + Diretórios.Formato);
        Size     Textura_Tamanho = Gráficos.TTamanho(Gráficos.Tex_Azulejo[Índice]);
        Size     Tamanho         = new Size(Textura_Tamanho.Width / Globais.Grade - 1, Textura_Tamanho.Height / Globais.Grade - 1);

        // Cria o arquivo caso ele não existir
        if (!Arquivo.Exists)
        {
            Escrever.Azulejo(Índice);
            return;
        }

        // Cria um sistema binário para a manipulação dos dados
        BinaryReader Binário = new BinaryReader(Arquivo.OpenRead());

        // Dados básicos
        Listas.Azulejo[Índice].Largura = Binário.ReadByte();
        Listas.Azulejo[Índice].Altura  = Binário.ReadByte();

        // Previni erros (Foi trocado de azulejo)
        if (Tamanho != new Size(Listas.Azulejo[Índice].Largura, Listas.Azulejo[Índice].Altura))
        {
            Binário.Dispose();
            Limpar.Azulejo(Índice);
            Escrever.Azulejo(Índice);
            return;
        }

        for (byte x = 0; x <= Tamanho.Width; x++)
        {
            for (byte y = 0; y <= Tamanho.Height; y++)
            {
                // Atributos
                Listas.Azulejo[Índice].Azulejo[x, y].Atributo = Binário.ReadByte();

                // Bloqueio direcional
                for (byte i = 0; i <= (byte)Globais.Direções.Quantidade - 1; i++)
                {
                    Listas.Azulejo[Índice].Azulejo[x, y].Bloqueio[i] = Binário.ReadBoolean();
                }
            }
        }

        // Fecha o sistema
        Binário.Dispose();
    }
        private void btnAtualizar_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "" && textBox2.Text != "")
            {
                try
                {
                    string id        = dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[0].Value.ToString();
                    string nome      = textBox1.Text;
                    string descricao = textBox2.Text;

                    SolucaoController pc  = new SolucaoController();
                    Model.Solucao     sol = pc.search("id", id)[0];
                    sol.nome      = nome;
                    sol.descricao = descricao;

                    try
                    {
                        if (pc.update(sol))
                        {
                            MessageBox.Show("Solução atualizada com sucesso!");
                            Limpar.limpar(this);

                            MySqlCommand sql = new MySqlCommand();
                            sql.CommandText = "select id as 'Id', nome as 'Nome', descricao as 'Descrição' from solucao where id = @id";
                            sql.Parameters.AddWithValue("@id", id);
                            Grid.grid(dataGridView1, sql);
                        }
                        else
                        {
                            MessageBox.Show("Solução não pôde ser atualizada!");
                        }
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Preencha tudo corretamente!");
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Selecione uma solução para ser atualizada!");
                }
            }
            else
            {
                MessageBox.Show("Preencha todos os campos!");
            }
        }
    private static void AlterarQuantidade_Painel()
    {
        byte Quantidade = (byte)Editor_Quantidade.Objetos.numQuantidade.Value;
        byte Antes      = (byte)Listas.Painel.GetUpperBound(0);

        // Altera a quantidade de itens
        Array.Resize(ref Listas.Painel, Quantidade + 1);

        // Limpa os novos itens
        if (Quantidade > Antes)
        {
            for (byte i = (byte)(Antes + 1); i <= Quantidade; i++)
            {
                Limpar.Painel(i);
            }
        }
    }
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            desabilita();
            if (textBox1.Text != "" && textBox2.Text != "  /  /" && textBox3.Text != "  /  /" && comboBox1.Text != "" && textBox4.Text != "  /  /")
            {
                try
                {
                    string id = dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[0].Value.ToString();

                    try
                    {
                        string[]           sd      = textBox4.Text.Split('/');
                        DateTime           saida   = new DateTime(Convert.ToInt32(sd[2]), Convert.ToInt32(sd[1]), Convert.ToInt32(sd[0]));
                        string[]           entr    = dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[4].Value.ToString().Split('/');
                        DateTime           entrada = new DateTime(Convert.ToInt32(entr[2]), Convert.ToInt32(entr[1]), Convert.ToInt32(entr[0]));
                        PacienteController ec      = new PacienteController();

                        if (Data.saida(entrada, saida) && ec.delete(id, saida))
                        {
                            MessageBox.Show("Paciente excluído com sucesso!");
                            MySqlCommand sql = new MySqlCommand();
                            sql.CommandText = "select id as 'Id', nome as 'Nome', date_format(nascimento,'%d/%m/%Y') as 'Nascimento', sexo as 'Sexo', date_format(dataEntrada,'%d/%m/%Y') as 'Entrada' from paciente where (dataSaida is null or dataSaida = @saida)";
                            sql.Parameters.AddWithValue("@saida", Convert.ToDateTime(null));
                            Grid.grid(dataGridView1, sql);
                            Limpar.limpar(this);
                        }
                        else
                        {
                            MessageBox.Show("Paciente não pôde ser excluído!");
                        }
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Selecione algum paciente para ser excluído em uma data!");
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Selecione um paciente para ser excluído em uma data!");
                }
            }
            else
            {
                MessageBox.Show("Selecione algum paciente para ser excluído em uma data!");
            }
        }
Exemple #22
0
        public void RealizarSoma()
        {
            int i = 1;

            do
            {
                Dois.Click();
                Mais.Click();
                Quatro.Click();
                Igual.Click();

                StringAssert.Contains("6", Resultado.Text);

                Limpar.Click();

                i++;
            } while (i <= 3);
        }
        private void btnCadastrar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!(textBox1.Text == "" || textBox2.Text == "" || comboBox1.Text == ""))
                {
                    string nome      = textBox1.Text;
                    string descricao = textBox2.Text;
                    string problema  = Hash.md5(comboBox1.Text);
                    string id        = Hash.md5(nome);

                    SolucaoController solC = new SolucaoController();
                    Model.Solucao     sol  = new Model.Solucao(id, nome, descricao);
                    string            msg  = "";
                    if (solC.add(sol))
                    {
                        msg += "Solução cadastrada com sucesso";
                        Limpar.limpar(this);
                        dataGridView1.DataSource = null;
                        Grid.grid(dataGridView1, "select id as 'Id', nome as 'Nome', descricao as 'Descrição' from solucao where id = '" + id + "'");
                        if (solC.problemaSolucao(problema, id))
                        {
                            MessageBox.Show(msg + " e devidamente associada ao problema!");
                        }
                        else
                        {
                            MessageBox.Show(msg + ", mas não devidamente associada ao problema!");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Solução não pôde ser cadastrada!");
                    }
                }
                else
                {
                    MessageBox.Show("Informe tudo que for necessário!");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Solução não pôde ser cadastrada!");
            }
        }
Exemple #24
0
    public static void AlterarQuantidade()
    {
        int Quantidade = (int)Editor_Quantidade.Objetos.numQuantidade.Value;
        int Antes      = Listas.NPC.GetUpperBound(0);

        // Altera a quantidade de itens
        Array.Resize(ref Listas.NPC, Quantidade + 1);

        // Limpa os novos itens
        if (Quantidade > Antes)
        {
            for (byte i = (byte)(Antes + 1); i <= Quantidade; i++)
            {
                Limpar.NPC(i);
            }
        }

        Listar();
    }
        private void btnCadastrar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!(textBox1.Text == "" || textBox2.Text == "  /  /" || textBox3.Text == "  /  /" || comboBox1.Text == "" || textBox4.Text == "" || textBox5.Text == ""))
                {
                    string               nome       = textBox1.Text;
                    string               nasci      = textBox2.Text;
                    string[]             nascimento = nasci.Split('/');
                    string               sexo       = comboBox1.Text[0].ToString();
                    string               entra      = textBox3.Text;
                    string[]             entrada    = entra.Split('/');
                    EnfermeiroController ec         = new EnfermeiroController();
                    DateTime             nasc       = new DateTime(Convert.ToInt32(nascimento[2]), Convert.ToInt32(nascimento[1]), Convert.ToInt32(nascimento[0]));
                    DateTime             admss      = new DateTime(Convert.ToInt32(entrada[2]), Convert.ToInt32(entrada[1]), Convert.ToInt32(entrada[0]));
                    string               login      = textBox4.Text;
                    string               senha      = Hash.md5(textBox5.Text);
                    string               id         = Hash.md5(login);

                    Model.Enfermeiro enf = new Model.Enfermeiro(id, nome, nasc, sexo, login, senha, false, admss, Convert.ToDateTime(null));
                    if (Data.nascimento(nasc) && ec.add(enf))
                    {
                        MessageBox.Show("Enfermeiro cadastrado com sucesso!");
                        Limpar.limpar(this);
                        dataGridView1.DataSource = null;
                        Grid.grid(dataGridView1, "select nome as 'Nome',  date_format(nascimento,'%d/%m/%Y') as 'Nascimento', sexo as 'Sexo', date_format(dataAdmissao,'%d/%m/%Y') as 'Admissão', login as 'Login' from enfermeiro where id = '" + id + "'");
                    }
                    else
                    {
                        MessageBox.Show("Enfermeiro não pôde ser cadastrado!");
                    }
                }
                else
                {
                    MessageBox.Show("Informe tudo que for necessário!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                MessageBox.Show("Enfermeiro não pôde ser cadastrado!");
            }
        }
Exemple #26
0
        private void btnCadastrar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!(textBox1.Text == "" || textBox2.Text == "  /  /" || textBox3.Text == "  /  /" || comboBox1.Text == ""))
                {
                    string             nome       = textBox1.Text;
                    string             nasci      = textBox2.Text;
                    string[]           nascimento = nasci.Split('/');
                    string             sexo       = comboBox1.Text[0].ToString();
                    string             enfermeiro = Session.codigo;
                    string             entra      = textBox3.Text;
                    string[]           entrada    = entra.Split('/');
                    PacienteController pc         = new PacienteController();
                    DateTime           nasc       = new DateTime(Convert.ToInt32(nascimento[2]), Convert.ToInt32(nascimento[1]), Convert.ToInt32(nascimento[0]));
                    DateTime           entr       = new DateTime(Convert.ToInt32(entrada[2]), Convert.ToInt32(entrada[1]), Convert.ToInt32(entrada[0]));
                    string             id         = Hash.md5(nome + nascimento);
                    enfermeiro = Session.codigo;

                    Projeto.Model.Paciente p = new Projeto.Model.Paciente(id, nome, nasc, sexo, enfermeiro, entr, Convert.ToDateTime(null));
                    if (Data.nascimento(nasc) && pc.add(p))
                    {
                        MessageBox.Show("Paciente cadastrado com sucesso!");
                        Limpar.limpar(this);
                        dataGridView1.DataSource = null;
                        Grid.grid(dataGridView1, "select nome as 'Nome',  date_format(nascimento,'%d/%m/%Y') as 'Nascimento', sexo as 'Sexo', date_format(dataEntrada,'%d/%m/%Y') as 'Entrada' from paciente where id = '" + id + "'");
                    }
                    else
                    {
                        MessageBox.Show("Paciente não pôde ser cadastrado!");
                    }
                }
                else
                {
                    MessageBox.Show("Informe tudo que for necessário!");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Paciente não pôde ser cadastrado!");
            }
        }
Exemple #27
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            textBox1.ReadOnly = true;
            textBox2.ReadOnly = true;
            if (textBox1.Text != "")
            {
                try
                {
                    string id = dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[0].Value.ToString();

                    try
                    {
                        ProblemaController pc = new ProblemaController();
               
                        if (pc.delete(id))
                        {
                            MessageBox.Show("Problema excluído com sucesso!");
                            Grid.grid(dataGridView1, "select id as 'Id', stt as 'Status', nome as 'Nome', descricao as 'Descrição' from problema");
                            Limpar.limpar(this);
                        }
                        else
                        {
                            MessageBox.Show("Problema não pôde ser excluído!");
                        }
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Selecione algum problema para ser excluído!");
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Selecione um problema para ser excluído!");
                }
            }
            else
            {
                MessageBox.Show("Selecione algum problema para ser excluído!");
            }
        }
        private void bunifuThinButton21_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Deseja adicionar um novo paciente", "Atenção", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                nome_paciente.Enabled      = true;
                rg_paciente.Enabled        = true;
                cpf_paciente.Enabled       = true;
                nasc_paciente.Enabled      = true;
                cel_paciente.Enabled       = true;
                tel_paciente.Enabled       = true;
                endereco_paciente.Enabled  = true;
                email_paciente.Enabled     = true;
                estcivil_paciente.Enabled  = true;
                profissao_paciente.Enabled = true;
                anotacoes_paciente.Enabled = true;
                Alterar.Enabled            = true;
                Excluir.Enabled            = true;
                Adicionar.Enabled          = true;

                Limpar.Show();
            }
        }
Exemple #29
0
    public static void Opções()
    {
        // Se o arquivo não existir, não é necessário carregá-lo
        if (!Diretórios.Opções.Exists)
        {
            Limpar.Opções();
        }
        else
        {
            // Cria um sistema binário para a manipulação dos dados
            BinaryReader Binário = new BinaryReader(Diretórios.Opções.OpenRead());

            // Lê os dados
            Listas.Opções.Diretório_Cliente     = Binário.ReadString();
            Listas.Opções.Diretório_Servidor    = Binário.ReadString();
            Listas.Opções.Pre_Mapa_Grades       = Binário.ReadBoolean();
            Listas.Opções.Pre_Mapa_Visualização = Binário.ReadBoolean();
            Listas.Opções.Pre_Mapa_Áudio        = Binário.ReadBoolean();

            // Fecha o sistema
            Binário.Dispose();
        }

        // Define e cria os diretórios
        Diretórios.Definir_Cliente();
        Diretórios.Definir_Servidor();

        // Atualiza os valores
        Editor_Mapas.Objetos.butGrades.Checked = Listas.Opções.Pre_Mapa_Grades;
        Editor_Mapas.Objetos.butÁudio.Checked  = Listas.Opções.Pre_Mapa_Áudio;

        if (!Listas.Opções.Pre_Mapa_Visualização)
        {
            Editor_Mapas.Objetos.butVisualização.Checked = false;
            Editor_Mapas.Objetos.butEdição.Checked       = true;
        }
    }
        private void bunifuCustomDataGrid1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            codigo = Convert.ToString(bunifuCustomDataGrid1.CurrentRow.Cells[0].Value);

            String          caminhobd = "Server=127.0.0.1;DATABASE=tcc_consultorio;UID=root;PASSWORD="******"select id_paciente, nome_paciente, rg_paciente, cpf_paciente, nasc_paciente, cel_paciente,tel_paciente, endereco_paciente, email_paciente, estcivil_paciente, profissao_paciente, anotacoes_paciente from paciente where id_paciente = '" + codigo + "'", con);
            MySqlDataReader reader = null;

            reader = cmd2.ExecuteReader();
            if (reader.Read())
            {
                Id_Paciente.Text        = reader.GetString(0);
                nome_paciente.Text      = reader.GetString(1);
                rg_paciente.Text        = reader.GetString(2);
                cpf_paciente.Text       = reader.GetString(3);
                nasc_paciente.Text      = reader.GetString(4);
                cel_paciente.Text       = reader.GetString(5);
                tel_paciente.Text       = reader.GetString(6);
                endereco_paciente.Text  = reader.GetString(7);
                email_paciente.Text     = reader.GetString(8);
                estcivil_paciente.Text  = reader.GetString(9);
                profissao_paciente.Text = reader.GetString(10);
            }

            con.Close();
            panel1.Hide();

            Limpar.Show();
            Limpar.BringToFront();
            Alterar.Visible = true;
            Excluir.Visible = true;
        }