--- ANTES/UserControl/DetalleEtapa.ascx.cs +++ DESPUES/UserControl/DetalleEtapa.ascx.cs @@ -328,7 +328,39 @@ return; } - GvTramites.DataSource = consulta.Data; + List tramites = + consulta.Data ?? new List(); + + foreach (TramiteSolicitudModel tramite in tramites) + { + var contexto = AppServices.TramiteSolicitudService + .ObtenerContextoCambioEstatus( + tramite.CveSolicitud, + CurrentUser.CveUsuario, + CurrentUser.NombreDominio); + + if (!contexto.Success || contexto.Data == null) + { + Avisar( + contexto.Success + ? "No fue posible consultar los pendientes del trĂ¡mite." + : contexto.UserMessage); + return; + } + + tramite.DocumentosPendientes = + (contexto.Data.Documentos ?? + new List()) + .Count(documento => + documento.EsRequerido && + (!documento.TieneArchivo || documento.FechaExpirada)); + + tramite.PagosPendientes = + (contexto.Data.Pagos ?? new List()) + .Count(pago => pago.EstaPendiente); + } + + GvTramites.DataSource = tramites; GvTramites.DataBind(); }