Esempio n. 1
0
    public void CarregarLiteral()
    {
        hdf.Value = Session["value"].ToString();

        pas_passageiro pas = new pas_passageiro();

        DataSet codigo = new DataSet();

        codigo = pas_passageiroDB.SelectID(Convert.ToInt32(hdf.Value));
        // Label1.Text = par;

        int c = Convert.ToInt32(codigo.Tables[0].Rows[0][0]);

        DataSet ds  = som_solicitacaomotoristaDB.SelectProposta(c);
        int     qtd = ds.Tables[0].Rows.Count;

        if (qtd != 0)
        {
            DataSet data = sol_solicitacaoDB.Select(c);
            foreach (DataRow dados in data.Tables[0].Rows)
            {
                Literal.Text += "<li><a href='PropostaCliente.aspx?pas="******"pas_id"] + "'>O Motorista " + dados["pes_nome"] + " mandou uma proposta</a></li><br/>";
            }
        }
        else
        {
            Literal.Text += "<li><a href='#'>Sem Notificações</a></li>";
        }
    }
    public void CarregarLiteral()
    {
        hdf.Value = Session["value"].ToString();

        pas_passageiro pas = new pas_passageiro();

        DataSet codigo = new DataSet();

        codigo = pas_passageiroDB.SelectID(Convert.ToInt32(hdf.Value));

        int c = Convert.ToInt32(codigo.Tables[0].Rows[0][0]);

        DataSet ds = pas_passageiroDB.SelectSolicitacao(c);

        foreach (DataRow dados in ds.Tables[0].Rows)
        {
            LSolicitacao.Text += "<div class = 'list-item'><div class='serviceBox shadow'> "
                                 + "<div class='title'>" + dados["pes_nome"]
                                 //+ "<span class='text-right'>" + dados["sol_id"] + "</span>"
                                 + "<span class='text-right'><a href='#' onclick='excluir(" + dados["sol_id"] + ", \"" + dados["pes_nome"] + "\");'><span class='glyphicon glyphicon-remove'></span>&nbsp;Excluir</a></span>"
                                 + "   <span class='text-right'><a href = 'editService.aspx?ser=" + dados["sol_id"] + "' ><span class='glyphicon glyphicon-edit'></span>&nbsp;Editar</a></span>" +
                                 "</div>"
                                 + "<div class='padding'>"
                                 + "<p class = 'origem'><b>Origem</b>: " + dados["sol_origem"] + "</p>"
                                 + "<p class = 'destino'><b>Destino</b>: " + dados["sol_destino"] + "</p><hr>"
                                 + "<p><b>Data De Saida</b>:" + String.Format("{0:dd/MM/yyyy}", dados["sol_datainicio"]) + "</p>"
                                 + "<p><b>Hora de Saida</b>:" + String.Format("{0:HH:mm}", dados["sol_datainicio"]) + "</p><hr>"
                                 + "<p><b>Data De Volta</b>:" + String.Format("{0:dd/MM/yyyy}", dados["sol_datafim"]) + "</p>"
                                 + "<p><b>Hora de Volta</b>:" + String.Format("{0:HH:mm}", dados["sol_datafim"]) + "</p>"
                                 + "<button class='btn btn-default' style='float:right;'>Detalhes</button><br />"
                                 + "</div></div></div>";
        }
    }
    public static int Update(pas_passageiro pas)
    {
        int retorno = 0;

        try
        {
            //Correto
            IDbConnection objConexao; //Abrir a conexão
            IDbCommand    objCommand; // Criar e executar os comandos
            string        sql = "update pas_passageiro set pas_cpf = ?pas_cpf where pas_id = ?pas_id";

            objConexao = Mapped.Connection();
            objCommand = Mapped.Command(sql, objConexao);

            objCommand.Parameters.Add(Mapped.Parameter("?pas_cpf", pas.Pas_cpf));
            objCommand.Parameters.Add(Mapped.Parameter("?pas_id", pas.Pas_id));



            objCommand.ExecuteNonQuery();
            objConexao.Close();
            objConexao.Dispose();
            objCommand.Dispose();
        }
        catch (Exception)
        {
            //erro
            retorno = -2;
        }
        return(retorno);
    }
    public static int Insert(pas_passageiro pas)
    {
        int retorno = 0;

        try
        {
            //Correto
            IDbConnection objConexao; //Abrir a conexwão
            IDbCommand    objCommand; // Criar e executar os comandos
            string        sql = "insert into pas_passageiro ";
            sql += "(pas_cpf, usu_id)";
            sql += "values ";
            sql += "(?pas_cpf, ?usu_id)";

            objConexao = Mapped.Connection();
            objCommand = Mapped.Command(sql, objConexao);


            objCommand.Parameters.Add(Mapped.Parameter("?pas_cpf", pas.Pas_cpf));

            // Chave estrangeira
            objCommand.Parameters.Add(Mapped.Parameter("?usu_id", pas.Usu_id.Usu_id));

            objCommand.ExecuteNonQuery();
            objConexao.Close();
            objConexao.Dispose();
            objCommand.Dispose();
        }
        catch (Exception)
        {
            //erro
            retorno = -2;
        }
        return(retorno);
    }
