public void DateTimeHelper_ConvertDateTimeFromAnotherTimeZone_ShouldConvert_NegativePositive() { DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); DateTime dateSource = new DateTime(2017, 9, 5, 16, 12, 0); DateTime newDate = helper.ConvertDateTimeFromAnotherTimeZone(-5, 2, dateSource); Assert.AreEqual(newDate, dateSource.AddHours(-7)); //int numeroAnunciosPosibles = 3; //Random random = new Random(); //int skipIndexRandom = random.Next(0, numeroAnunciosPosibles); //int diferenciaSkipConTotal = numeroAnunciosPosibles - skipIndexRandom; //if (diferenciaSkipConTotal < 4) //{ // skipIndexRandom -= 0 - diferenciaSkipConTotal; // if (skipIndexRandom < 0) // { // skipIndexRandom = 0; // } //} }
public async Task <List <AnunciosDTO> > ListarAnuncios(BuscadorDTO buscador) { using (SportsGoEntities context = new SportsGoEntities(false)) { AnunciantesRepository anuncianteRepo = new AnunciantesRepository(context); DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); if (buscador.FechaInicio != DateTime.MinValue) { buscador.FechaInicio = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, buscador.FechaInicio); } List <AnunciosDTO> listarInformacionAnuncios = await anuncianteRepo.ListarAnuncios(buscador); if (listarInformacionAnuncios != null && listarInformacionAnuncios.Count > 0) { foreach (var anuncios in listarInformacionAnuncios) { anuncios.Creacion = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, anuncios.Creacion); anuncios.FechaInicio = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, anuncios.FechaInicio); if (anuncios.Vencimiento.HasValue) { anuncios.Vencimiento = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, anuncios.Vencimiento.Value); } } } return(listarInformacionAnuncios); } }
public async Task <List <CandidatosVideosDTO> > ListarCandidatosVideosDeUnCandidato(CandidatosVideos candidatoVideoParaListar) { using (SportsGoEntities context = new SportsGoEntities(false)) { CandidatosRepository candidatosRepo = new CandidatosRepository(context); DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); if (candidatoVideoParaListar.FechaFiltroBase != DateTime.MinValue) { candidatoVideoParaListar.FechaFiltroBase = helper.ConvertDateTimeFromAnotherTimeZone(candidatoVideoParaListar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, candidatoVideoParaListar.FechaFiltroBase); } List <CandidatosVideosDTO> listaVideosCandidato = await candidatosRepo.ListarCandidatosVideosDeUnCandidato(candidatoVideoParaListar); if (listaVideosCandidato != null && listaVideosCandidato.Count > 0) { foreach (var videoCandidato in listaVideosCandidato) { videoCandidato.Creacion = helper.ConvertDateTimeFromAnotherTimeZone(candidatoVideoParaListar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, videoCandidato.Creacion); } } return(listaVideosCandidato); } }
public async Task <List <ChatsMensajes> > ListarChatsMensajes(ChatsMensajes chatMensajeParaListar) { using (SportsGoEntities context = new SportsGoEntities(false)) { DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); ChatsRepository chatsRepo = new ChatsRepository(context); if (chatMensajeParaListar.FechaFiltroBase != DateTime.MinValue) { chatMensajeParaListar.FechaFiltroBase = helper.ConvertDateTimeFromAnotherTimeZone(chatMensajeParaListar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, chatMensajeParaListar.FechaFiltroBase); } List <ChatsMensajes> listaMensajes = await chatsRepo.ListarChatsMensajes(chatMensajeParaListar); if (listaMensajes != null && listaMensajes.Count > 0) { foreach (var mensaje in listaMensajes) { mensaje.FechaMensaje = helper.ConvertDateTimeFromAnotherTimeZone(chatMensajeParaListar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, mensaje.FechaMensaje); } } return(listaMensajes); } }
public async Task <TimeLineNotificaciones> VerificarSiPagoEstaAprobadoYTraerNotificacion(HistorialPagosPersonas pagoParaVerificar) { using (SportsGoEntities context = new SportsGoEntities(false)) { PagosRepository pagosRepo = new PagosRepository(context); int?codigoEstado = await pagosRepo.BuscarEstadoDeUnPago(pagoParaVerificar); if (!codigoEstado.HasValue) { throw new InvalidOperationException("No se pudo encontrar el estado del pago"); } TimeLineNotificaciones timeLineNotificacion = null; if (codigoEstado.Value == (int)EstadoDeLosPagos.Aprobado) { Notificaciones notificacionDelPago = await pagosRepo.BuscarNotificacionDeUnPago(pagoParaVerificar); PersonasRepository personaRepo = new PersonasRepository(context); int codigoIdioma = await personaRepo.BuscarCodigoIdiomaDeLaPersona(notificacionDelPago.CodigoPersonaDestinoAccion.Value); notificacionDelPago.CodigoIdiomaUsuarioBase = codigoIdioma; NoticiasRepository noticiasRepo = new NoticiasRepository(context); timeLineNotificacion = new TimeLineNotificaciones(await noticiasRepo.BuscarNotificacion(notificacionDelPago)); DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); timeLineNotificacion.CreacionNotificacion = helper.ConvertDateTimeFromAnotherTimeZone(pagoParaVerificar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, timeLineNotificacion.CreacionNotificacion); } return(timeLineNotificacion); } }
public async Task <List <NoticiasDTO> > ListarNoticias(BuscadorDTO buscador) { using (SportsGoEntities context = new SportsGoEntities(false)) { NoticiasRepository noticiaRepo = new NoticiasRepository(context); DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); if (buscador.FechaInicio != DateTime.MinValue) { buscador.FechaInicio = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, buscador.FechaInicio); } List <NoticiasDTO> listaNoticias = await noticiaRepo.ListarNoticiasNoNotificaciones(buscador); if (listaNoticias != null && listaNoticias.Count > 0) { foreach (var noticia in listaNoticias) { noticia.Creacion = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, noticia.Creacion); } } return(listaNoticias); } }
public async Task <List <HistorialPagosPersonasDTO> > ListarHistorialPagosDeUnaPersona(BuscadorDTO buscador) { using (SportsGoEntities context = new SportsGoEntities(false)) { PagosRepository pagosRepo = new PagosRepository(context); List <HistorialPagosPersonasDTO> listaHistorialPagos = await pagosRepo.ListarHistorialPagosDeUnaPersona(buscador); if (listaHistorialPagos != null && listaHistorialPagos.Count > 0) { Monedas monedaColombiana = await pagosRepo.BuscarMonedaColombiana(); Dictionary <MonedasEnum, string> diccionarioAbreviaturas = listaHistorialPagos.Where(x => x.Monedas.MonedaEnum != MonedasEnum.PesosColombianos).Select(x => x.Monedas).DistinctBy(x => x.MonedaEnum).ToDictionary(x => x.MonedaEnum, x => x.AbreviaturaMoneda); Dictionary <MonedasEnum, decimal> diccionarioCambios = new Dictionary <MonedasEnum, decimal>(); QueryMoneyExchanger queryExchanger = new QueryMoneyExchanger(); foreach (MonedasEnum monedaParaConsultar in diccionarioAbreviaturas.Keys) { if (monedaParaConsultar != MonedasEnum.PesosColombianos) { YahooExchangeEntity exchangeEntity = await queryExchanger.QueryMoneyExchange(monedaColombiana.AbreviaturaMoneda, diccionarioAbreviaturas[monedaParaConsultar]); Monedas monedaBuscada = await pagosRepo.BuscarMoneda(monedaParaConsultar); if (exchangeEntity != null) { monedaBuscada.CambioMoneda = exchangeEntity.Query.Results.Rate.Rate; } diccionarioCambios.Add(monedaParaConsultar, monedaBuscada.CambioMoneda); } else { diccionarioCambios.Add(monedaParaConsultar, monedaColombiana.CambioMoneda); } } DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); foreach (HistorialPagosPersonasDTO historial in listaHistorialPagos) { if (historial.Monedas.MonedaEnum != MonedasEnum.PesosColombianos) { historial.Precio *= diccionarioCambios[historial.Monedas.MonedaEnum]; } historial.FechaPago = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, historial.FechaPago); } } try { // No es obligatorio para el paso que actualize el cambio de moneda await context.SaveChangesAsync(); } catch (Exception) { } return(listaHistorialPagos); } }
public async Task <List <GruposEventosAsistentesDTO> > ListarEventosAsistentesDeUnaPersona(BuscadorDTO buscador) { using (SportsGoEntities context = new SportsGoEntities(false)) { GruposRepository grupoRepository = new GruposRepository(context); DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); if (buscador.FechaFiltroBase != DateTime.MinValue) { buscador.FechaFiltroBase = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, buscador.FechaFiltroBase); } List <GruposEventosAsistentesDTO> listaEventosAsistentesDeUnaPersona = await grupoRepository.ListarEventosAsistentesDeUnaPersona(buscador); if (listaEventosAsistentesDeUnaPersona != null && listaEventosAsistentesDeUnaPersona.Count > 0) { foreach (var eventoAsistente in listaEventosAsistentesDeUnaPersona) { eventoAsistente.GruposEventos.Creacion = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, eventoAsistente.GruposEventos.Creacion); eventoAsistente.GruposEventos.FechaInicio = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, eventoAsistente.GruposEventos.FechaInicio); eventoAsistente.GruposEventos.FechaTerminacion = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, eventoAsistente.GruposEventos.FechaTerminacion); } } return(listaEventosAsistentesDeUnaPersona); } }
public void DateTimeHelper_ConvertDateTimeFromAnotherTimeZone_ShouldConvert_NegativeNegative() { DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); DateTime dateSource = new DateTime(2017, 9, 5, 16, 12, 0); // Hora españa DateTime newDate = helper.ConvertDateTimeFromAnotherTimeZone(-4, -5, dateSource); Assert.AreEqual(newDate, dateSource.AddHours(1)); }
public async Task <List <TimeLineNoticias> > ListarTimeLine(BuscadorDTO buscador) { using (SportsGoEntities context = new SportsGoEntities(false)) { NoticiasRepository noticiaRepo = new NoticiasRepository(context); GruposRepository grupoRepo = new GruposRepository(context); AnunciantesRepository anuncianteRepo = new AnunciantesRepository(context); DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); if (buscador.FechaInicio != DateTime.MinValue) { buscador.FechaInicio = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, buscador.FechaInicio); } List <GruposEventosDTO> listaEventos = await grupoRepo.ListarEventos(buscador, true); List <AnunciosDTO> listaAnuncios = await anuncianteRepo.ListarAnuncios(buscador, true); List <NoticiasDTO> listaNoticias = await noticiaRepo.ListarNoticiasNoNotificaciones(buscador, true); List <TimeLineNoticias> listaTimeLine = TimeLineNoticias.CrearListaTimeLine(listaEventos, listaAnuncios, listaNoticias); List <int> listaCodigoAnunciosConsultados = listaAnuncios.Select(x => x.Consecutivo).ToList(); if (!buscador.EsConsultaEnLaApp && buscador.SkipIndexBase == 0) { List <AnunciosDTO> listaAnunciosLaterales = await anuncianteRepo.ListarAnunciosLaterales(buscador); List <TimeLineNoticias> listaAnunciosLateralesParaAdicionar = TimeLineNoticias.CrearListaTimeLine(null, listaAnunciosLaterales, null); listaCodigoAnunciosConsultados.AddRange(listaAnunciosLaterales.Select(x => x.Consecutivo)); if (listaAnunciosLateralesParaAdicionar != null && listaAnunciosLateralesParaAdicionar.Count > 0) { listaTimeLine.AddRange(listaAnunciosLateralesParaAdicionar); } } if (listaCodigoAnunciosConsultados.Count > 0) { await anuncianteRepo.ModificarControlAnuncio(listaCodigoAnunciosConsultados); } if (listaTimeLine != null && listaTimeLine.Count > 0) { foreach (var timeLine in listaTimeLine) { timeLine.FechaPublicacion = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, timeLine.FechaPublicacion); } } return(listaTimeLine); } }
public async Task <HistorialPagosPersonasDTO> BuscarPagoEnTramiteDeUnaPersona(HistorialPagosPersonas historialPagoParaVerificar) { using (SportsGoEntities context = new SportsGoEntities(false)) { PagosRepository pagosRepo = new PagosRepository(context); HistorialPagosPersonasDTO pagoEnTramite = await pagosRepo.BuscarPagoEnTramiteDeUnaPersona(historialPagoParaVerificar); if (pagoEnTramite != null) { DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); pagoEnTramite.FechaPago = helper.ConvertDateTimeFromAnotherTimeZone(historialPagoParaVerificar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, pagoEnTramite.FechaPago); } return(pagoEnTramite); } }
public async Task <Noticias> BuscarNoticia(Noticias noticiaParaBuscar) { using (SportsGoEntities context = new SportsGoEntities(false)) { NoticiasRepository noticiaRepo = new NoticiasRepository(context); Noticias noticiaBuscada = await noticiaRepo.BuscarNoticia(noticiaParaBuscar); if (noticiaBuscada != null) { DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); noticiaBuscada.Creacion = helper.ConvertDateTimeFromAnotherTimeZone(noticiaParaBuscar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, noticiaBuscada.Creacion); } return(noticiaBuscada); } }
public async Task <CandidatosVideos> BuscarCandidatoVideo(CandidatosVideos candidatoVideoParaBuscar) { using (SportsGoEntities context = new SportsGoEntities(false)) { CandidatosRepository candidatosRepo = new CandidatosRepository(context); CandidatosVideos candidatoVideoBuscado = await candidatosRepo.BuscarCandidatoVideo(candidatoVideoParaBuscar); if (candidatoVideoBuscado != null) { DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); candidatoVideoBuscado.Creacion = helper.ConvertDateTimeFromAnotherTimeZone(candidatoVideoParaBuscar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, candidatoVideoBuscado.Creacion); } return(candidatoVideoBuscado); } }
public async Task <ChatsMensajes> BuscarChatMensaje(ChatsMensajes chatMensajeParaBuscar) { using (SportsGoEntities context = new SportsGoEntities(false)) { ChatsRepository chatsRepo = new ChatsRepository(context); ChatsMensajes chatMensajeBuscado = await chatsRepo.BuscarChatMensaje(chatMensajeParaBuscar); if (chatMensajeBuscado != null) { DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); chatMensajeBuscado.FechaMensaje = helper.ConvertDateTimeFromAnotherTimeZone(chatMensajeParaBuscar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, chatMensajeBuscado.FechaMensaje); } return(chatMensajeBuscado); } }
public async Task <List <PersonasDTO> > ListarUsuariosMetricas(MetricasDTO metricasParaBuscar) { using (SportsGoEntities context = new SportsGoEntities(false)) { MetricasRepository metricasRepo = new MetricasRepository(context); List <PersonasDTO> listaUsuarioMetricas = await metricasRepo.ListarUsuariosMetricas(metricasParaBuscar); if (listaUsuarioMetricas != null && listaUsuarioMetricas.Count > 0) { DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); foreach (var persona in listaUsuarioMetricas) { persona.Usuarios.Creacion = helper.ConvertDateTimeFromAnotherTimeZone(metricasParaBuscar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, persona.Usuarios.Creacion); } } return(listaUsuarioMetricas); } }
public async Task <GruposEventosDTO> BuscarGrupoEventoPorConsecutivo(GruposEventos grupoEventoParaBuscar) { using (SportsGoEntities context = new SportsGoEntities(false)) { GruposRepository grupoRepository = new GruposRepository(context); GruposEventosDTO grupoEventoBuscado = await grupoRepository.BuscarGrupoEventoPorConsecutivo(grupoEventoParaBuscar); if (grupoEventoBuscado != null) { DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); grupoEventoBuscado.Creacion = helper.ConvertDateTimeFromAnotherTimeZone(grupoEventoParaBuscar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, grupoEventoBuscado.Creacion); grupoEventoBuscado.FechaInicio = helper.ConvertDateTimeFromAnotherTimeZone(grupoEventoParaBuscar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, grupoEventoBuscado.FechaInicio); grupoEventoBuscado.FechaTerminacion = helper.ConvertDateTimeFromAnotherTimeZone(grupoEventoParaBuscar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, grupoEventoBuscado.FechaTerminacion); } return(grupoEventoBuscado); } }
public async Task <List <HistorialPagosPersonasDTO> > ListarHistorialPagosPersonas(BuscadorDTO buscador) { using (SportsGoEntities context = new SportsGoEntities(false)) { PagosRepository pagosRepo = new PagosRepository(context); List <HistorialPagosPersonasDTO> listaHistorialPagos = await pagosRepo.ListarHistorialPagosPersonas(buscador); if (listaHistorialPagos != null && listaHistorialPagos.Count > 0) { DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); foreach (HistorialPagosPersonasDTO historial in listaHistorialPagos) { historial.FechaPago = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, historial.FechaPago); } } return(listaHistorialPagos); } }
public async Task <Anuncios> BuscarAnuncioPorConsecutivo(Anuncios anuncioParaBuscar) { using (SportsGoEntities context = new SportsGoEntities(false)) { AnunciantesRepository anuncianteRepo = new AnunciantesRepository(context); Anuncios anuncioBuscado = await anuncianteRepo.BuscarAnuncioPorConsecutivo(anuncioParaBuscar); if (anuncioBuscado != null) { DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); anuncioBuscado.Creacion = helper.ConvertDateTimeFromAnotherTimeZone(anuncioParaBuscar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, anuncioBuscado.Creacion); anuncioBuscado.FechaInicio = helper.ConvertDateTimeFromAnotherTimeZone(anuncioParaBuscar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, anuncioBuscado.FechaInicio); if (anuncioBuscado.Vencimiento.HasValue) { anuncioBuscado.Vencimiento = helper.ConvertDateTimeFromAnotherTimeZone(anuncioParaBuscar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, anuncioBuscado.Vencimiento.Value); } } return(anuncioBuscado); } }
public async Task <List <TimeLineNotificaciones> > ListaTimeLineNotificaciones(BuscadorDTO buscador) { using (SportsGoEntities context = new SportsGoEntities(false)) { NoticiasRepository noticiaRepo = new NoticiasRepository(context); DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable(); if (buscador.FechaFiltroBase != DateTime.MinValue) { buscador.FechaFiltroBase = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, buscador.FechaFiltroBase); } List <NoticiasDTO> listaNoticias = await noticiaRepo.ListarNoticiasNotificaciones(buscador); List <NotificacionesDTO> listarNotificaciones = await noticiaRepo.ListarNotificaciones(buscador); List <TimeLineNotificaciones> listaTimeLineNotificacion = TimeLineNotificaciones.CrearListaTimeLineNotificaciones(listaNoticias, listarNotificaciones); // Si no es minValue significa que estoy refrescando y no busco feed if (buscador.FechaFiltroBase == DateTime.MinValue) { RssFeeds rssBuscado = await noticiaRepo.BuscarRssFeedPorCodigoIdioma(buscador.CodigoIdiomaUsuarioBase); if (rssBuscado != null && !string.IsNullOrWhiteSpace(rssBuscado.UrlFeed)) { FeedReader reader = new FeedReader(); IEnumerable <FeedItem> items = reader.RetrieveFeed(rssBuscado.UrlFeed); if (items != null && items.Count() > 0) { IEnumerable <FeedItem> itemsFiltrados = items.Skip(buscador.SkipIndexBase).Take(buscador.TakeIndexBase); if (itemsFiltrados != null && itemsFiltrados.Count() > 0) { foreach (FeedItem item in itemsFiltrados) { string url = item.Uri != null ? item.Uri.AbsoluteUri : string.Empty; TimeLineNotificaciones timeLineRss = new TimeLineNotificaciones(item.Title, item.Summary, url, string.Empty, TipoNotificacionEnum.RssFeed); listaTimeLineNotificacion.Insert(0, timeLineRss); } } } } } // Cuando Skip este en 0 significa que es la primera consulta, asi no repito su cosa de validar el plan // si "FechaFiltroBase" tiene un valor significa que es pull to refresh y no debo agregar las validaciones del plan if (buscador.SkipIndexBase == 0 && buscador.FechaFiltroBase == DateTime.MinValue) { PlanesRepository planRepo = new PlanesRepository(context); AdministracionRepository adminRepo = new AdministracionRepository(context); PlanesUsuarios planUsuario = new PlanesUsuarios { Consecutivo = buscador.CodigoPlanUsuario, IdiomaBase = buscador.IdiomaBase }; PlanesUsuariosDTO planDelUsuarioValidado = await planRepo.BuscarPlanUsuario(planUsuario); ImagenesPerfilAdministradores imagenperfil = await adminRepo.BuscarPrimeraImagenPerfilAdministrador(); long mesesFaltantesParaQueSeVenza = DateTimeHelper.DiferenciaEntreDosFechas(planDelUsuarioValidado.Vencimiento, DateTime.Now); if (mesesFaltantesParaQueSeVenza == 1 && planDelUsuarioValidado.Planes.PlanDefault != 1) { TimeLineNotificaciones timeLineCasiVence = new TimeLineNotificaciones { CodigoArchivo = imagenperfil.CodigoArchivo, UrlArchivo = imagenperfil.UrlImagenPerfil, DescripcionPlan = planDelUsuarioValidado.Planes.DescripcionIdiomaBuscado, FechaVencimientoPlan = planDelUsuarioValidado.Vencimiento, TipoDeLaNotificacion = TipoNotificacionEnum.EstaPorVencersePlan, CreacionNotificacion = DateTime.Now }; listaTimeLineNotificacion.Insert(0, timeLineCasiVence); } else if (mesesFaltantesParaQueSeVenza < 0 && planDelUsuarioValidado.Planes.PlanDefault != 1) { TimeLineNotificaciones timeLineVencio = new TimeLineNotificaciones { CodigoArchivo = imagenperfil.CodigoArchivo, UrlArchivo = imagenperfil.UrlImagenPerfil, DescripcionPlan = planDelUsuarioValidado.Planes.DescripcionIdiomaBuscado, FechaVencimientoPlan = planDelUsuarioValidado.Vencimiento, TipoDeLaNotificacion = TipoNotificacionEnum.SeVencioPlan, CreacionNotificacion = DateTime.Now }; listaTimeLineNotificacion.Insert(0, timeLineVencio); } } if (listaTimeLineNotificacion != null && listaTimeLineNotificacion.Count > 0) { foreach (var notificacion in listaTimeLineNotificacion) { notificacion.CreacionNotificacion = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, notificacion.CreacionNotificacion); notificacion.FechaInicioEvento = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, notificacion.FechaInicioEvento); notificacion.FechaTerminacionEvento = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, notificacion.FechaTerminacionEvento); notificacion.FechaVencimientoPlan = helper.ConvertDateTimeFromAnotherTimeZone(buscador.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, notificacion.FechaVencimientoPlan); } } return(listaTimeLineNotificacion); } }