public GetCorreosPendientesEnvioResponse GetCorreosPendientesEnvio()
        {
            var response = new GetCorreosPendientesEnvioResponse();

            try
            {
                var correos = _correoRepository.GetByCriteria(x => x.Enviado == false && x.IsActivo == true);

                response.Correos = CorreoMapper.ConvertToCorreoRowViewModel(correos);
                response.IsValid = true;
            }
            catch (Exception ex)
            {
                response.IsValid      = false;
                response.ErrorMessage = ex.Message;
            }

            return(response);
        }
        public GetCorreoByCandidaturaPlantillaResponse GetCorreoByCandidaturaPlantilla(int CandidaturaId, int PlantillaId, int?subEntrevistaId, string tipoAviso)
        {
            var response = new GetCorreoByCandidaturaPlantillaResponse();

            try
            {
                IQueryable <Correo> correos;

                if (subEntrevistaId == null)
                {
                    correos = _correoRepository.GetByCriteria(x => x.CandidaturaId == CandidaturaId && x.PlantillaId == PlantillaId && x.SubEntrevistaId == null);
                }
                else
                {
                    correos = _correoRepository.GetByCriteria(x => x.CandidaturaId == CandidaturaId && x.PlantillaId == PlantillaId && x.SubEntrevistaId == subEntrevistaId);
                }

                if (correos.Any(x => x.TipoAviso == null))
                {
                    response.Correos        = CorreoMapper.ConvertToCorreoRowViewModel(correos);
                    response.TotalElementos = response.Correos.Count();
                    response.IsValid        = true;
                }
                else
                {
                    response.Correos        = CorreoMapper.ConvertToCorreoRowViewModel(correos.Where(x => x.TipoAviso == tipoAviso));
                    response.TotalElementos = response.Correos.Count();
                    response.IsValid        = true;
                }
            }
            catch (Exception ex)
            {
                response.IsValid      = false;
                response.ErrorMessage = ex.Message;
            }

            return(response);
        }
 public CorreoCrudFactory()
 {
     mapper = new CorreoMapper();
     dao    = SqlDao.GetInstance();
 }