Exemplo n.º 1
0
        public void onload()
        {
            comb.sql = "select count(tb08_nome), tb08_nome, tb08_id from tb05_conversas inner join tb08_user ON tb05_conversas.tb05_de = tb08_user.tb08_id where tb05_status = '1' and tb05_para = " + J + " or tb05_status = '2' and tb05_para = '" + J + "' group by tb08_nome order by tb05_data desc";
            comb.open();
            MySqlDataReader dados = comb.Execsql();

            dt1.Rows.Clear();
            if (dados.HasRows)
            {
                while (dados.Read())
                {
                    lista.Add(dados["tb08_id"].ToString());
                    lista1.Add(dados["tb08_id"].ToString());
                    dt1.Rows.Add(dados["tb08_nome"].ToString() + " (" + dados["count(tb08_nome)"].ToString() + ")", dados["tb08_id"].ToString(), dados["count(tb08_nome)"].ToString());
                    DataGridViewRow row = dt1.Rows[i];
                    row.DefaultCellStyle.ForeColor = Color.Blue;
                    i++;
                }
            }
            //MessageBox.Show(string.Join(", ", lista));
            comb.close();



            comb2.sql = "select tb08_nome, tb08_id from tb05_conversas inner join tb08_user ON tb05_conversas.tb05_de = tb08_user.tb08_id where tb05_status = '3' and tb05_para = '" + J + "' group by tb08_nome order by tb05_data desc";
            comb2.open();
            MySqlDataReader dados2 = comb2.Execsql();

            if (dados2.HasRows)
            {
                while (dados2.Read())
                {
                    if (lista.Contains(dados2["tb08_id"].ToString()))
                    {
                    }
                    else
                    {
                        dt1.Rows.Add(dados2["tb08_nome"].ToString(), dados2["tb08_id"].ToString(), "0");


                        lista1.Add(dados2["tb08_id"].ToString());
                    }
                }
            }

            comb2.close();

            i         = 0;
            comb1.sql = "update tb05_conversas set tb05_status = 2 where tb05_status = 1 and tb05_para = " + J + " ";
            comb1.open();
            int l = comb1.Runsql();

            comb1.close();


            dt1.ClearSelection();
        }
Exemplo n.º 2
0
 private void Aceitar_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Deseja mesmo aceitar a solicitação?", "Pergunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         comb.sql = "update tb10_ongs_campanhas set tb10_status = 2 where tb10_campanha = " + dt_campanhas.CurrentRow.Cells[5].Value.ToString() + " and tb10_ong = " + CNPJ + "";
         comb.open();
         int l = comb.Runsql();
         comb.close();
         onload();
     }
     else
     {
     }
 }
Exemplo n.º 3
0
        public void enviatudo(String t1, String t2, String t3, String t4, String t5, String t6, String t7, String t8)
        {
            Conexao cb2 = new Conexao();

            cb2.sql = "delete from tb07_urgencias where tb07_ong = " + CNPJ + "";
            cb2.open();
            cb2.Runsql();
            cb2.close();

            Conexao comb = new Conexao();

            while (cont2 != 0)
            {
                //MessageBox.Show(cont2.ToString());
                comb.sql = "insert into tb07_urgencias (tb07_tipo, tb07_ong) values (" + lista[INDEX].ToString() + ", '" + CNPJ + "')";
                comb.open();
                comb.Runsql();
                comb.close();
                cont2--;
                INDEX++;
            }


            Form3 fmr = new Form3(CNPJ);

            fmr.Show();
            this.Dispose();
        }
Exemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Deseja mesmo solicitar que a '" + txt_nome.Text + "' entre na campanha '" + label_campanha.Text + "' ?", "Pergunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                Conexao comb3 = new Conexao();
                txt_cnpj.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
                comb3.sql = "select * from tb10_ongs_campanhas where tb10_ong = " + CP + " and tb10_campanha = " + CAMPANHA + "";
                comb3.open();
                MySqlDataReader dados2 = comb3.Execsql();

                if (dados2.HasRows)
                {
                    MessageBox.Show("A ONG já está inserida na campanha/Você já mandou a solicitação para essa ONG");
                    comb3.close();
                }
                else
                {
                    comb.sql = "insert into tb10_ongs_campanhas(tb10_campanha, tb10_ong, tb10_status) values (" + CAMPANHA + ", " + CP + ", 1)";
                    comb.open();
                    int l = comb.Runsql();
                    comb.close();
                    MessageBox.Show("Convite enviado com sucesso!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Form7 fmr = new Form7(CNPJ);
                    this.Dispose();
                    fmr.Show();
                }
            }
        }
Exemplo n.º 5
0
        private void deletar_Click(object sender, EventArgs e)
        {
            String campanha = dt_campanhas.CurrentRow.Cells[0].Value.ToString();

            if (MessageBox.Show("Deseja mesmo deletar a campanha " + campanha + "?", "Pergunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                comb.sql = "delete from tb09_campanhas where tb09_id=" + dt_campanhas.CurrentRow.Cells[4].Value.ToString() + "";
                comb.open();
                int l = comb.Runsql();
                comb.close();
                onload();
            }
            else
            {
                dt_campanhas.ClearSelection();
            }
        }
Exemplo n.º 6
0
        public void msg(String user)
        {
            comb.sql = "select tb05_mensagem, tb08_nome, tb05_data from tb05_conversas inner join tb08_user ON tb05_conversas.tb05_de = tb08_user.tb08_id where tb05_para = " + J + " and tb08_id = " + user + " or tb05_para =  " + user + " and tb08_id = " + J + "  order by tb05_data desc";
            comb.open();
            MySqlDataReader dados = comb.Execsql();

            dt1.Rows.Clear();
            if (dados.HasRows)
            {
                while (dados.Read())
                {
                    //carrega no painel
                }
            }

            comb.close();
        }
Exemplo n.º 7
0
        public void salvaimg()
        {
            if (txt_texto.Text == "")
            {
                MessageBox.Show("Dê uma descrição para a imagem!", "Aviso:", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                if (p1.Image == null)
                {
                }
                else
                {
                    Conexao comb = new Conexao();
                    comb.sql = "select MAX(tb12_seq) from tb12_imagens ";
                    comb.open();
                    MySqlDataReader dados = comb.Execsql();

                    if (dados.HasRows)
                    {
                        while (dados.Read())
                        {
                            max = int.Parse(dados["max(tb12_seq)"].ToString());
                        }
                    }



                    comb.close();
                    int    newmax     = max + 1;
                    string fotoString = System.IO.Path.Combine("D:/xampp/htdocs/www/imgs/" + newmax + ".png");


                    p1.Image.Save(fotoString);

                    comb.sql = "insert into tb12_imagens(tb12_ong, tb12_extencao, tb12_data_upload, tb12_descricao) VALUES (" + CNPJ + ", '.png', now(), '" + txt_texto.Text + "' )";
                    comb.open();
                    int l = comb.Runsql();
                    comb.close();

                    MessageBox.Show("Imagem Salva!", "Aviso:", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    p1.Image        = null;
                    button1.Enabled = false;
                }
            }
        }
Exemplo n.º 8
0
        private void txt_cnpj_TextChanged(object sender, EventArgs e)
        {
            txt_cnpj.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
            if (txt_cnpj.Text.Length == 14)
            {
                if (txt_cnpj.Text == CNPJ)
                {
                    MessageBox.Show("Digite uma Ong DIFERENTE da sua!");
                    txt_cnpj.Text = "";
                }
                else
                {
                    Conexao comb3 = new Conexao();
                    txt_cnpj.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;

                    comb3.sql = "select * from tb01_ongs where tb01_cnpj = " + txt_cnpj.Text + "";
                    comb3.open();
                    MySqlDataReader dados2 = comb3.Execsql();

                    if (dados2.HasRows)
                    {
                        while (dados2.Read())
                        {
                            String tel = dados2["tb01_telefone"].ToString();



                            CP = txt_cnpj.Text;
                            txt_nome.Show();
                            txt_nome.Text = dados2["tb01_nome"].ToString();
                            txt_numero.Show();
                            txt_numero.Text = tel;
                            txt_email.Show();
                            txt_email.Text = dados2["tb01_email"].ToString();
                            txt_end.Show();
                            txt_end.Text    = dados2["tb01_endereco"].ToString() + ", " + dados2["tb01_bairro"].ToString();
                            button1.Enabled = true;
                        }
                    }

                    else
                    {
                        MessageBox.Show("ONG não encontrada!");
                        txt_cnpj.Text = "";
                    }
                    comb3.close();
                }
            }
        }
Exemplo n.º 9
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Deseja mesmo marcar essa doação como recebida?", "Pergunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         comb.sql = "update tb13_campanha_doacoes set tb13_status = 2 where tb13_sequencia = " + dt1.CurrentRow.Cells[4].Value.ToString();
         comb.open();
         int l = comb.Runsql();
         comb.close();
         dt1.Rows.Clear();
         onload();
     }
     else
     {
         dt1.ClearSelection();
     }
 }
Exemplo n.º 10
0
        private void loga(String cnpj, String senha)
        {
            if (cnpj.Length != 13)
            {
                if (textBox2.Text != "")
                {
                    textBox1.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
                    comb.sql = "Select * From `tb01_ongs` WHERE `tb01_CNPJ` = '" + textBox1.Text + "' AND tb01_senha = '" + textBox2.Text + "'; ";


                    comb.open();

                    MySqlDataReader dados = comb.Execsql();

                    if (dados.HasRows)
                    {
                        while (dados.Read())
                        {
                            nome = dados["tb01_nome"].ToString();
                        }



                        Form3 fmr = new Form3(textBox1.Text);
                        fmr.Show();
                        this.Hide();
                        //abre outro form
                    }

                    else
                    {
                        MessageBox.Show("Conta inválida!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    comb.close();
                }
            }
            else
            {
                MessageBox.Show("CNPJ inválido! Digite 13 dígitos!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
                LIMPA();
            }
        }
Exemplo n.º 11
0
        private void carreganame2(int ID, int index)
        {
            Conexao comb3 = new Conexao();

            comb3.sql += "select tb01_nome from tb09_campanhas inner join tb01_ongs on tb09_campanhas.tb09_ong = tb01_ongs.tb01_cnpj where tb09_id=" + ID + "";
            comb3.open();
            MySqlDataReader dados2 = comb3.Execsql();

            if (dados2.HasRows)
            {
                while (dados2.Read())
                {
                    name = dados2["tb01_nome"].ToString();
                    dt_camp.Rows[index].Cells[4].Value = name;
                }
            }


            comb3.close();
        }
Exemplo n.º 12
0
        public void enviatudo(String nome, String cnpjooj, String end, String senha, String telefone, String t1, String t2, String t3, String t4, String t5, String t6, String t7, String t8, String descricao, String bairro, String email)
        {
            //MessageBox.Show(bairro);


            if (nome != "" && cnpjooj != "" && end != "" && senha != "" && telefone != "" && descricao != "" && bairro != "" && email != "")
            {
                if (cont == 1)
                {
                    if (cnpjooj.Length == 14)
                    {
                        Conexao comb = new Conexao();


                        comb.sql = "insert into tb01_ongs (tb01_cnpj, tb01_nome, tb01_endereco, tb01_senha, tb01_descricao, tb01_bairro, tb01_telefone, tb01_email) values (" + cnpjooj + ", '" + nome + "', '" + end + "', '" + senha + "', '" + descricao + "', '" + bairro + "', '" + telefone + "', '" + email + "')";
                        comb.open();
                        // MessageBox.Show(comb.sql);

                        int l = comb.Runsql();


                        if (l == 0)
                        {
                            MessageBox.Show("CNPJ já cadastrado!", "ERRO:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            comb.close();
                        }
                        else
                        {
                            //faz outros inserts

                            while (cont2 != 0)
                            {
                                // MessageBox.Show(cont2.ToString());
                                indexlimit = cont2 - 1;



                                comb.close();
                                comb.sql = "insert into tb06_tipos (tb06_ong, tb06_tipo) values (" + cnpjooj + ", " + lista[INDEX].ToString() + ")";
                                comb.open();
                                l = comb.Runsql();
                                comb.close();
                                cont2--;
                                INDEX++;
                            }



                            comb.sql = "insert into tb08_user (tb08_id, tb08_nome, tb08_email, tb08_senha) values ('" + cnpjooj + "', '" + nome + "', '" + email + "', '" + senha + "')";
                            comb.open();
                            l = comb.Runsql();
                            comb.close();

                            MessageBox.Show("Conta registrada!");
                            salvaimg();
                            Form3 fmr = new Form3(cnpjooj);
                            fmr.Show();
                            this.Hide();



                            //vai pra uotro form
                        }
                    }
                    else
                    {
                        MessageBox.Show("Digite um CNPJ válido!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    MessageBox.Show("As senhas não coincidem!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                MessageBox.Show("Preencha todos os campos!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemplo n.º 13
0
        public void testa()
        {
            if (tipo1.Checked)
            {
                tt1   = "1";
                cont2 = cont2 + 1;
                lista.Add(1);
            }
            if (tipo2.Checked)
            {
                tt2   = "2";
                cont2 = cont2 + 1;
                lista.Add(2);
            }
            if (tipo3.Checked)
            {
                tt3   = "3";
                cont2 = cont2 + 1;
                lista.Add(3);
            }
            if (tipo4.Checked)
            {
                tt4   = "4";
                cont2 = cont2 + 1;
                lista.Add(4);
            }
            if (tipo5.Checked)
            {
                cont2 = cont2 + 1;
                tt5   = "5";
                lista.Add(5);
            }
            if (tipo6.Checked)
            {
                cont2 = cont2 + 1;
                tt6   = "6";
                lista.Add(6);
            }
            if (tipo7.Checked)
            {
                cont2 = cont2 + 1;
                tt7   = "7";
                lista.Add(7);
            }
            if (tipo8.Checked)
            {
                cont2 = cont2 + 1;
                tt8   = "8";
                lista.Add(8);
            }

            //testa aqui
            String fim    = dtp_fim.Value.Date.ToString("yyyy-MM-dd");
            String inicio = dtp_inicio.Value.Date.ToString("yyyy-MM-dd");

            if (tipo1.Checked || tipo2.Checked || tipo3.Checked || tipo4.Checked || tipo5.Checked || tipo6.Checked || tipo7.Checked || tipo8.Checked)
            {
                String sts = "2";
                if (inicio.Substring(0, 2) == DateTime.Now.Day.ToString())
                {
                    sts = "1";
                }

                if (MessageBox.Show("Deseja mesmo inserir a campanha " + txt_nome.Text + "?", "Pergunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    comb.sql = "insert into tb09_campanhas (tb09_nome, tb09_ong, tb09_status, tb09_datainicio, tb09_datafim, tb09_descricao, tb09_objetivo) values ('" + txt_nome.Text + "', '" + CPNJ + "', " + sts + ", '" + inicio + "', '" + fim + "s', '" + txt_descricao.Text + "', '" + txt_objetivo.Text + "')";
                    comb.open();
                    int l = comb.Runsql();
                    comb.close();

                    int newid = 0;
                    comb.sql = "SELECT MAX(tb09_id) FROM tb09_campanhas where tb09_ong='" + CPNJ + "'";
                    comb.open();
                    MySqlDataReader dados = comb.Execsql();

                    if (dados.HasRows)
                    {
                        while (dados.Read())
                        {
                            newid = int.Parse(dados["MAX(tb09_id)"].ToString());
                        }
                    }



                    comb.close();


                    comb.sql = "insert into tb10_ongs_campanhas (tb10_campanha, tb10_ong, tb10_status) values (" + newid + ", " + CPNJ + ", 2)";
                    comb.open();
                    l = comb.Runsql();
                    comb.close();
                    int dex = 0;
                    while (cont2 != 0)
                    {
                        comb.sql = "insert into tb11_campanha_doacoes (tb11_tipo, tb11_campanha) values (" + lista[dex].ToString() + ", " + newid + ")";
                        comb.open();
                        l = comb.Runsql();
                        comb.close();
                        cont2--;
                        dex++;
                    }


                    Form7 fmr = new Form7(CPNJ);
                    fmr.Show();
                    this.Hide();
                }
                else
                {
                }
            }
            else
            {
                MessageBox.Show("Selecione pelo menos um tipo de doação!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
Exemplo n.º 14
0
        public void onload()
        {
            dt_campanhas.Rows.Clear();
            dt_camp.Rows.Clear();
            Conexao comb3 = new Conexao();

            comb3.sql += "select tb09_nome, date(tb09_datainicio), date(tb09_datafim), tb09_id, tb01_nome, tb09_status from tb10_ongs_campanhas ";
            comb3.sql += "inner join tb09_campanhas on tb10_ongs_campanhas.tb10_campanha = tb09_campanhas.tb09_id ";
            comb3.sql += "inner join tb01_ongs on tb10_ongs_campanhas.tb10_ong = tb01_ongs.tb01_cnpj where tb10_ong = " + CNPJ + " and tb09_ong <> " + CNPJ + " and tb10_status = 1 ";
            comb3.sql += "order by tb09_status ASC ";
            comb3.open();


            MySqlDataReader dados2 = comb3.Execsql();

            if (dados2.HasRows)
            {
                while (dados2.Read())
                {
                    String status;
                    if (dados2["tb09_status"].ToString() == "2")
                    {
                        status = "Desativada";
                    }
                    else
                    {
                        status = "Ativada";
                    }
                    String inicio = dados2["date(tb09_datainicio)"].ToString().Substring(0, 10);
                    String fim    = dados2["date(tb09_datafim)"].ToString().Substring(0, 10);

                    lista.Add(int.Parse(dados2["tb09_id"].ToString()));
                    dt_campanhas.Rows.Add(dados2["tb09_nome"].ToString(), inicio, fim, status, "", dados2["tb09_id"].ToString());
                    cont++;
                }
            }

            dt_campanhas.ClearSelection();
            comb3.close();
            int index = 0;

            while (cont != 0)
            {
                carreganame(int.Parse(lista[index].ToString()), index);
                index++;
                cont--;
            }
            dt_campanhas.ClearSelection();

            comb3.sql  = "";
            comb3.sql += "select tb09_nome, date(tb09_datainicio), date(tb09_datafim), tb09_id, tb01_nome, tb09_status from tb10_ongs_campanhas ";
            comb3.sql += "inner join tb09_campanhas on tb10_ongs_campanhas.tb10_campanha = tb09_campanhas.tb09_id ";
            comb3.sql += "inner join tb01_ongs on tb10_ongs_campanhas.tb10_ong = tb01_ongs.tb01_cnpj where tb10_ong = " + CNPJ + " and tb09_ong <> " + CNPJ + " and tb10_status = 2 ";
            comb3.sql += "order by tb09_status ASC ";
            comb3.open();



            dados2 = comb3.Execsql();

            if (dados2.HasRows)
            {
                while (dados2.Read())
                {
                    String status;
                    if (dados2["tb09_status"].ToString() == "2")
                    {
                        status = "Desativada";
                    }
                    else
                    {
                        status = "Ativada";
                    }
                    String inicio = dados2["date(tb09_datainicio)"].ToString().Substring(0, 10);
                    String fim    = dados2["date(tb09_datafim)"].ToString().Substring(0, 10);

                    lista2.Add(int.Parse(dados2["tb09_id"].ToString()));
                    dt_camp.Rows.Add(dados2["tb09_nome"].ToString(), inicio, fim, status, "", dados2["tb09_id"].ToString());
                    cont2++;
                }
            }

            dt_campanhas.ClearSelection();
            comb3.close();

            int index2 = 0;

            while (cont2 != 0)
            {
                carreganame2(int.Parse(lista2[index2].ToString()), index2);
                index2++;
                cont2--;
            }
            dt_campanhas.ClearSelection();
            dt_camp.ClearSelection();
            Aceitar.Enabled = false;
            deletar.Enabled = false;
            button1.Enabled = false;
            button2.Enabled = false;
            dt_campanhas.ClearSelection();
            dt_camp.ClearSelection();
        }
Exemplo n.º 15
0
        private void Form6_Load(object sender, EventArgs e)
        {
            Conexao comb3 = new Conexao();

            comb3.sql = "select count(tb07_tipo) from tb07_urgencias where tb07_ong = " + CNPJ + "";
            comb3.open();
            MySqlDataReader dados2 = comb3.Execsql();

            if (dados2.HasRows)
            {
                while (dados2.Read())
                {
                    qtde = int.Parse(dados2["count(tb07_tipo)"].ToString());
                }
            }


            Conexao comb2 = new Conexao();

            comb2.sql = "select tb07_tipo from tb07_urgencias where tb07_ong = " + CNPJ + "";
            comb2.open();
            MySqlDataReader dados3 = comb2.Execsql();

            if (dados3.HasRows)
            {
                while (dados3.Read())
                {
                    //MessageBox.Show(dados3["tb06_tipo"].ToString());

                    if (dados3["tb07_tipo"].ToString().Equals("1"))
                    {
                        tipo1.Checked = true;
                    }
                    if (dados3["tb07_tipo"].ToString().Equals("2"))
                    {
                        tipo2.Checked = true;
                    }
                    if (dados3["tb07_tipo"].ToString().Equals("3"))
                    {
                        tipo3.Checked = true;
                    }
                    if (dados3["tb07_tipo"].ToString().Equals("4"))
                    {
                        tipo4.Checked = true;
                    }
                    if (dados3["tb07_tipo"].ToString().Equals("5"))
                    {
                        tipo5.Checked = true;
                    }
                    if (dados3["tb07_tipo"].ToString().Equals("6"))
                    {
                        tipo6.Checked = true;
                    }
                    if (dados3["tb07_tipo"].ToString().Equals("7"))
                    {
                        tipo7.Checked = true;
                    }
                    if (dados3["tb07_tipo"].ToString().Equals("8"))
                    {
                        tipo8.Checked = true;
                    }
                }
                comb2.close();
            }
        }
Exemplo n.º 16
0
        public void onload(String CJ)
        {
            string letra      = System.AppDomain.CurrentDomain.BaseDirectory.ToString().Substring(0, 2);
            string fotoString = System.IO.Path.Combine("D:/xampp/htdocs/www/imgs/" + CJ + ".png");

            //pictureBox1.Image = Image.FromFile(fotoString);

            if (!System.IO.File.Exists(fotoString))
            {
                MessageBox.Show("Foto não encontrada", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                pictureBox1.Image = null;
            }

            // fotoString = System.IO.Path.Combine(letra + @"/Arquivos/2018/TCC/Software/DNState/DNState/DNState/bin/Debug/logos/" + CJ + @".jpeg");
            // pictureBox1.Image = Image.FromFile(fotoString);



            comb.sql = "Select count(tb02_cod) from tb02_doacoes where tb02_ong = '" + CJ + "' and tb02_status = 1 ";


            comb.open();

            MySqlDataReader dados = comb.Execsql();

            if (dados.HasRows)
            {
                while (dados.Read())
                {
                    String resul = dados["count(tb02_cod)"].ToString();
                    // MessageBox.Show(resul);
                    if (resul != "0")
                    {
                        if (resul == "1")
                        {
                            lbst.Text = "Você tem " + resul + " doação nova!";
                            c         = 1;
                        }
                        else
                        {
                            lbst.Text = "Você tem " + resul + " doações novas!";
                            c         = 1;
                        }
                    }
                    else
                    {
                        lbst.Text = "Você não tem nenhuma doação nova!";
                        c         = 0;
                    }
                }
            }



            comb.close();

            //carrega o logo da ong e exibe a aba de conversas
            //String sqlel = "Select count(tb05_cod) from tb05_conversas where tb05_ong = '" + CJ + "' and tb05_status = 2 ";
            comb.sql = "Select count(tb05_sequencia) from tb05_conversas where tb05_para = '" + CJ + "' and tb05_status = 1 ";


            comb.open();

            MySqlDataReader dados2 = comb.Execsql();

            // MessageBox.Show(sqlel);


            if (dados2.HasRows)
            {
                while (dados2.Read())
                {
                    String resul = dados2["count(tb05_sequencia)"].ToString();
                    //MessageBox.Show(resul);

                    if (resul != "0")
                    {
                        if (resul == "1")
                        {
                            lbcv.Text      = "Você tem " + resul + " mensagem não respondida!!";
                            Conversas.Text = "CONVERSAS (" + resul + ")";
                        }
                        else
                        {
                            lbcv.Text      = "Você tem " + resul + " mensagens não respondidas!!";
                            Conversas.Text = "CONVERSAS (" + resul + ")";
                        }
                    }
                    else
                    {
                        lbcv.Text = "Você não tem nehuma mensagem nova!";
                    }
                }
            }



            comb.close();
        }
Exemplo n.º 17
0
        private void Form5_Load(object sender, EventArgs e)
        {
            cnpjj.Text = CNPJ;
            Conexao comb = new Conexao();

            comb.sql = "select * from tb01_ongs where tb01_cnpj = " + CNPJ + "";
            comb.open();
            MySqlDataReader dados = comb.Execsql();

            if (dados.HasRows)
            {
                while (dados.Read())
                {
                    telefone.Text  = dados["tb01_telefone"].ToString();
                    name.Text      = dados["tb01_nome"].ToString();
                    nomeori        = dados["tb01_nome"].ToString();
                    endereco.Text  = dados["tb01_endereco"].ToString();
                    senha.Text     = dados["tb01_senha"].ToString();
                    senha2.Text    = dados["tb01_senha"].ToString();
                    desc.Text      = dados["tb01_descricao"].ToString();
                    comboBox1.Text = dados["tb01_bairro"].ToString();
                    email.Text     = dados["tb01_email"].ToString();
                    // string letra = System.AppDomain.CurrentDomain.BaseDirectory.ToString().Substring(0, 2);
                    //string fotoString = System.IO.Path.Combine(letra + @"/Arquivos/2018/TCC/Software/DNState/DNState/DNState/bin/Debug/logos/" + CNPJ + @".jpg");
                    //p1.Image = Image.FromFile(fotoString);
                }
            }

            comb.close();
            Conexao comb3 = new Conexao();

            comb3.sql = "select count(tb06_tipo) from tb06_tipos where tb06_ong = " + CNPJ + "";
            comb3.open();
            MySqlDataReader dados2 = comb3.Execsql();

            if (dados2.HasRows)
            {
                while (dados2.Read())
                {
                    qtde = int.Parse(dados2["count(tb06_tipo)"].ToString());
                }
            }


            comb3.close();
            Conexao comb2 = new Conexao();

            comb2.sql = "select tb06_tipo from tb06_tipos where tb06_ong = " + CNPJ + "";
            comb2.open();
            MySqlDataReader dados3 = comb2.Execsql();

            if (dados3.HasRows)
            {
                while (dados3.Read())
                {
                    //MessageBox.Show(dados3["tb06_tipo"].ToString());

                    if (dados3["tb06_tipo"].ToString().Equals("1"))
                    {
                        tipo1.Checked = true;
                    }
                    if (dados3["tb06_tipo"].ToString().Equals("2"))
                    {
                        tipo2.Checked = true;
                    }
                    if (dados3["tb06_tipo"].ToString().Equals("3"))
                    {
                        tipo3.Checked = true;
                    }
                    if (dados3["tb06_tipo"].ToString().Equals("4"))
                    {
                        tipo4.Checked = true;
                    }
                    if (dados3["tb06_tipo"].ToString().Equals("5"))
                    {
                        tipo5.Checked = true;
                    }
                    if (dados3["tb06_tipo"].ToString().Equals("6"))
                    {
                        tipo6.Checked = true;
                    }
                    if (dados3["tb06_tipo"].ToString().Equals("7"))
                    {
                        tipo7.Checked = true;
                    }
                    if (dados3["tb06_tipo"].ToString().Equals("8"))
                    {
                        tipo8.Checked = true;
                    }
                }
                comb2.close();
            }
        }
Exemplo n.º 18
0
        public void enviatudo(String nome, String cnpjooj, String end, String senha, String telefone, String t1, String t2, String t3, String t4, String t5, String t6, String t7, String t8, String descricao, String bairro, String email)
        {
            //MessageBox.Show(bairro);


            if (nome != "" && cnpjooj != "" && end != "" && senha != "" && telefone != "" && descricao != "" && bairro != "" && email != "")
            {
                if (cont == 1)
                {
                    if (cnpjooj.Length == 14)
                    {
                        Conexao comb = new Conexao();


                        comb.sql = "update tb01_ongs set  tb01_nome = '" + nome + "', tb01_endereco = '" + end + "', tb01_senha = '" + senha + "', tb01_descricao =  '" + descricao + "', tb01_bairro = '" + bairro + "', tb01_telefone = '" + telefone + "', tb01_email = '" + email + "' where tb01_cnpj = " + cnpjooj + " ";
                        comb.open();
                        // MessageBox.Show(comb.sql);

                        int l = comb.Runsql();


                        if (l == 0)
                        {
                            MessageBox.Show("Erro", "ERRO:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            comb.close();
                        }

                        else
                        {
                            //faz outros inserts
                            comb.close();
                            Conexao cb2 = new Conexao();
                            cb2.sql = "delete from tb06_tipos where tb06_ong = " + cnpjooj + "";
                            cb2.open();
                            l = cb2.Runsql();
                            cb2.close();

                            while (cont2 != 0)
                            {
                                // MessageBox.Show(cont2.ToString());
                                indexlimit = cont2 - 1;



                                comb.sql = "insert into tb06_tipos (tb06_ong, tb06_tipo) values (" + cnpjooj + ", " + lista[INDEX].ToString() + ")";
                                comb.open();
                                l = comb.Runsql();
                                comb.close();
                                cont2--;
                                INDEX++;
                            }

                            salvaimg();
                            cnpjj.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
                            comb.sql             = "update tb08_user set tb08_nome = '" + nome + "', tb08_email = '" + email + "', tb08_senha = '" + senha + "' where tb08_id = '" + cnpjj.Text + "'";
                            comb.open();
                            l = comb.Runsql();
                            comb.close();
                            MessageBox.Show("Conta alterada!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            Form3 fmr = new Form3(cnpjooj);
                            fmr.Show();
                            this.Hide();

                            //vai pra uotro form
                        }
                    }
                    else
                    {
                        MessageBox.Show("Digite um CNPJ válido!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    MessageBox.Show("As senhas não coincidem!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                MessageBox.Show("Preencha todos os campos!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }