protected void pgDetalleCompetencia_CellDataBound(object sender, Telerik.Web.UI.PivotGridCellDataBoundEventArgs e) { if (e.Cell is PivotGridRowHeaderCell) { if (e.Cell.Controls.Count > 1) { (e.Cell.Controls[0] as Button).Visible = false; } } }
protected void grdPresupuesto_CellDataBound(object sender, Telerik.Web.UI.PivotGridCellDataBoundEventArgs e) { //&month& patterns is added in the DataFormatString, so it could be catched and parsed to month name if (e.Cell is PivotGridColumnHeaderCell) { int month = 0; string strMes = ""; PivotGridColumnHeaderCell cell = e.Cell as PivotGridColumnHeaderCell; strMes = cell.Text.ToString(); if (strMes.Length > 0 && strMes.Length < 3) { string cellValue = strMes; if (int.TryParse(cellValue, out month)) { cell.Text = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(int.Parse(cellValue)); } } } }
protected void rpgReporte_CellDataBound(object sender, Telerik.Web.UI.PivotGridCellDataBoundEventArgs e) { int vNoValorCompetencia; if (e.Cell is PivotGridRowHeaderCell) { if (e.Cell.Controls.Count > 1) { (e.Cell.Controls[0] as Button).Visible = false; } } if (e.Cell is PivotGridDataCell) { PivotGridDataCell celda = (PivotGridDataCell)e.Cell; e.Cell.HorizontalAlign = HorizontalAlign.Center; if (celda.IsGrandTotalCell) { vNoValorCompetencia = Convert.ToInt32((decimal)e.Cell.DataItem); if (vNoValorCompetencia < 70) { e.Cell.ForeColor = System.Drawing.Color.Red; } else if (vNoValorCompetencia >= 70 & vNoValorCompetencia < 85) { e.Cell.ForeColor = System.Drawing.Color.Gold; } else if (vNoValorCompetencia >= 85) { e.Cell.ForeColor = System.Drawing.Color.Green; } } } }
protected void pgCompetencias_CellDataBound(object sender, Telerik.Web.UI.PivotGridCellDataBoundEventArgs e) { int vNoValorCompetencia; if (e.Cell is PivotGridColumnHeaderCell) { E_COMPARACION_COMPETENCIA vEmpleado = ComparacionCompetencias.Where(t => t.CL_EMPLEADO.Equals(e.Cell.DataItem.ToString())).FirstOrDefault(); if (vEmpleado != null) { e.Cell.ToolTip = vEmpleado.NB_EMPLEADO; e.Cell.Text = String.Format("<a href='#' onclick='OpenInventario({1})'>{0}</a>", vEmpleado.CL_EMPLEADO, vEmpleado.ID_EMPLEADO); oListaEmpleados.Add(e.Cell.DataItem.ToString()); } } if (e.Cell is PivotGridRowHeaderCell) { if (e.Cell.Controls.Count > 1) { (e.Cell.Controls[0] as Button).Visible = false; } } else if (e.Cell is PivotGridDataCell) { PivotGridDataCell celda = (PivotGridDataCell)e.Cell; if (celda.IsGrandTotalCell) { celda.Text = "<div style=\"text-align: center;\">" + obtenerPromedio(oListaEmpleados[celda.ColumnIndex]).ToString() + "</div>"; } else { System.Web.UI.HtmlControls.HtmlGenericControl divColor = celda.FindControl("divColorComparacion") as System.Web.UI.HtmlControls.HtmlGenericControl; System.Web.UI.HtmlControls.HtmlGenericControl divPromedio = celda.FindControl("divPromedio") as System.Web.UI.HtmlControls.HtmlGenericControl; System.Web.UI.HtmlControls.HtmlGenericControl divNa = celda.FindControl("divNa") as System.Web.UI.HtmlControls.HtmlGenericControl; System.Web.UI.HtmlControls.HtmlGenericControl divNc = celda.FindControl("divNc") as System.Web.UI.HtmlControls.HtmlGenericControl; if (e.Cell.DataItem != null) { if ((decimal)e.Cell.DataItem == Convert.ToDecimal(-1)) { //e.Cell.Text = "<div style=\"text-align: center;\">N/C</div>"; //e.Cell.CssClass = "PotencialNC"; divNa.Style.Add("display", "none"); divNc.Style.Add("display", "block"); divPromedio.Style.Add("display", "none"); divColor.Style.Add("background-color", "gray"); } else if (celda.ParentRowIndexes[2].ToString() == "Total de elementos en común:") { divNa.Style.Add("display", "none"); divNc.Style.Add("display", "none"); divPromedio.Style.Add("display", "block"); divPromedio.Style.Add(" font-weight", "bold"); divColor.Style.Add("background-color", "white"); } else { vNoValorCompetencia = Convert.ToInt32((decimal)e.Cell.DataItem); if (vNoValorCompetencia == 0) { //e.Cell.CssClass = "PotencialPuestoBajo"; this.rtmInfoEmpleados.TargetControls.Add(celda.ClientID, oListaEmpleados[celda.ColumnIndex], true); divNa.Style.Add("display", "none"); divNc.Style.Add("display", "none"); divPromedio.Style.Add("display", "none"); divColor.Style.Add("background-color", "red"); } else if (vNoValorCompetencia == 1) { //e.Cell.CssClass = "PotencialPuestoAlto"; divNa.Style.Add("display", "none"); divNc.Style.Add("display", "none"); divPromedio.Style.Add("display", "none"); divColor.Style.Add("background-color", "green"); this.rtmInfoEmpleados.TargetControls.Add(celda.ClientID, oListaEmpleados[celda.ColumnIndex], true); } else if (vNoValorCompetencia < 70) { //e.Cell.CssClass = "PotencialBajo"; divNa.Style.Add("display", "none"); divNc.Style.Add("display", "none"); divPromedio.Style.Add("display", "block"); divColor.Style.Add("background-color", "red"); } else if (vNoValorCompetencia >= 70 & vNoValorCompetencia <= 90) { //e.Cell.CssClass = "PotencialIntermedio"; divNa.Style.Add("display", "none"); divNc.Style.Add("display", "none"); divPromedio.Style.Add("display", "block"); divColor.Style.Add("background-color", "gold"); } else if (vNoValorCompetencia > 90) { //e.Cell.CssClass = "PotencialAlto"; divNa.Style.Add("display", "none"); divNc.Style.Add("display", "none"); divPromedio.Style.Add("display", "block"); divColor.Style.Add("background-color", "green"); } } } else { divNa.Style.Add("display", "none"); divNc.Style.Add("display", "block"); divPromedio.Style.Add("display", "none"); divColor.Style.Add("background-color", "gray"); } } } }
protected void pgridDetalle_CellDataBound(object sender, Telerik.Web.UI.PivotGridCellDataBoundEventArgs e) { if (e.Cell is PivotGridRowHeaderCell) { if (e.Cell.Controls.Count > 1) { (e.Cell.Controls[0] as Button).Visible = false; } PivotGridRowHeaderCell cell = e.Cell as PivotGridRowHeaderCell; if (vslotCompetenciaColor == cell.Slot) { switch (cell.Field.DataField.ToString()) { case "NB_CLASIFICACION_COMPETENCIA": cell.BorderColor = System.Drawing.ColorTranslator.FromHtml(vProgramasCapacitacion.ElementAt(cell.Slot).CL_COLOR.ToString()); cell.BorderWidth = 2; break; case "NB_COMPETENCIA": cell.BorderColor = System.Drawing.ColorTranslator.FromHtml(vProgramasCapacitacion.ElementAt(cell.Slot).CL_COLOR.ToString()); cell.BorderWidth = 2; break; case "CL_TIPO_COMPETENCIA": cell.BorderColor = System.Drawing.ColorTranslator.FromHtml(vProgramasCapacitacion.ElementAt(cell.Slot).CL_COLOR.ToString()); vslotCompetenciaColor++; cell.BorderWidth = 2; break; } } } if (e.Cell is PivotGridColumnHeaderCell) { PivotGridColumnHeaderCell cell = e.Cell as PivotGridColumnHeaderCell; switch (cell.Field.DataField.ToString()) { case "NB_EVALUADO": var objetoNecesidad = vProgramasCapacitacion.Where(x => x.NB_EVALUADO.Equals(cell.DataItem.ToString())).FirstOrDefault(); cell.Text = "<a>" + ((objetoNecesidad != null) ? objetoNecesidad.CL_EVALUADO.ToString() : "") + "</a> <br>" + cell.DataItem.ToString(); break; case "NB_PUESTO": var vobjetoNecesidadPuesto = vProgramasCapacitacion.Where(x => x.NB_PUESTO.Equals(cell.DataItem.ToString())).FirstOrDefault(); cell.Text = "<a>" + ((vobjetoNecesidadPuesto != null) ? vobjetoNecesidadPuesto.CL_PUESTO.ToString() : "") + "</a> <br>" + cell.DataItem.ToString(); break; default: break; } } if (e.Cell is PivotGridDataCell) { PivotGridDataCell cell = e.Cell as PivotGridDataCell; if (cell.Field.DataField.ToString().Equals("PR_RESULTADO")) { string Valor = cell.Text.ToString(); Decimal Devalor = Decimal.Parse(Valor); if (Devalor == 100) { cell.CssClass = "divBlanco"; cell.HorizontalAlign = HorizontalAlign.Right; } else if (Devalor >= 70) { cell.CssClass = "divAmarrillo"; cell.BorderColor = System.Drawing.Color.White; cell.BorderWidth = 1; cell.HorizontalAlign = HorizontalAlign.Right; } else if (Devalor >= 0 & Devalor < 70) { cell.CssClass = "divRojo"; cell.BorderColor = System.Drawing.Color.White; cell.BorderWidth = 1; cell.HorizontalAlign = HorizontalAlign.Right; } else { cell.CssClass = "divGrid"; cell.Text = "N/A"; } } } }