Пример #1
0
    protected void btnConfirmaRemover_Click(object sender, EventArgs e)
    {
        int     vulId = Convert.ToInt32(Request.QueryString["id"]);
        DataSet ds    = VulneravelBD.SelectDadosVulneravel(vulId);
        int     pesId = Convert.ToInt32(ds.Tables[0].Rows[0]["pes_id"]);

        switch (VulneravelBD.DeleteVulneravel(vulId, pesId))
        {
        case 0:
            Response.Redirect("Index.aspx");
            break;

        case -2:
            Response.Redirect("QuemSomos.aspx");
            break;
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int     vulId = Convert.ToInt32(Request.QueryString["id"]);
            DataSet ds    = VulneravelBD.SelectDadosVulneravel(vulId);


            if (ds.Tables[0].Rows.Count >= 1)
            {
                ltlNome.Text = ds.Tables[0].Rows[0]["pes_nome"].ToString();
                txtRestricoesAlimentares.Text  = ds.Tables[0].Rows[0]["min_restricao_alimentar"].ToString();
                txtRestricoesMedicamentos.Text = ds.Tables[0].Rows[0]["min_restricao_medicamento"].ToString();
                txtDefMental.Text = ds.Tables[0].Rows[0]["min_deficiencia_mental"].ToString();
                txtDefFisica.Text = ds.Tables[0].Rows[0]["min_deficiencia_fisica"].ToString();
                txtOutros.Text    = ds.Tables[0].Rows[0]["min_doencas"].ToString();
            }
            else
            {
                // ERRO
            }
        }
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        int     vulId = Convert.ToInt32(Request.QueryString["id"]);
        DataSet ds    = VulneravelBD.SelectDadosVulneravel(vulId);
        int     pesId = Convert.ToInt32(ds.Tables[0].Rows[0]["pes_id"]);

        Mais_Informacoes minfo = new Mais_Informacoes();
        Pessoas          p     = new Pessoas();

        minfo.Vul_id         = vulId;
        minfo.Min_cor_olhos  = txtCorDosOlhos.Text;
        minfo.Min_cor_cabelo = txtCorDoCabelo.Text;
        minfo.Min_altura     = txtAltura.Text;
        minfo.Min_peso       = txtPeso.Text;
        minfo.Min_descricao  = txtDescricao.Text;

        // Switch do sangue
        switch (ddlSangue.SelectedValue)
        {
        case "1":
            minfo.Min_tipo_sanguineo = "A+";
            break;

        case "2":
            minfo.Min_tipo_sanguineo = "A-";
            break;

        case "3":
            minfo.Min_tipo_sanguineo = "B+";
            break;

        case "4":
            minfo.Min_tipo_sanguineo = "B-";
            break;

        case "5":
            minfo.Min_tipo_sanguineo = "O+";
            break;

        case "6":
            minfo.Min_tipo_sanguineo = "0-";
            break;

        case "7":
            minfo.Min_tipo_sanguineo = "AB+";
            break;

        case "8":
            minfo.Min_tipo_sanguineo = "AB-";
            break;

        default:
            minfo.Min_tipo_sanguineo = "";
            break;
        }

        p.Pes_id             = pesId;
        p.Pes_nome           = txtNome.Text;
        p.Pes_dataNascimento = Convert.ToDateTime(txtData.Text);

        // Switch do sexo
        switch (ddlSexo.SelectedValue)
        {
        case "1":
            p.Pes_sexo = "Masculino";
            break;

        case "2":
            p.Pes_sexo = "Feminino";
            break;

        case "3":
            p.Pes_sexo = "Outro";
            break;

        default:
            p.Pes_sexo = "Outro";
            break;
        }

        // Switch da cutis
        switch (ddlCutis.SelectedValue)
        {
        case "1":
            p.Pes_cutis = "Amarela";
            break;

        case "2":
            p.Pes_cutis = "Branca";
            break;

        case "3":
            p.Pes_cutis = "Indígena";
            break;

        case "4":
            p.Pes_cutis = "Negra";
            break;

        case "5":
            p.Pes_cutis = "Parda";
            break;

        default:
            p.Pes_cutis = "";
            break;
        }

        switch (VulneravelBD.UpdateDados(minfo, p))
        {
        case 0:
            Response.Redirect("Vulneravel.aspx?id=" + vulId);
            break;

        case -2:
            Response.Redirect("Index.aspx");
            break;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int     vulId = Convert.ToInt32(Request.QueryString["id"]);
            DataSet ds    = VulneravelBD.SelectDadosVulneravel(vulId);


            if (ds.Tables[0].Rows.Count >= 1)
            {
                ltlNome.Text = ds.Tables[0].Rows[0]["pes_nome"].ToString();

                txtNome.Text        = ds.Tables[0].Rows[0]["pes_nome"].ToString();
                txtCorDosOlhos.Text = ds.Tables[0].Rows[0]["min_cor_olhos"].ToString();
                txtCorDoCabelo.Text = ds.Tables[0].Rows[0]["min_cor_cabelo"].ToString();
                txtAltura.Text      = ds.Tables[0].Rows[0]["min_altura"].ToString();
                txtPeso.Text        = ds.Tables[0].Rows[0]["min_peso"].ToString();
                txtDescricao.Text   = ds.Tables[0].Rows[0]["min_descricao"].ToString();

                txtData.Text = ds.Tables[0].Rows[0]["pes_dataNascimento"].ToString().Substring(0, 10);

                ddlSexo.SelectedValue = ds.Tables[0].Rows[0]["pes_sexo"].ToString() == "M" ? "1" : "2";

                string cutis = ds.Tables[0].Rows[0]["pes_cutis"].ToString();
                switch (cutis)
                {
                case "Amarela":
                    ddlCutis.SelectedValue = "1";
                    break;

                case "Branca":
                    ddlCutis.SelectedValue = "2";
                    break;

                case "Indígena":
                    ddlCutis.SelectedValue = "3";
                    break;

                case "Negra":
                    ddlCutis.SelectedValue = "4";
                    break;

                case "Parda":
                    ddlCutis.SelectedValue = "5";
                    break;

                default:
                    ddlCutis.SelectedValue = "-1";
                    break;
                }

                string sangue = ds.Tables[0].Rows[0]["min_tipo_sanguineo"].ToString();
                switch (sangue)
                {
                case "A+":
                    ddlSangue.SelectedValue = "1";
                    break;

                case "A-":
                    ddlSangue.SelectedValue = "2";
                    break;

                case "B+":
                    ddlSangue.SelectedValue = "3";
                    break;

                case "B-":
                    ddlSangue.SelectedValue = "4";
                    break;

                case "O+":
                    ddlSangue.SelectedValue = "5";
                    break;

                case "O-":
                    ddlSangue.SelectedValue = "6";
                    break;

                case "AB+":
                    ddlSangue.SelectedValue = "7";
                    break;

                case "AB-":
                    ddlSangue.SelectedValue = "8";
                    break;

                default:
                    ddlSangue.SelectedValue = "-1";
                    break;
                }
            }
            else
            {
                // ERRO
            }
        }
    }
