//Evento al presionar el boton Evaluar Denuncia
        protected void btnEvaluarDenuncia_Click(object sender, EventArgs e)
        {
            lblRestriccionEstado.Visible    = false;
            lblRestriccionExisteID.Visible  = false;
            lblRestriccionProvincia.Visible = false;

            try
            {
                //Solicitud del usuario
                HttpCookie cookie    = Request.Cookies["UserInfo"];
                int        idUsuario = Int32.Parse(cookie["idUsuario"]);
                direccion.idJuez = idUsuario;

                //Se obtiene la provincia del juez
                DataTable provincia = direccion.obtenerProvinciaJuez();

                //Se obtiene la denuncia que evalua el juez
                hdfIdDenuncia.Value = txtIdDenuncia.Text;               //Se almacena el idDenuncia
                denuncia.idDenuncia = Int32.Parse(hdfIdDenuncia.Value);
                DataTable tableDenuncia = denuncia.denunciaEspecifica();

                string newProvincia = provincia.Rows[0][0].ToString();

                //Verifica si la provincia del juez y la denuncia son diferentes
                if (provincia.Rows[0][0].ToString() != tableDenuncia.Rows[0][2].ToString())
                {
                    lblRestriccionProvincia.Visible = true;
                }

                //Verifica el estado de la denuncia
                else if (tableDenuncia.Rows[0][8].ToString() != "Registrado")
                {
                    lblRestriccionEstado.Visible = true;
                }
                else
                {
                    //Limpia y carga la pagina
                    cargarInterfaz();
                    txtTitulo.Text      = tableDenuncia.Rows[0][0].ToString();
                    txtDescripcion.Text = tableDenuncia.Rows[0][1].ToString();
                    txtProvincia.Text   = tableDenuncia.Rows[0][2].ToString();
                    txtCanton.Text      = tableDenuncia.Rows[0][3].ToString();
                    txtDistrito.Text    = tableDenuncia.Rows[0][4].ToString();
                    txtDetalle.Text     = tableDenuncia.Rows[0][5].ToString();
                    byte[] bytesFoto    = (byte[])tableDenuncia.Rows[0][6];
                    string base64String = Convert.ToBase64String(bytesFoto, 0, bytesFoto.Length);
                    imgDenuncia.ImageUrl = "data:image/png;base64," + base64String;
                }
            }
            catch (Exception ex)
            {
                lblRestriccionExisteID.Visible = true;
            }
        }
Exemple #2
0
        //Evento al presionar el boton ModificarDenuncia
        protected void btnModificarDenuncia_Click(object sender, EventArgs e)
        {
            lblRestriccionExisteID.Visible          = false;
            lblRestriccionDenunciaDiferente.Visible = false;
            lblRestriccionEstado.Visible            = false;
            try
            {
                //Se solicita informacion del usuario
                HttpCookie cookie = Request.Cookies["UserInfo"];
                int        idUsuario;
                idUsuario = Int32.Parse(cookie["idUsuario"]);

                //Se obtiene la denuncia que quiere modificar el usuario
                hdfIdDenuncia.Value = txtIdDenuncia.Text;
                denuncia.idDenuncia = Int32.Parse(hdfIdDenuncia.Value);
                DataTable tableDenuncia = denuncia.denunciaEspecifica();

                //Se realizan validaciones
                if (idUsuario.ToString() != tableDenuncia.Rows[0][7].ToString())
                {
                    lblRestriccionDenunciaDiferente.Visible = true;
                }
                else if (tableDenuncia.Rows[0][8].ToString() != "Registrado")
                {
                    lblRestriccionEstado.Visible = true;
                }
                else
                {
                    //Carga la ventana con los datos de la denuncia
                    cargarInterfaz();
                    txtTitulo.Text      = tableDenuncia.Rows[0][0].ToString();
                    txtDescripcion.Text = tableDenuncia.Rows[0][1].ToString();
                }
            }
            catch (Exception)
            {
                lblRestriccionExisteID.Visible = true;
            }
        }
 //Evento al presionar el boton Iniciar Solucion
 protected void btnIniciarSolucion_Click(object sender, EventArgs e)
 {
     lblRestriccionExisteID.Visible = false;
     lblRestriccionEstado.Visible   = false;
     try
     {
         hdfIdDenuncia.Value = txtIdDenuncia.Text;
         denuncia.idDenuncia = Int32.Parse(hdfIdDenuncia.Value);
         DataTable tableDenuncia = denuncia.denunciaEspecifica();
         if (tableDenuncia.Rows[0][8].ToString() != "En Proceso")
         {
             lblRestriccionEstado.Visible = true;
         }
         else
         {
             cargarInterfaz();
         }
     }
     catch (Exception)
     {
         lblRestriccionExisteID.Visible = true;;
     }
 }