Exemplo n.º 1
0
        /// <summary>
        /// Método que permite seleccionar  
        /// un único registro en la tabla estado
        /// </summary>
        /// <returns>vo_lista valor del resultado de la ejecución de la sentencia</returns>
        public static List<cls_topActividades> TopActividadesPorProyecto(cls_topActividades po_topActividades)
        {
            List<cls_topActividades> vo_lista = null;
            cls_topActividades vo_topActividades = null;

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

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

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

                    vo_topActividades.pNombreActividad = vu_dataSet.Tables[0].Rows[i]["actividad"].ToString();

                    vo_topActividades.pCantidadHoras = Convert.ToDecimal(vu_dataSet.Tables[0].Rows[i]["cantidadHoras"].ToString());

                    vo_lista.Add(vo_topActividades);
                }

                return vo_lista;
            }
            catch (Exception po_exception)
            {
                throw new Exception("Ocurrió un error al obtener el gráfico del top de actividades por proyecto.", po_exception);
            }
        }
        /// <summary>
        /// Método que obtiene la información con la que se va a cargar en gráfico
        /// </summary>
        private void obtenerGraficoActividadesPorProyecto(int ps_proyecto, DateTime pd_fechaDesde, DateTime pd_fechaHasta, string ps_usuario)
        {
            try
            {
                //Se procede a obtener la información por proyecto
                cls_topActividades vo_topActividades = new cls_topActividades();
                vo_topActividades.pPK_proyecto = ps_proyecto;
                vo_topActividades.pFechaDesde = pd_fechaDesde;
                vo_topActividades.pFechaHasta = pd_fechaHasta;
                vo_topActividades.pPK_usuario = ps_usuario;

                List<cls_topActividades> vl_topActividades = cls_gestorEstadistico.TopActividadesPorProyecto(vo_topActividades);

                //Se asignan los tooltips para el gráfico
                Grafico.Series["Leyendas"].ToolTip = "#VALX: #VAL{d} horas";
                Grafico.Series["Leyendas"].LegendToolTip = "#VALX: #VAL{d} Horas";
                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_topActividades, "pNombreActividad", vl_topActividades, "pCantidadHoras");

                Grafico.Legends[0].Enabled = false;

                // Set pyramid chart type
                Grafico.Series["Leyendas"].ChartType = SeriesChartType.Pyramid;

                // Set pyramid data point labels style
                Grafico.Series["Leyendas"]["PyramidLabelStyle"] = "Outside";

                // Place labels on the left side
                Grafico.Series["Leyendas"]["PyramidOutsideLabelPlacement"] = "Right";

                // Set gap between points
                Grafico.Series["Leyendas"]["PyramidPointGap"] = "2";

                // Set minimum point height
                Grafico.Series["Leyendas"]["PyramidMinPointHeight"] = "1";

                // Set 3D mode
                Grafico.ChartAreas["AreaGrafico"].Area3DStyle.Enable3D = true;

                // Set 3D angle
                Grafico.Series["Leyendas"]["Pyramid3DRotationAngle"] = "9";

                // Set 3D drawing style
                Grafico.Series["Leyendas"]["Pyramid3DDrawingStyle"] = "SquareBase";

                //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;
                Grafico.AlignDataPointsByAxisLabel();
            }
            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);
            }
        }