예제 #1
0
        /// <summary>
        /// Método que permite seleccionar  
        /// un único registro en la tabla estado
        /// </summary>
        /// <returns>poEstado valor del resultado de la ejecución de la sentencia</returns>
        public static List<cls_totalidadLabores> TotalidadLaboresPorProyecto(cls_totalidadLabores po_totalidadLabores)
        {
            List<cls_totalidadLabores> vo_lista = null;
               cls_totalidadLabores vo_totalidadLabores = null;

               try
               {
               String vs_comando = "PA_estd_inversionTiempos";
               cls_parameter[] vu_parametros = { new cls_parameter("@paramProyecto", po_totalidadLabores.pPK_proyecto),
                                                  new cls_parameter("@paramFechaInicio", po_totalidadLabores.pFechaDesde),
                                                  new cls_parameter("@paramFechaFin", po_totalidadLabores.pFechaHasta),
                                                 new cls_parameter("@paramUsuario", po_totalidadLabores.pPK_usuario)};

               DataSet vu_dataSet = cls_sqlDatabase.executeDataset(vs_comando, true, vu_parametros);

               vo_lista = new List<cls_totalidadLabores>();
               for (int i = 0; i < vu_dataSet.Tables[0].Rows.Count; i++)
               {
                   vo_totalidadLabores = new cls_totalidadLabores();

                   vo_totalidadLabores.pTipoLabor = vu_dataSet.Tables[0].Rows[i]["tipo"].ToString();

                   vo_totalidadLabores.pCantidad = Convert.ToInt32(vu_dataSet.Tables[0].Rows[i]["cantidad"].ToString());

                   vo_lista.Add(vo_totalidadLabores);
               }

               return vo_lista;
               }
               catch (Exception po_exception)
               {
               throw new Exception("Ocurrió un error al obtener el gráfico de la totalidad de labores.", po_exception);
               }
        }
        /// <summary>
        /// Método que obtiene la información con la que se va a cargar en gráfico
        /// </summary>
        private void obtenerGraficoPorProyecto(int pi_proyecto, string ps_usuario)
        {
            try
            {
                //Se procede a obtener la información por proyecto
                cls_totalidadLabores vo_estadistico = new cls_totalidadLabores();
                vo_estadistico.pPK_proyecto = pi_proyecto;
                vo_estadistico.pPK_usuario = ps_usuario;
                List<cls_totalidadLabores> vl_estadistico = cls_gestorEstadistico.TotalidadLaboresPorProyecto(vo_estadistico);

                //Se asignan los tooltips para el gráfico
                Grafico.Series["Leyendas"].ToolTip = "#VALX: #VAL{d}";
                Grafico.Series["Leyendas"].LegendToolTip = "#VALX: #VAL{d}";
                Grafico.Series["Leyendas"].IsVisibleInLegend = true;
                Grafico.Series["Leyendas"].Label = "#VALX\n#PERCENT";
                Grafico.Series["Leyendas"].PostBackValue = "#INDEX";
                Grafico.Series["Leyendas"].LegendPostBackValue = "#INDEX";

                //Se realiza el binding de la información que se obtuvo en la consulta
                Grafico.Series["Leyendas"].Points.DataBindXY(vl_estadistico, "pTipoLabor", vl_estadistico, "pCantidad");

                //Se asignan los colores de la composición del gráfico
                Grafico.Series["Leyendas"].Points[0].Color = Color.Tomato;
                if (Grafico.Series["Leyendas"].Points.Count > 1)
                {
                    Grafico.Series["Leyendas"].Points[1].Color = Color.SteelBlue;
                }
                if (Grafico.Series["Leyendas"].Points.Count > 2)
                {
                    Grafico.Series["Leyendas"].Points[2].Color = Color.Orange;
                }

                //Se indica que tipo de gráfico se va a presentar al usuario
                Grafico.Series["Leyendas"].ChartType = SeriesChartType.Pie;

                //Se asignan los estilos del gráfico
                Grafico.Series["Leyendas"]["PieLabelStyle"] = "Disabled";
                Grafico.ChartAreas["AreaGrafico"].Area3DStyle.Enable3D = true;
                Grafico.Series["Leyendas"].Points[0]["Exploded"] = "true";
                Grafico.Legends[0].Enabled = true;

                // Show a 30% perspective
                Grafico.ChartAreas["AreaGrafico"].Area3DStyle.Perspective = 40;
                // Set the X Angle to 30
                Grafico.ChartAreas["AreaGrafico"].Area3DStyle.Inclination = 65;
                // Set the Y Angle to 40
                Grafico.ChartAreas["AreaGrafico"].Area3DStyle.Rotation = 30;

                //Se aplica el estilo pastel a los colores definidos para el gráfico
                Grafico.Palette = ChartColorPalette.BrightPastel;
                Grafico.ApplyPaletteColors();
                //Para que el estilo tome efecto se debe asignar a cada uno de los puntos de la serie en el gráfico
                foreach (var series in Grafico.Series)
                {
                    foreach (var point in series.Points)
                    {
                        point.Color = Color.FromArgb(220, point.Color);
                    }
                }

                // Set Antialiasing mode
                Grafico.AntiAliasing = AntiAliasingStyles.Graphics;
            }
            catch (Exception po_exception)
            {
                throw new Exception("Ocurrió un error al cargar el gráfico con la información de la base de datos.", po_exception);
            }
        }