Esempio n. 5
0
    protected void btnCadastrar_Click(object sender, EventArgs e)
    {
        hdf.Value = Session["value"].ToString();
        sol_solicitacao sol = new sol_solicitacao();

        sol.Sol_origem     = txtOrigem.Text;
        sol.Sol_destino    = txtDestino.Text;
        sol.Sol_datainicio = Convert.ToDateTime(txtDataInicio.Text);
        sol.Sol_datainicio = Convert.ToDateTime(txtHoraInicio.Text);
        sol.Sol_datafim    = Convert.ToDateTime(txtDataFim.Text);
        sol.Sol_datafim    = Convert.ToDateTime(txtHoraFim.Text);
        sol.Sol_qtdpessoas = Convert.ToInt32(txtPessoas.Text);
        if (cbl.Checked == true)
        {
            sol.Sol_private = true;
        }
        else
        {
            sol.Sol_private = false;
        }
        sol.Sol_descricao = txtMensagem.Text;
        pas_passageiro pas = new pas_passageiro();

        DataSet id = new DataSet();

        id = usu_usuarioDB.Select(Convert.ToInt32(hdf.Value));

        pas.Pas_id = Convert.ToInt32(id.Tables[0].Rows[0][0]);

        sol.Pas_id = pas;

        switch (sol_solicitacaoDB.Insert(sol))
        {
        case 0:
            //Response.Write("<script>alert('Cadastrado com Sucesso');</script>");
            ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalSS();", true);
            txtDestino.Text    = null;
            txtMensagem.Text   = null;
            txtDataInicio.Text = null;
            txtDataFim.Text    = null;
            txtOrigem.Text     = null;
            txtPessoas.Text    = null;
            break;

        case -2:
            //Response.Write("<script>alert('Erro, verifique os campos acima e tente novamente');</script>");
            ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalSE();", true);
            break;
        }
    }
Esempio n. 6
0
    protected void btnSalvar_Click(object sender, EventArgs e)
    {
        pas_passageiro cli = new pas_passageiro();

        cli.Pas_cpf = txtCPF.Text;

        pes_pessoa pes = new pes_pessoa();

        pes.Pes_id         = Convert.ToInt32(hdf.Value);
        pes.Pes_nome       = txtNome.Text;
        pes.Pes_sexo       = ddlSexo.SelectedValue;
        pes.Pes_cidade     = ddlCidade.SelectedValue;
        pes.Pes_estado     = ddlEstado.SelectedValue;
        pes.Pes_nascimento = Convert.ToDateTime(txtData.Text);

        usu_usuario usu = new usu_usuario();

        usu.Usu_email = txtEmail.Text;

        switch (pes_pessoaDB.Update(pes))
        {
        case 0:
            //Response.Write("OK");
            Response.Write("<script>alert('Cadastrado com Sucesso');</script>");
            break;

        case -2:
            //Response.Write("ERRO");
            Response.Write("<script>alert('Ocorreu um Erro');</script>");
            break;
        }
        // switch (pas_passageiroDB.Update(cli))
        //{
        //    case 0:
        //        //Response.Write("OK");
        //        Label1.Text = "Dados Alterados com sucesso";
        //        break;
        //    case -2:
        //        //Response.Write("ERRO");
        //        Label1.Text = "Ocorreu um erro ao atualizar os dados, por favor confira os campos
        //            "e tente novamente";
        //        break;
        //}
    }