Пример #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            try
            {
                int id = Convert.ToInt32(Session["idResponsavel"]);

                DataSet ds2 = DesaparecidoBD.SelectDesaparecidoporPessoa(id);
                int     qtd = ds2.Tables[0].Rows.Count;

                if (qtd > 0)
                {
                    rptDesaparecidos.DataSource = ds2;
                    rptDesaparecidos.DataBind();
                }
                else
                {
                    // Caso nao tenha nenhum desaparecido
                }
            }
            catch (Exception)
            {
                //erro
            }

            try
            {
                int id = Convert.ToInt32(Session["idResponsavel"]);

                DataSet ds2 = VulneravelBD.SelectVulneravelporPessoa(id);
                int     qtd = ds2.Tables[0].Rows.Count;

                if (qtd > 0)
                {
                    rptVulneravel.DataSource = ds2;
                    rptVulneravel.DataBind();
                }
                else
                {
                    // Caso nao tenha nenhum desaparecido
                }
            }
            catch (Exception)
            {
                //erro
            }

            try
            {
                DataSet ds2 = DesaparecidoBD.SelectAtividadeRecente();
                int     qtd = ds2.Tables[0].Rows.Count;

                if (qtd > 0)
                {
                    rptAtividadeRecente.DataSource = ds2;
                    rptAtividadeRecente.DataBind();
                }
                else
                {
                    // Caso nao tenha nenhum desaparecido
                }
            }
            catch (Exception)
            {
                //erro
            }
        }

        int idDesaparecido = Convert.ToInt32(Request.QueryString["id"]);

        Session["idVulneravel"] = idDesaparecido;
        DataSet ds = VulneravelBD.SelectDadosVulneravel(idDesaparecido);


        if (ds.Tables[0].Rows.Count >= 1)
        {
            Session["pesIdVulneravel"] = Convert.ToInt32(ds.Tables[0].Rows[0]["pes_id"]);
            Session["ResposavelPor"]   = Convert.ToInt32(ds.Tables[0].Rows[0]["res_id"]);
            int idLogado = Convert.ToInt32(Session["idResponsavel"]);

            ltlNome.Text = ds.Tables[0].Rows[0]["pes_nome"].ToString();

            DateTime dataInicial = (DateTime)ds.Tables[0].Rows[0]["pes_dataNascimento"];
            DateTime dataFinal   = DateTime.Now;
            int      ano         = dataFinal.Year;
            int      anoInicial  = dataInicial.Year;
            int      idade       = ano - anoInicial;


            ltlIdade.Text = idade.ToString();

            ltlTipoSanguineo.Text = ds.Tables[0].Rows[0]["min_tipo_sanguineo"].ToString();
            ltlSexo.Text          = ds.Tables[0].Rows[0]["pes_sexo"].ToString() == "M" ? "Masculino" : "Feminino";
            ltlEtnia.Text         = ds.Tables[0].Rows[0]["pes_cutis"].ToString();
            ltlCabelo.Text        = ds.Tables[0].Rows[0]["min_cor_cabelo"].ToString();
            ltlOlhos.Text         = ds.Tables[0].Rows[0]["min_cor_olhos"].ToString();
            ltlAltura.Text        = ds.Tables[0].Rows[0]["min_altura"].ToString();
            ltlPeso.Text          = ds.Tables[0].Rows[0]["min_peso"].ToString();
            ltlDescricao.Text     = ds.Tables[0].Rows[0]["min_descricao"].ToString();

            ltlAlimentos.Text         = ds.Tables[0].Rows[0]["min_restricao_alimentar"].ToString();
            ltlMedicamentos.Text      = ds.Tables[0].Rows[0]["min_restricao_medicamento"].ToString();
            ltlDeficienciaMental.Text = ds.Tables[0].Rows[0]["min_deficiencia_mental"].ToString();
            ltlDeficienciaFisica.Text = ds.Tables[0].Rows[0]["min_deficiencia_fisica"].ToString();
            ltlDoencas.Text           = ds.Tables[0].Rows[0]["min_doencas"].ToString();

            int status = Convert.ToInt32(ds.Tables[0].Rows[0]["vul_status"]);

            Session["StatusVulneravel"] = status;
        }
        else
        {
            // ERRO
        }
    }