protected void Listar()
    {
        string estado = string.Empty;

        if (ddlEstados.SelectedIndex == 0)
        {
            estado = string.Empty;
        }
        else
        {
            estado = ddlEstados.SelectedValue.ToString();
        }
        BL_BUENAS_IDEAS obj         = new BL_BUENAS_IDEAS();
        DataTable       dtResultado = new DataTable();

        dtResultado = obj.uspSEL_BUENAS_IDEAS_TODOS(estado);
        if (dtResultado.Rows.Count > 0)
        {
            GridView1.Visible    = true;
            GridView1.DataSource = dtResultado;
            GridView1.DataBind();
        }
        else
        {
            GridView1.Visible    = false;
            GridView1.DataSource = dtResultado;
            GridView1.DataBind();
        }
    }
Beispiel #2
0
    protected void Nominaciones()
    {
        BL_BUENAS_IDEAS obj         = new BL_BUENAS_IDEAS();
        DataTable       dtResultado = new DataTable();

        dtResultado = obj.uspSEL_BUENAS_IDEAS_ID(Convert.ToInt32(Session["IDE_IDEAS"].ToString()));
        if (dtResultado.Rows.Count > 0)
        {
            ListView1.DataSource = dtResultado;
            ListView1.DataBind();
        }
        else
        {
            ListView1.DataSource = dtResultado;
            ListView1.DataBind();
        }
    }
    protected void btnGuardar_Click(object sender, EventArgs e)
    {
        BL_BUENAS_IDEAS obj = new BL_BUENAS_IDEAS();
        DataTable       dt  = new DataTable();

        if (txtSustento.Text != string.Empty)
        {
            dt = obj.uspSEL_BUENA_IDEA_PROCESAR(Convert.ToInt32(lblCodigo.Text), "R", 0, txtSustento.Text.Trim(), Session["IDE_USUARIO"].ToString());

            string cleanMessage = "Registro procesado";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);

            Listar();
        }
        else
        {
            string cleanMessage = "ingresar sustento de rechazo";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
    }
    protected void ProcesarReconocimiento(object sender, ImageClickEventArgs e)
    {
        ImageButton btnProcesar = ((ImageButton)sender);
        GridViewRow row         = btnProcesar.NamingContainer as GridViewRow;
        string      pk          = GridView1.DataKeys[row.RowIndex].Values[0].ToString();

        RadioButtonList rb       = (RadioButtonList)row.FindControl("rdoOpcion");
        TextBox         txtPunto = (TextBox)row.FindControl("txtPunto");


        //string z= pk + " - " + rb.SelectedValue;
        BL_BUENAS_IDEAS obj = new BL_BUENAS_IDEAS();
        DataTable       dt  = new DataTable();

        if (rb.SelectedValue == "R")
        {
            ModalRegistro.Show();
            lblCodigo.Text = pk.ToString();
        }
        else if (rb.SelectedValue == "A")
        {
            if (txtPunto.Text == string.Empty)
            {
                string cleanMessage = "Ingresar puntaje de reconocimiento";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
            }
            else
            {
                dt = obj.uspSEL_BUENA_IDEA_PROCESAR(Convert.ToInt32(pk), rb.SelectedValue, Convert.ToInt32(txtPunto.Text), "", Session["IDE_USUARIO"].ToString());

                string cleanMessage = "Registro procesado";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);

                Listar();
            }
        }
    }
Beispiel #5
0
    protected void btnenviar_Click(object sender, EventArgs e)
    {
        string cleanMessage = string.Empty;

        if (txttitulo.Text.Trim() == string.Empty)
        {
            cleanMessage = "Ingresar título de la propuesta de mejora";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (txtdescripcion.Text.Trim() == string.Empty)
        {
            cleanMessage = "Ingresar objetivo de la meta o propósito a alcanzar";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (txtsolucion.Text.Trim() == string.Empty)
        {
            cleanMessage = "Ingresar descripción de la solución a plantear";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (txtventajas.Text.Trim() == string.Empty)
        {
            cleanMessage = "Ingresar descripción de la solución a plantear";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (txtareas.Text.Trim() == string.Empty)
        {
            cleanMessage = "Ingresar áreas involucradas";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else
        {
            // Si el directorio no existe, crearlo
            if (!Directory.Exists(Server.MapPath(FolderBuenasIdeas)))
            {
                Directory.CreateDirectory(FolderBuenasIdeas);
            }

            String  fileExtension = string.Empty;
            Boolean fileOK        = false;
            string  fileArchivo   = string.Empty;
            if (FileUpload1.HasFile)
            {
                string fileName = FileUpload1.FileName;
                int    length   = FileUpload1.PostedFile.ContentLength;

                fileExtension = Path.GetExtension(FileUpload1.PostedFile.FileName);

                String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx" };
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        fileOK = true;
                    }
                }
            }

            if (fileOK)
            {
                try
                {
                    // Se carga la ruta física de la carpeta temp del sitio
                    string ruta = Server.MapPath(FolderBuenasIdeas);

                    // Si el directorio no existe, crearlo
                    if (!Directory.Exists(ruta))
                    {
                        Directory.CreateDirectory(ruta);
                    }

                    string archivo = String.Format("{0}\\{1}", ruta, FileUpload1.FileName);

                    // Verificar que el archivo no exista
                    if (File.Exists(archivo))
                    {
                        fileArchivo = DateTime.UtcNow.ToFileTimeUtc() + Path.GetExtension(FileUpload1.PostedFile.FileName);
                        FileUpload1.SaveAs(ruta + fileArchivo);
                    }

                    else
                    {
                        fileArchivo = FileUpload1.PostedFile.FileName;
                        FileUpload1.SaveAs(archivo);
                    }
                }
                catch (Exception ex)
                {
                    cleanMessage = "Archivo no puedo ser cargado";
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                }
            }

            BE_BUENAS_IDEAS oBESol = new BE_BUENAS_IDEAS();
            oBESol.IDE_IDEAS             = 0;
            oBESol.DESCRIPCION_PROPUESTA = txtdescripcion.Text.Trim();
            oBESol.SOLUCION      = txtsolucion.Text.Trim();
            oBESol.VENTAJAS      = txtventajas.Text.Trim();
            oBESol.AREAS         = txtareas.Text.Trim();
            oBESol.USER_REGISTRO = Session["IDE_USUARIO"].ToString();
            oBESol.TITULO        = txttitulo.Text.Trim();
            oBESol.FILE          = fileArchivo;
            oBESol.URL           = Server.MapPath(FolderBuenasIdeas);
            int dtrpta = 0;
            dtrpta = new BL_BUENAS_IDEAS().uspINS_BUENAS_IDEAS(oBESol);
            if (dtrpta > 0)
            {
                BL_BUENAS_IDEAS oB = new BL_BUENAS_IDEAS();
                oB.SP_EnviarCorreo_BuenIdea(dtrpta.ToString());
                cleanMessage = "Registro exitoso. Tu propuesta está siendo revisada, en caso de ser aprobada, te informaremos sobre tu reconocimiento, gracias";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);

                txtdescripcion.Text = string.Empty;
                txtsolucion.Text    = string.Empty;
                txtventajas.Text    = string.Empty;
                txtareas.Text       = string.Empty;
                txttitulo.Text      = string.Empty;
            }
        }
    }