Esempio n. 7
0
    public void CarregarVisualizar()
    {
        hdf.Value = Session["value"].ToString();
        usu_usuario    usu = new usu_usuario();
        pas_passageiro pas = new pas_passageiro();
        pes_pessoa     pes = new pes_pessoa();

        DataSet ds = pas_passageiroDB.SelectDados(Convert.ToInt32(hdf.Value));

        if (ds.Tables[0].Rows.Count == 1)
        {
            hdfID.Value                 = ds.Tables[0].Rows[0]["pes_id"].ToString();
            txtNome.Text                = ds.Tables[0].Rows[0]["pes_nome"].ToString();
            txtEmail.Text               = ds.Tables[0].Rows[0]["usu_email"].ToString();
            txtCPF.Text                 = ds.Tables[0].Rows[0]["pas_cpf"].ToString();
            ddlSexo.SelectedItem.Text   = ds.Tables[0].Rows[0]["pes_sexo"].ToString();
            ddlCidade.SelectedItem.Text = ds.Tables[0].Rows[0]["pes_cidade"].ToString();
            ddlEstado.SelectedItem.Text = ds.Tables[0].Rows[0]["pes_estado"].ToString();
            txtData.Text                = ds.Tables[0].Rows[0]["pes_nascimento"].ToString();
        }
    }
Esempio n. 8
0
    protected void btnCadastrar_Click(object sender, EventArgs e)
    {
        //DataSet d = usu_usuarioDB.SelectEmail();
        //int qtd = d.Tables[0].Rows.Count;
        //for (int i = 0; i<=qtd;i++)
        //{
        //    if (txtEmailM.Text == Convert.ToString(d.Tables[0].Rows[0][0]) || txtEmail.Text == Convert.ToString(d.Tables[0].Rows[0][0])) {
        //        Response.Write("ERRO");
        //    }
        //}

        if (Convert.ToInt32(ddlPM.SelectedItem.Value) == 0)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalAt();", true);
            Label2.Visible = false;
        }
        else if (ddlPM.SelectedIndex == 1)
        {
            if (txtSenha.Text == txtSenha2.Text)
            {
                if (CheckBox1.Checked == false)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalCb();", true);
                }
                else if (Convert.ToInt32(ddlPM.SelectedItem.Value) == 0)
                {
                    Label2.Text    = "Por favor selecione uma opção para proseguir com o cadastro";
                    Label2.Visible = true;
                    Label1.Visible = false;
                }
                else
                {
                    pes_pessoa pessoa = new pes_pessoa();
                    pessoa.Pes_nome       = txtNome.Text;
                    pessoa.Pes_sexo       = ddlSexo.SelectedValue;
                    pessoa.Pes_cidade     = ddlCidade.SelectedValue;
                    pessoa.Pes_estado     = ddlEstado.SelectedValue;
                    pessoa.Pes_sexo       = ddlSexo.SelectedValue;
                    pessoa.Pes_nascimento = Convert.ToDateTime(txtData.Text);
                    string name = txtNome.Text;

                    pes_pessoaDB.Insert(pessoa);

                    DataSet codigo = new DataSet();

                    codigo = pes_pessoaDB.SelectByEmail(name);

                    pessoa.Pes_id = Convert.ToInt32(codigo.Tables[0].Rows[0][0]);



                    usu_usuario us = new usu_usuario();
                    us.Usu_email = txtEmail.Text;
                    us.Usu_senha = Funções.Hash(txtSenha.Text, "SHA512");
                    us.Usu_tipo  = ddlPM.SelectedValue;
                    us.Pes_id    = pessoa;

                    usu_usuarioDB.Insert(us);

                    pas_passageiro passageiro = new pas_passageiro();
                    passageiro.Pas_cpf = txtCpf.Text;

                    ////joga o email pra uma variavel
                    string email = txtEmail.Text;

                    ////cria um dataset, pois o SelectByEmail retorna um dataset
                    DataSet id = new DataSet();

                    id = usu_usuarioDB.SelectByEmail(email);

                    us.Usu_id = Convert.ToInt32(id.Tables[0].Rows[0][0]);

                    passageiro.Usu_id = us;


                    switch (pas_passageiroDB.Insert(passageiro))
                    {
                    case 0:

                        ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalS();", true);
                        txtEmail.Text     = "";
                        txtNome.Text      = "";
                        txtCpf.Text       = "";
                        txtData.Text      = "";
                        Label1.Visible    = false;
                        CheckBox1.Checked = false;
                        break;

                    case -2:

                        ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalE();", true);
                        break;
                    }
                }
            }


            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalP();", true);
            }
        }
        else
        {
            if (txtSenhaCM.Text == txtSenhaM.Text)
            {
                if (CheckBox1.Checked == false)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalCb();", true);
                }
                else
                {
                    pes_pessoa pes = new pes_pessoa();
                    pes.Pes_nome       = txtNomeM.Text;
                    pes.Pes_sexo       = ddlSexoM.SelectedValue;
                    pes.Pes_cidade     = ddlCidadeM.SelectedValue;
                    pes.Pes_estado     = ddlEstadoM.SelectedValue;
                    pes.Pes_nascimento = Convert.ToDateTime(txtDataM.Text);

                    pes_pessoaDB.Insert(pes);

                    string nome = txtNomeM.Text;

                    DataSet cod = new DataSet();

                    cod = pes_pessoaDB.SelectByEmail(nome);

                    pes.Pes_id = Convert.ToInt32(cod.Tables[0].Rows[0][0]);


                    usu_usuario us = new usu_usuario();
                    us.Usu_email = txtEmailM.Text;
                    us.Usu_senha = Funções.Hash(txtSenhaM.Text, "SHA512");
                    us.Usu_tipo  = ddlPM.SelectedValue;
                    us.Pes_id    = pes;

                    usu_usuarioDB.Insert(us);

                    mot_motorista mot = new mot_motorista();
                    mot.Mot_cnpj        = txtCnpj.Text;
                    mot.Mot_publicacoes = 0;
                    ////joga o email pra uma variavel
                    string emai = txtEmailM.Text;

                    ////cria um dataset, pois o SelectByEmail retorna um dataset
                    DataSet ds = new DataSet();


                    ds = usu_usuarioDB.SelectByEmail(emai);


                    us.Usu_id = Convert.ToInt32(ds.Tables[0].Rows[0][0]);

                    mot.Usu_id = us;

                    DataSet dss          = new DataSet();
                    string  TCTemporario = "Free";

                    tip_tipoconta tip = new tip_tipoconta();

                    dss        = tip_tipocontaDB.SelectID(TCTemporario);
                    tip.Tip_id = Convert.ToInt32(dss.Tables[0].Rows[0][0]);
                    mot.Tip_id = tip;

                    switch (mot_motoristaDB.Insert(mot))
                    {
                    case 0:

                        ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalS();", true);
                        txtEmailM.Text    = "";
                        txtNomeM.Text     = "";
                        txtCnpj.Text      = "";
                        txtDataM.Text     = "";
                        Label1.Visible    = false;
                        CheckBox1.Checked = false;
                        break;

                    case -2:

                        ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalE();", true);
                        break;
                    }
                }

                Label1.Visible = false;
            }


            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalP();", true);
            }
        }
    }