public ActionResult ListarPlantillaDetalleAntes(Parametro parametro) { string tipoDevol = null; object DataDevol = null; object jsonResponse; try { objPlantillaLogic = new PlantillaLogic(); var lista = objPlantillaLogic.ListarPlantillaDetallePaginado(new Parametro { p_NumPagina = parametro.p_NumPagina, p_TamPagina = parametro.p_TamPagina, p_OrdenPor = parametro.p_OrdenPor, p_OrdenTipo = parametro.p_OrdenTipo, numAnio = parametro.numAnio, codArea = parametro.codArea, }); long totalRecords = lista.Select(x => x.TOTALROWS).FirstOrDefault(); int totalPages = (int)Math.Ceiling((float)totalRecords / (float)parametro.p_TamPagina); var jsonGrid = new { PageCount = totalPages, CurrentPage = parametro.p_NumPagina, RecordCount = totalRecords, Items = ( from item in lista select new { ID = item.Codigo, Row = new string[] {"","","" , item.objPlantilla.objArea.desNombre , item.objPartida.desNombre , item.gloDescripcion , item.cntCantidad.ToString("N2") , item.monEstimado.ToString("N2") , item.fecEjecucion.HasValue ? item.fecEjecucion.Value.ToShortDateString() : string.Empty , item.codRegEstadoNombre , item.indPlantilla , item.segFechaEdita.HasValue ? item.segFechaEdita.Value.ToString() : item.segFechaCrea.ToString() , string.IsNullOrEmpty(item.segUsuarioEdita) ? item.segUsuarioCrea : item.segUsuarioEdita } }).ToArray() }; tipoDevol = "C"; DataDevol = jsonGrid; } catch (Exception ex) { tipoDevol = "E"; log.Error(String.Concat("ListarPlantillaDetalleAntes", " | ", ex.Message)); DataDevol = ex.Message; } finally { jsonResponse = new { Type = tipoDevol, Data = DataDevol, }; } return Json(jsonResponse); }