private void CargarPeriodo() { ConsultaGeneralNegocio neg = new ConsultaGeneralNegocio(); SPE_OBTIENE_FYD_PERIODO_EVALUACION_Result oPeriodo = neg.ObtenerPeriodoEvaluacion(vIdPeriodo); string vTiposEvaluacion = ""; if (oPeriodo != null) { // txtPeriodo.InnerText = oPeriodo.NB_PERIODO; txtClave.InnerText = oPeriodo.CL_PERIODO; txtDescripcion.InnerText = oPeriodo.DS_PERIODO; if (oPeriodo.DS_NOTAS != null) { XElement vNotas = XElement.Parse(oPeriodo.DS_NOTAS); if (vNotas != null) { txtDsNotas.InnerHtml = validarDsNotas(oPeriodo.DS_NOTAS); } } if (oPeriodo.FG_AUTOEVALUACION) { vTiposEvaluacion = string.IsNullOrEmpty(vTiposEvaluacion) ? "Autoevaluación" : String.Join(", ", vTiposEvaluacion, "Autoevaluacion"); } if (oPeriodo.FG_SUPERVISOR) { vTiposEvaluacion = string.IsNullOrEmpty(vTiposEvaluacion) ? "Superior" : String.Join(", ", vTiposEvaluacion, "Superior"); } if (oPeriodo.FG_SUBORDINADOS) { vTiposEvaluacion = string.IsNullOrEmpty(vTiposEvaluacion) ? "Subordinado" : String.Join(", ", vTiposEvaluacion, "Subordinado"); } if (oPeriodo.FG_INTERRELACIONADOS) { vTiposEvaluacion = string.IsNullOrEmpty(vTiposEvaluacion) ? "Interrelacionado" : String.Join(", ", vTiposEvaluacion, "Interrelacionado"); } if (oPeriodo.FG_OTROS_EVALUADORES) { vTiposEvaluacion = string.IsNullOrEmpty(vTiposEvaluacion) ? "Otros" : String.Join(", ", vTiposEvaluacion, "Otros"); } txtTiposEvaluacion.InnerText = vTiposEvaluacion; //if (oPeriodo.CL_ESTADO_PERIODO.ToUpper() == "ABIERTO") //{ // lblAdvertencia.Visible = true; //} //else //{ // lblAdvertencia.Visible = false; //} } }
protected void Page_Load(object sender, EventArgs e) { vClUsuario = ContextoUsuario.oUsuario.CL_USUARIO; vNbPrograma = ContextoUsuario.nbPrograma; vListaEmpleadoCompetencia = ""; if (!Page.IsPostBack) { vIdPeriodo = 0; vIdPrograma = null; vFgCargarGrid = false; if (Request.Params["PeriodoId"] != null) { vIdPeriodo = int.Parse(Request.Params["PeriodoId"].ToString()); SPE_OBTIENE_FYD_PERIODO_EVALUACION_Result vPeriodo = new SPE_OBTIENE_FYD_PERIODO_EVALUACION_Result(); PeriodoNegocio oPeriodo = new PeriodoNegocio(); vPeriodo = oPeriodo.ObtienePeriodoEvaluacion(vIdPeriodo); if (vPeriodo != null) { vFgCargarGrid = true; txtPeriodo.Text = vPeriodo.CL_PERIODO; txtNombrePeriodo.Text = vPeriodo.NB_PERIODO; CargarGrid(); } } } }
private void ObtenerPeriodo() { PeriodoNegocio nPeriodo = new PeriodoNegocio(); SPE_OBTIENE_FYD_PERIODO_EVALUACION_Result oPeriodo = nPeriodo.ObtienePeriodoEvaluacion(vIdPeriodo.Value); if (oPeriodo != null) { btnAutoevaluacion.Enabled = oPeriodo.FG_AUTOEVALUACION; btnSuperior.Enabled = oPeriodo.FG_SUPERVISOR; btnSubordinado.Enabled = oPeriodo.FG_SUBORDINADOS; btnInterrelacionado.Enabled = oPeriodo.FG_INTERRELACIONADOS; btnOrtos.Enabled = oPeriodo.FG_OTROS_EVALUADORES; } }
protected DataTable CrearDataTable <T>(IList <T> pLista, RadGrid pCtrlGrid) { List <int> lista = ContextoReportes.oReporteComparativo.Where(t => t.vIdReporteComparativo == vIdReporteComparativo).FirstOrDefault().vListaPeriodos; List <int> listPeriodos = new List <int>(); listPeriodos = lista; bool exists = listPeriodos.Exists(element => element == vIdPeriodo); if (!exists) { listPeriodos.Add(vIdPeriodo); } DataTable vColumnas = ConvertToDataTable(pLista, listPeriodos); ConsultaGeneralNegocio negGen = new ConsultaGeneralNegocio(); int?vMaxPuestos = 1; foreach (int item in listPeriodos.OrderBy(o => o)) { var vDatosReporteGlobal = negGen.ObtenerDatosReporteGlobal(item, null, false).ToList(); if (vDatosReporteGlobal.Count > 0) { vMaxPuestos = vDatosReporteGlobal.FirstOrDefault().NUM_PERIODOS; } SPE_OBTIENE_FYD_PERIODO_EVALUACION_Result oPeriodos = negGen.ObtenerPeriodoEvaluacion(item); GridTemplateColumn vBoundColumn = new GridTemplateColumn(); vBoundColumn.DataField = oPeriodos.ID_PERIODO.ToString(); vBoundColumn.UniqueName = oPeriodos.ID_PERIODO.ToString(); vBoundColumn.HeaderText = oPeriodos.CL_PERIODO; vBoundColumn.HeaderStyle.Width = (Unit)(vMaxPuestos * 110); vBoundColumn.ColumnGroupName = "gcCalificacion"; vBoundColumn.ItemTemplate = new MyTemplate(oPeriodos.ID_PERIODO.ToString()); vBoundColumn.FooterStyle.HorizontalAlign = HorizontalAlign.Center; vBoundColumn.FooterStyle.Font.Bold = true; vBoundColumn.AllowFiltering = false; vBoundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center; rdComparativo.MasterTableView.Columns.Add(vBoundColumn); } return(vColumnas); }
private void CargarPeriodo() { ConsultaGeneralNegocio neg = new ConsultaGeneralNegocio(); SPE_OBTIENE_FYD_PERIODO_EVALUACION_Result oPeriodo = neg.ObtenerPeriodoEvaluacion(vIdPeriodo); string vTiposEvaluacion = ""; if (oPeriodo != null) { //txtPeriodo.InnerText = oPeriodo.DS_PERIODO; //txtClavePeriodo.InnerText = oPeriodo.CL_PERIODO; txtClPeriodo.InnerText = oPeriodo.NB_PERIODO; txtDsPeriodo.InnerText = oPeriodo.DS_PERIODO; txtEstatus.InnerText = oPeriodo.CL_ESTADO_PERIODO; if (oPeriodo.FG_AUTOEVALUACION) { vTiposEvaluacion = string.IsNullOrEmpty(vTiposEvaluacion) ? "Autoevaluación" : String.Join(", ", vTiposEvaluacion, "Autoevaluacion"); } if (oPeriodo.FG_SUPERVISOR) { vTiposEvaluacion = string.IsNullOrEmpty(vTiposEvaluacion) ? "Superior" : String.Join(", ", vTiposEvaluacion, "Superior"); } if (oPeriodo.FG_SUBORDINADOS) { vTiposEvaluacion = string.IsNullOrEmpty(vTiposEvaluacion) ? "Subordinado" : String.Join(", ", vTiposEvaluacion, "Subordinado"); } if (oPeriodo.FG_INTERRELACIONADOS) { vTiposEvaluacion = string.IsNullOrEmpty(vTiposEvaluacion) ? "Interrelacionado" : String.Join(", ", vTiposEvaluacion, "Interrelacionado"); } if (oPeriodo.FG_OTROS_EVALUADORES) { vTiposEvaluacion = string.IsNullOrEmpty(vTiposEvaluacion) ? "Otros" : String.Join(", ", vTiposEvaluacion, "Otros"); } txtTipoEvaluacion.InnerText = vTiposEvaluacion; if (oPeriodo.DS_NOTAS != null) { if (oPeriodo.DS_NOTAS.Contains("DS_NOTA")) { txtNotas.InnerHtml = Utileria.MostrarNotas(oPeriodo.DS_NOTAS); } else { XElement vNotas = XElement.Parse(oPeriodo.DS_NOTAS); if (vNotas != null) { vNotas.Name = vNbFirstRadEditorTagName; txtNotas.InnerHtml = vNotas.ToString(); } } } ConsultaGeneralNegocio nConsulta = new ConsultaGeneralNegocio(); vIdEmpresa = ContextoUsuario.oUsuario.ID_EMPRESA; vIdRol = ContextoUsuario.oUsuario.oRol.ID_ROL; vLstEvaluados = nConsulta.ObtieneEvaluados(vIdPeriodo, vIdEmpresa, vIdRol); GuardarEvaluados(); oLstPeriodos.Add(new E_PERIODO_EVALUACION { ID_PERIODO = oPeriodo.ID_PERIODO, CL_PERIODO = oPeriodo.CL_PERIODO, NB_PERIODO = oPeriodo.NB_PERIODO, DS_PERIODO = oPeriodo.DS_PERIODO }); } //oListaPeriodosFuente = neg.ObtenerPeriodosEvaluacion(); //oListaPeriodosDestino = new List<E_PERIODO_EVALUACION>(); //rlbPeriodosDisponibles.DataSource = oListaPeriodosFuente; //rlbPeriodosComparar.DataSource = oListaPeriodosDestino; //rlbPeriodosComparar.DataBind(); //rlbPeriodosDisponibles.DataBind(); }
public UDTT_ARCHIVO ExportarDatosExcel(int?ID_PERIODO, int?ID_DEPARTAMENTO, string NB_DEPARTAMENTO, string DS_PRIORIDADES, int?vIdRol) { NecesidadesCapacitacionOperaciones op = new NecesidadesCapacitacionOperaciones(); PeriodoOperaciones neg = new PeriodoOperaciones(); List <SPE_OBTIENE_NECESIDADES_CAPACITACION_Result> lista = new List <SPE_OBTIENE_NECESIDADES_CAPACITACION_Result>(); SPE_OBTIENE_FYD_PERIODO_EVALUACION_Result periodo = new SPE_OBTIENE_FYD_PERIODO_EVALUACION_Result(); UDTT_ARCHIVO excelNecesidadCapacitacion = new UDTT_ARCHIVO(); int i = 11; int col = 0; int row = 0; bool FinalListaEmpleados = false; bool CompetenciaEncontrada = false; string vDsNotas = ""; string vNbFirstRadEditorTagName = "p"; periodo = neg.ObtenerPeriodoEvaluacion(ID_PERIODO.Value); lista = op.obtenerNecesidadesCapacitacion(ID_PERIODO, ID_DEPARTAMENTO, DS_PRIORIDADES, vIdRol); Stream newStream = new MemoryStream(); using (ExcelPackage pck = new ExcelPackage(newStream)) { var ws = pck.Workbook.Worksheets.Add("Reporte"); ws.View.ShowGridLines = false; //ponemos los encabezados con los datos del periodo ws.Cells["A1"].Value = "Periodo:"; ws.Cells["B1"].Value = periodo.NB_PERIODO; ws.Cells["A2"].Value = "Notas:"; if (periodo.DS_NOTAS != null) { XElement vNota = XElement.Parse(periodo.DS_NOTAS); if (vNota != null) { if (vNota.Element("DS_NOTAS") != null) { vDsNotas = vNota.Element("DS_NOTAS").Value; } } } ws.Cells["B2"].Value = vDsNotas; ws.Cells["A3"].Value = "Tipo de evaluacion:"; ws.Cells["A4"].Value = "Departamento:"; ws.Cells["B4"].Value = NB_DEPARTAMENTO; //Leyendas de colores del archivo de excel ws.Cells["D1:F1"].Merge = true; ws.Cells["D1"].Value = "Prioridades de Capacitación"; ws.Cells["D2"].Value = "Alta:"; ws.Cells["D3"].Value = "Intermedia:"; ws.Cells["D4"].Value = "No necesaria:"; ws.Cells["D5"].Value = "No Aplica:"; ws.Cells["F2"].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; ws.Cells["F3"].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; ws.Cells["F4"].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; ws.Cells["F5"].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; ws.Cells["F2"].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.Red); ws.Cells["F3"].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.Gold); ws.Cells["F4"].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.White); ws.Cells["F5"].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.LightGray); //formato de encabezados ws.Cells["A7:A10"].Merge = true; ws.Cells["B7:B10"].Merge = true; ws.Cells["C7:C10"].Merge = true; ws.Cells["A7"].Value = "CATEGORIA"; ws.Cells["B7"].Value = "CLASIFICACION"; ws.Cells["C7"].Value = "COMPETENCIA"; ws.Cells["A7"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center; ws.Cells["A7"].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center; ws.Cells["A7"].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; ws.Cells["A7"].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.Lavender); ws.Cells["B7"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center; ws.Cells["B7"].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center; ws.Cells["B7"].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; ws.Cells["B7"].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.Lavender); ws.Cells["C7"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center; ws.Cells["C7"].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center; ws.Cells["C7"].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; ws.Cells["C7"].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.Lavender); //Obtenemos las distintas competencias que se generan en la DNC. var competencias = (from a in lista select new { a.NB_CLASIFICACION_COMPETENCIA, a.CL_TIPO_COMPETENCIA, a.NB_COMPETENCIA, a.CL_COLOR }).Distinct(); foreach (var item in competencias) { ws.Cells["A" + i.ToString()].Value = item.CL_TIPO_COMPETENCIA; ws.Cells["B" + i.ToString()].Value = item.NB_CLASIFICACION_COMPETENCIA; ws.Cells["C" + i.ToString()].Value = item.NB_COMPETENCIA; ws.Cells["A" + i.ToString() + ":C" + i.ToString()].Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin, System.Drawing.Color.FromName(item.CL_COLOR)); i++; } ws.Column(1).AutoFit(); ws.Column(2).AutoFit(); ws.Column(3).AutoFit(); //obtenemos todos los empleados var empleados = (from a in lista select new { a.CL_DEPARTAMENTO, a.NB_DEPARTAMENTO, a.CL_EVALUADO, a.NB_EVALUADO }).Distinct(); col = 4; foreach (var item in empleados) { ws.Cells[7, col].Value = item.CL_DEPARTAMENTO; ws.Cells[8, col].Value = item.NB_DEPARTAMENTO; ws.Cells[9, col].Value = item.CL_EVALUADO; ws.Cells[10, col].Value = item.NB_EVALUADO; col++; } col = 4; row = 11; string empleado = ""; while (!FinalListaEmpleados) { var valor = ws.Cells[10, col].Value; if (valor != null) { empleado = valor.ToString(); var listaEmpleado = (from a in lista where a.NB_EVALUADO == empleado select new { a.NB_COMPETENCIA, a.PR_RESULTADO, a.NB_PRIORIDAD }); foreach (var item in listaEmpleado) { while (!CompetenciaEncontrada) { if (ws.Cells[row, 3].Value.ToString() == item.NB_COMPETENCIA) { ws.Cells[row, col].Value = item.PR_RESULTADO; ws.Cells[row, col].Style.Numberformat.Format = "0.00"; ws.Cells[row, col].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; switch (item.NB_PRIORIDAD) { case "Alta": ws.Cells[row, col].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.Red); break; case "Intermedia": ws.Cells[row, col].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.Gold); break; case "No Necesaria": ws.Cells[row, col].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.White); break; default: break; } } else { if (ws.Cells[row, col].Value == null) { ws.Cells[row, col].Value = "N/A"; ws.Cells[row, col].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; ws.Cells[row, col].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.LightGray); } else { if (ws.Cells[row, col].Value.ToString() == "N/A") { ws.Cells[row, col].Value = "N/A"; ws.Cells[row, col].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; ws.Cells[row, col].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.LightGray); } } } if (ws.Cells[row + 1, 3].Value == null) { CompetenciaEncontrada = true; } row++; } row = 11; CompetenciaEncontrada = false; } ws.Column(col).AutoFit(); col++; } else { FinalListaEmpleados = true; } } pck.Save(); newStream = pck.Stream; } excelNecesidadCapacitacion.NB_ARCHIVO = "ReporteDNC.xlsx"; excelNecesidadCapacitacion.FI_ARCHIVO = ((MemoryStream)newStream).ToArray(); return(excelNecesidadCapacitacion); }
//protected void Page_Init(object sender, System.EventArgs e) //{ // if (!Page.IsPostBack) // { // vFgAlta = true; // vFgIntermedia = true; // vFgNonecesaria = false; // } // //else // //{ // // vFgAlta = true; // // vFgIntermedia = false; // // vFgNonecesaria = false; // //} // ////vFgAlta = chkAlta.Checked; // ////vFgIntermedia = chkIntermedia.Checked; // ////vFgNonecesaria = chkNoNecesaria.Checked; // CargarGrid(); //} protected void Page_Load(object sender, EventArgs e) { vClUsuario = ContextoUsuario.oUsuario.CL_USUARIO; vNbPrograma = ContextoUsuario.nbPrograma; vIdRol = ContextoUsuario.oUsuario.oRol.ID_ROL; vListaEmpleadoCompetencia = ""; vFgAlta = chkAlta.Checked; vFgIntermedia = chkIntermedia.Checked; vFgNonecesaria = chkNoNecesaria.Checked; if (!Page.IsPostBack) { vIdPeriodo = 0; vIdPrograma = null; vFgCargarGrid = false; if (Request.Params["PeriodoId"] != null) { vIdPeriodo = int.Parse(Request.Params["PeriodoId"].ToString()); SPE_OBTIENE_FYD_PERIODO_EVALUACION_Result vPeriodo = new SPE_OBTIENE_FYD_PERIODO_EVALUACION_Result(); PeriodoNegocio oPeriodo = new PeriodoNegocio(); vPeriodo = oPeriodo.ObtienePeriodoEvaluacion(vIdPeriodo); if (vPeriodo != null) { vFgCargarGrid = true; string vTiposEvaluacion = ""; //txtPeriodo.InnerText = vPeriodo.CL_PERIODO; //txtNombrePeriodo.InnerText = vPeriodo.DS_PERIODO; txtClPeriodo.InnerText = vPeriodo.NB_PERIODO; txtDsPeriodo.InnerText = vPeriodo.DS_PERIODO; txtEstatus.InnerText = vPeriodo.CL_ESTADO_PERIODO; if (vPeriodo.FG_AUTOEVALUACION) { vTiposEvaluacion = string.IsNullOrEmpty(vTiposEvaluacion) ? "Autoevaluación" : String.Join(", ", vTiposEvaluacion, "Autoevaluacion"); } if (vPeriodo.FG_SUPERVISOR) { vTiposEvaluacion = string.IsNullOrEmpty(vTiposEvaluacion) ? "Superior" : String.Join(", ", vTiposEvaluacion, "Superior"); } if (vPeriodo.FG_SUBORDINADOS) { vTiposEvaluacion = string.IsNullOrEmpty(vTiposEvaluacion) ? "Subordinado" : String.Join(", ", vTiposEvaluacion, "Subordinado"); } if (vPeriodo.FG_INTERRELACIONADOS) { vTiposEvaluacion = string.IsNullOrEmpty(vTiposEvaluacion) ? "Interrelacionado" : String.Join(", ", vTiposEvaluacion, "Interrelacionado"); } if (vPeriodo.FG_OTROS_EVALUADORES) { vTiposEvaluacion = string.IsNullOrEmpty(vTiposEvaluacion) ? "Otros" : String.Join(", ", vTiposEvaluacion, "Otros"); } txtTipoEvaluacion.InnerText = vTiposEvaluacion; if (vPeriodo.DS_NOTAS != null) { if (vPeriodo.DS_NOTAS.Contains("DS_NOTA")) { txtNotas.InnerHtml = Utileria.MostrarNotas(vPeriodo.DS_NOTAS); } else { XElement vNotas = XElement.Parse(vPeriodo.DS_NOTAS); if (vNotas != null) { vNotas.Name = vNbFirstRadEditorTagName; txtNotas.InnerHtml = vNotas.ToString(); } } } vFgAlta = chkAlta.Checked; vFgIntermedia = chkIntermedia.Checked; vFgNonecesaria = chkNoNecesaria.Checked; CargarGrid(); } } } }