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
        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.º 4
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.º 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
 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.º 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
        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.º 9
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);
            }
        }
Exemplo n.º 10
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);
            }
        }