예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            StringBuilder htmlText = new StringBuilder();

            if (!IsPostBack)
            {
                bool bSinMarcoEnDrupal = false;

                //Si especificamos el parametro d cargaremos los enlaces para apuntar directamente a la página de Drupal
                if (Request["d"] != null)
                {
                    bSinMarcoEnDrupal = true;
                }

                // Check to see if the startup script is already registered.
                //if (!cs.IsStartupScriptRegistered(cstype, csname1))
                {
                    using (Entities c = new Entities())
                    {
                        c.Configuration.ProxyCreationEnabled = false;
                        int iLegActual = LEGISLATURA.GetActualLegislatura();
                        var results    = c.DEPARTAMENTO.Where(d => d.LEGISLATURA_ID == iLegActual && d.VISIBLE == true).ToList().OrderBy(d => d.ORDEN);


                        string  sProgBarId = "";
                        string  sLinkDep   = "";
                        decimal decProg;

                        decimal decTL;
                        int     iObjetivosSinIniciar          = 0;
                        int     iObjetivosIniciados           = 0;
                        int     iObjetivosTerminados          = 0;
                        int     iNumAcciones                  = 0;
                        int     iNumObjetivos                 = 0;
                        int     iSumaPorcenajesAvanceAcciones = 0;
                        decimal dPorcSinIniciar               = 0;
                        decimal dPorcIniciados                = 0;
                        decimal dPorcTerminados               = 0;
                        decimal dPorcIndiceGlobalCumplimiento = 0;

                        //decimal dObjetivosEnMarcha;
                        LEGISLATURA.GetDatosCuadroMando(out decTL, out iObjetivosSinIniciar, out iObjetivosIniciados, out iObjetivosTerminados,
                                                        out iSumaPorcenajesAvanceAcciones, out iNumAcciones, out iNumObjetivos,
                                                        out dPorcSinIniciar, out dPorcIniciados, out dPorcTerminados, out dPorcIndiceGlobalCumplimiento);



                        htmlText.Append("<div class='cont-progress-bar-sinmarco' style='width:99%' title='" + dPorcIndiceGlobalCumplimiento + "% índice global de cumplimiento. " + decTL + "% Legislatura completada'>Índice global de cumplimiento");
                        htmlText.Append("<div class='progress'>");

                        if (dPorcIndiceGlobalCumplimiento >= decTL)
                        {
                            htmlText.Append("<div class='progress-bar-marca-leg-sup' style='width: " + decTL + "%' title='" + dPorcIndiceGlobalCumplimiento + "% Índice global de cumplimiento. " + decTL + "% Legislatura completada'></div>");
                            htmlText.Append("<div class='progress-bar progress-bar-striped active-sup' style='background-color: #a2c451; width: " + dPorcIndiceGlobalCumplimiento + "%;'>" + dPorcIndiceGlobalCumplimiento + "%</div>");
                        }
                        else
                        {
                            htmlText.Append("<div class='progress-bar-marca-leg' style='width: " + decTL + "%' title='" + decTL + "% Legislatura completada'></div>");
                            htmlText.Append("<div class='progress-bar progress-bar-striped active' style='background-color: #a2c451; width: " + dPorcIndiceGlobalCumplimiento + "%;'>" + dPorcIndiceGlobalCumplimiento + "%</div>");
                        }



                        htmlText.Append("</div></div>");
                        int i = 1;

                        foreach (DEPARTAMENTO dep in results)
                        {
                            if (i == 1)
                            {
                                htmlText.Append("<div class='row'>");
                            }

                            htmlText.Append("<div class='col-sm-4'>");

                            sProgBarId = "progbar" + dep.DEPARTAMENTO_ID;
                            sLinkDep   = "a" + dep.DEPARTAMENTO_ID;
                            decProg    = dep.GetEvolucion();

                            htmlText.Append("<div class='cont-progress-bar' title='Plan de Gobierno del Departamento de " + dep.DESCRIPCION + ": " + decProg + "% índice global de cumplimiento. Haga clic para ver el detalle.' onclick='document.getElementById(\"" + sLinkDep + "\").click()'>");


                            if (bSinMarcoEnDrupal)
                            {
                                htmlText.Append("<a title='Plan de Gobierno del Departamento de " + dep.DESCRIPCION + ": " + decProg + "% índice global de cumplimiento. Haga clic para ver el detalle.' class='apg' id=" + sLinkDep + " style='cursor: pointer;' onclick='return handleOnclick(event);' target='_parent' href='//transparencia.aragon.es/content/plan-de-gobierno-detalle-departamento?id=" + dep.DEPARTAMENTO_ID + "'>" + dep.DESCRIPCION + "</a>");
                            }
                            else
                            {
                                htmlText.Append("<a title='Plan de Gobierno del Departamento de " + dep.DESCRIPCION + ": " + decProg + "% índice global de cumplimiento. Haga clic para ver el detalle.' class='apg' id=" + sLinkDep + " style='cursor: pointer;' onclick='return handleOnclick(event);' target='_blank' href='DetalleDepartamento?id=" + dep.DEPARTAMENTO_ID + "'>" + dep.DESCRIPCION + "</a>");
                            }

                            htmlText.Append("<div class='progress'>");

                            if (decProg >= decTL)
                            {
                                //Si sobrepasa el % cambiamos el estilo para que se vea la barra
                                htmlText.Append("<div class='progress-bar-marca-leg-sup' style='width: " + decTL + "%' title='Plan de Gobierno del Departamento de " + dep.DESCRIPCION + ": " + decProg + "% índice global de cumplimiento. " + decTL + "% Legislatura completada. Haga clic para ver el detalle.'></div>");
                                htmlText.Append("<div class='progress-bar progress-bar-striped active-sup' title='Plan de Gobierno del Departamento de " + dep.DESCRIPCION + ": " + decProg + "% índice global de cumplimiento. Haga clic para ver el detalle.' style='width: " + decProg + "%;'>" + decProg + "%</div>");
                            }
                            else
                            {
                                htmlText.Append("<div class='progress-bar-marca-leg' style='width: " + decTL + "%' title='" + decTL + "% Legislatura completada'></div>");
                                htmlText.Append("<div class='progress-bar progress-bar-striped active' title='Plan de Gobierno del Departamento de " + dep.DESCRIPCION + ": " + decProg + "% índice global de cumplimiento. Haga clic para ver el detalle.' style='width: " + decProg + "%;'>" + decProg + "%</div>");
                            }



                            htmlText.Append("</div></div></div>");

                            if (i == 3)
                            {
                                i = 1;
                                htmlText.Append("</div>");
                            }
                            else
                            {
                                i++;
                            }
                        }
                    }

                    this.litBarrasDep.Text = htmlText.ToString();
                }
            }
        }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!(User.IsInRole(AspNetRoles.ADMINISTRADOR)) && !(User.IsInRole(AspNetRoles.VALIDADOR)))
        {
            //Intenta acceder un usuario sin permisos
            logger.Info("No autorizadoError en get_report.aspx. Usuario: " + User.Identity.GetUserId());
        }


        ReportDocument rpt = new ReportDocument();

        int?iDptoId = null;

        try
        {
            if (!String.IsNullOrEmpty(Request["id"]))
            {
                iDptoId = Convert.ToInt32(Request["id"]);
            }



            using (Entities c = new Entities())
            {
                List <DEPARTAMENTO> dptos = null;

                if (iDptoId.HasValue)
                {
                    dptos = c.DEPARTAMENTO.Where(st => st.DEPARTAMENTO_ID == iDptoId.Value).ToList();
                }
                else
                {
                    int iLegActual = LEGISLATURA.GetActualLegislatura();
                    dptos = c.DEPARTAMENTO.Where(st => st.LEGISLATURA_ID == iLegActual).OrderBy(st => st.ORDEN).ToList();
                }

                int     iRow = 0;
                DataSet ds   = new DataSet();
                ds.ReadXmlSchema(Server.MapPath("~/App_Code/informePLGO.xsd"));


                foreach (DEPARTAMENTO dep in dptos)
                {
                    List <OBJETIVO> objetivos;

                    objetivos = c.CONTENIDO.OfType <OBJETIVO>().Where(st => st.DEPARTAMENTO_ID == dep.DEPARTAMENTO_ID && st.VISIBLE == true).OrderBy(st => st.OBJETIVO_ESTRATEGICO).ToList();

                    foreach (OBJETIVO obj in objetivos)
                    {
                        List <ACCION> acciones;
                        acciones = c.CONTENIDO.OfType <ACCION>().Where(st => st.DEPARTAMENTO_ID == dep.DEPARTAMENTO_ID && st.OBJETIVO_CONTENIDO_ID == obj.CONTENIDO_ID && st.VISIBLE == true).OrderBy(st => st.INSTRUMENTOS_ACT).ToList();

                        foreach (ACCION acc in acciones)
                        {
                            DataRow dr = ds.Tables[0].NewRow();
                            dr[0] = dep.DESCRIPCION;
                            dr[1] = obj.OBJETIVO_ESTRATEGICO;
                            dr[2] = acc.INSTRUMENTOS_ACT;
                            dr[3] = acc.ORGANO_RESPONSABLE;
                            dr[4] = acc.RECURSOS_HUMANOS;
                            dr[5] = acc.COSTE_ECONOMICO;
                            dr[6] = acc.MEDIOS_OTROS;
                            dr[7] = acc.TEMPORALIDAD;
                            dr[8] = acc.SEGUIMIENTO;
                            dr[9] = acc.ESTADOS_SEGUIMIENTO.DESCRIPCION;

                            if (acc.FECHA_MODIFICACION.HasValue)
                            {
                                dr[10] = acc.FECHA_MODIFICACION.Value.ToShortDateString();
                            }
                            else
                            {
                                dr[10] = acc.FECHA_CREACION.ToShortDateString();
                            }

                            dr[11] = dep.ORDEN;

                            ds.Tables[0].Rows.Add(dr);
                        }
                    }
                }


                rpt.Load(MapPath(Request.ApplicationPath + "/AdmPlanes/InformeAdmPlanes.rpt"));

                rpt.Database.Tables["DataTable1"].SetDataSource(ds);

                string sFormato       = "";
                string sNombreArchivo = "EstadoSeguimientoPlanDeGobierno";

                if (!String.IsNullOrEmpty(Request["format"]))
                {
                    sFormato = Request["format"].ToUpper();
                }


                if (String.IsNullOrEmpty(sFormato))
                {
                    //por defecto exportamos en PDF
                    rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, sNombreArchivo);
                }

                if (sFormato.Equals("PDF"))
                {
                    rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, sNombreArchivo);
                }
                else if (sFormato.Equals("DOC"))
                {
                    rpt.ExportToHttpResponse(ExportFormatType.WordForWindows, Response, false, sNombreArchivo);
                }
                else if (sFormato.Equals("XLS"))
                {
                    rpt.ExportToHttpResponse(ExportFormatType.Excel, Response, false, sNombreArchivo);
                }
                else if (sFormato.Equals("XLSREC"))
                {
                    rpt.ExportToHttpResponse(ExportFormatType.ExcelRecord, Response, false, sNombreArchivo);
                }
                else if (sFormato.Equals("RTF"))
                {
                    rpt.ExportToHttpResponse(ExportFormatType.RichText, Response, false, sNombreArchivo);
                }

                /*else if (sFormato.Equals("XML")) //NO ES COMPATIBLE CON CR10, si que va con CR13
                 *  rpt.ExportToHttpResponse(ExportFormatType.Xml, Response, false, sNombreArchivo);                */
            }
        }
        catch (Exception ex)
        {
            logger.Error("Error en AdmPlanes/get_report.aspx  get_report(). Error: " + ex.Message + " " + ex.InnerException);
        }
    }