Exemplo n.º 1
0
        public Interesados Find(int id)
        {
            Interesados InteresadoBuscado = null;

            try
            {
                using (var db = new escuelapsdelsurContext())
                {
                    InteresadoBuscado = db.Interesados.Find(id);
                    if (InteresadoBuscado != null)
                    {
                        if (InteresadoBuscado.ModalidadId.HasValue)
                        {
                            InteresadoBuscado.Modalidad = db.Modalidades.Find(InteresadoBuscado.ModalidadId);
                        }
                        if (InteresadoBuscado.CarreraId.HasValue)
                        {
                            InteresadoBuscado.Carrera = db.Carreras.Find(InteresadoBuscado.CarreraId);
                        }
                        if (InteresadoBuscado.MedioDeContactoId.HasValue)
                        {
                            InteresadoBuscado.MedioDeContacto = db.MediosDeContacto.Find(InteresadoBuscado.MedioDeContactoId);
                        }
                    }
                    _logger.LogInformation("Buscar InteresadoId: " + id.ToString() + " --> OK");
                }
            }
            catch (System.Exception ex)
            {
                _logger.LogError(ex.Message);
            }
            return(InteresadoBuscado);
        }
Exemplo n.º 2
0
        public void Add(Alumnos item)
        {
            try
            {
                using (var db = new escuelapsdelsurContext())
                {
                    // Alumnos AlumnoNuevo;
                    // AlumnoNuevo = new Alumnos();
                    // AlumnoNuevo.AlumnoId = item.AlumnoId;
                    // AlumnoNuevo.Nombre = item.Nombre;
                    // AlumnoNuevo.Apellido = item.Apellido;
                    // AlumnoNuevo.Mail = item.Mail;
                    // AlumnoNuevo.Mail2 = item.Mail2;
                    // AlumnoNuevo.Telefono = item.Telefono;
                    // AlumnoNuevo.Celular = item.Celular;
                    // AlumnoNuevo.ComoConocio = item.ComoConocio;
                    // AlumnoNuevo.ModalidadId = item.ModalidadId;
                    // AlumnoNuevo.GradoInteres = item.GradoInteres;
                    // AlumnoNuevo.FechaInteresado = item.FechaInteresado;
                    // AlumnoNuevo.Comentario = item.Comentario;
                    // AlumnoNuevo.Provincia = item.Provincia;
                    // AlumnoNuevo.SituacionInscripcion = item.SituacionInscripcion;
                    // AlumnoNuevo.SituacionEspecial = item.SituacionEspecial;
                    // AlumnoNuevo.Dni = item.Dni;
                    // AlumnoNuevo.Domicilio = item.Domicilio;
                    // AlumnoNuevo.FechaInteresadoOriginal = item.FechaInteresadoOriginal;
                    // AlumnoNuevo.AnioAcursar = item.AnioAcursar;
                    // AlumnoNuevo.NmestreAcursar = item.NmestreAcursar;
                    // AlumnoNuevo.DocTitulo = item.DocTitulo;
                    // AlumnoNuevo.DocDni = item.DocDni;
                    // AlumnoNuevo.DocAptoFisico = item.DocAptoFisico;
                    // AlumnoNuevo.DocFoto = item.DocFoto;
                    // AlumnoNuevo.DocCompromiso = item.DocCompromiso;
                    int idInteresado = item.AlumnoId;
                    item.AlumnoId += 50000;    //Número mágico para que no colisione con sistema anterior.
                    item.Mail2     = "Enviar"; //Marca el envio de E-mail de bienvenida y completado de cuestionario.
                    db.Alumnos.Add(item);
                    //Borrar Interesados
                    Interesados interesadoABorrar = db.Interesados.Find(idInteresado);
                    if (interesadoABorrar != null)
                    {
                        db.Interesados.Remove(interesadoABorrar);
                    }
                    db.SaveChanges();

                    _logger.LogInformation("Crear Alumno (" + item.AlumnoId.ToString() + "), DNI:" + item.Dni.ToString() + "--> Ok");
                }
            }
            catch (System.Exception ex)
            {
                _logger.LogError(ex.Message);
                throw ex;
            }
        }
Exemplo n.º 3
0
 public void Remove(Alumnos item)
 {
     try
     {
         using (var db = new escuelapsdelsurContext())
         {
             int legajo = db.Legajos.Count(n => n.AlumnoId == item.AlumnoId);
             if (legajo == 0)
             {
                 Interesados interesado = new Interesados();
                 //interesado.InteresadoId = item.AlumnoId-50000;
                 interesado.Nombre               = item.Nombre;
                 interesado.Apellido             = item.Apellido;
                 interesado.Mail                 = item.Mail;
                 interesado.Mail2                = item.Mail2;
                 interesado.Telefono             = item.Telefono;
                 interesado.Celular              = item.Celular;
                 interesado.ComoConocio          = item.ComoConocio;
                 interesado.ModalidadId          = item.Modalidad.Id;
                 interesado.GradoInteres         = item.GradoInteres;
                 interesado.FechaInteresado      = item.FechaInteresadoOriginal;
                 interesado.Comentario           = item.Comentario;
                 interesado.Provincia            = item.Provincia;
                 interesado.SituacionInscripcion = item.SituacionInscripcion;
                 interesado.SituacionEspecial    = item.SituacionEspecial;
                 interesado.CarreraId            = item.CarreraId;
                 interesado.AnioAcursar          = item.AnioAcursar;
                 interesado.NmestreAcursar       = item.NmestreAcursar;
                 interesado.Turno                = item.Turno;
                 interesado.Seguimiento          = false;
                 interesado.MedioDeContactoId    = 12; //TODO: Este dato se pierde ¿?
                 interesado.FechaActualizacion   = DateTimeOffset.Now;
                 db.Remove(item);
                 db.Interesados.Add(interesado);
                 db.SaveChanges();
                 _logger.LogInformation("Eliminado Inscripto ID: " + item.AlumnoId.ToString() + " --> OK");
                 _logger.LogInformation("Re-Creando Interesado ID: " + interesado.InteresadoId.ToString() + " --> OK");
             }
             else
             {
                 throw new InscriptoInexistenteException("El Inscripto ID: " + item.AlumnoId.ToString() + " tiene legajo asignado.");
             }
         }
     }
     catch (System.Exception ex)
     {
         _logger.LogError(ex.Message);
         throw ex;
     }
 }
Exemplo n.º 4
0
 public void Remove(Interesados item)
 {
     try
     {
         using (var db = new escuelapsdelsurContext())
         {
             db.Remove(item);
             db.SaveChanges();
             _logger.LogInformation("Eliminado Interesado ID: " + item.InteresadoId.ToString() + " --> OK");
         }
     }
     catch (System.Exception ex)
     {
         _logger.LogError(ex.Message);
         throw ex;
     }
 }
Exemplo n.º 5
0
 public void Update(Interesados item)
 {
     try
     {
         using (var db = new escuelapsdelsurContext())
         {
             db.Update(item);
             db.SaveChanges();
             _logger.LogInformation("Actualizar Interesado ID: " + item.InteresadoId.ToString() + "/ Mail: " + item.Mail + " --> OK");
         }
     }
     catch (System.Exception ex)
     {
         _logger.LogError(ex.Message);
         throw ex;
     }
 }
Exemplo n.º 6
0
 public IActionResult Create([FromBody] Interesados item)
 {
     if (item == null)
     {
         return(BadRequest());
     }
     try
     {
         item.FechaActualizacion = DateTimeOffset.Now;
         _repo.Add(item);
         return(CreatedAtRoute("GetInteresados", new { controller = "Interesados", Id = item.InteresadoId }, item));
     }
     catch (System.Exception ex)
     {
         return(Utils.ResponseInternalError(ex));
     }
 }
Exemplo n.º 7
0
        public void Add(Interesados item)
        {
            try
            {
                using (var db = new escuelapsdelsurContext())
                {
                    db.Interesados.Add(item);
                    db.SaveChanges();

                    _logger.LogInformation("Crear Alumno (" + item.InteresadoId.ToString() + "), E-Mail:" + item.Mail + " --> Ok");
                }
            }
            catch (System.Exception ex)
            {
                _logger.LogError(ex.Message);
                throw ex;
            }
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Evento = await _context.Evento
                     .Include(e => e.Categoria).FirstOrDefaultAsync(m => m.Id == id);

            Interesados = _context.ListaInteresado.Include(t => t.Evento).Include(T => T.Usuario)
                          .Where(x => x.EventoId == id).OrderBy(t => t.Usuario.Matricula)

                          .ToList();
            NumInteresados = Interesados.Count();
            if (Evento == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemplo n.º 9
0
        public IActionResult Put([FromBody] Interesados item)
        {
            if (item == null)
            {
                return(BadRequest());
            }

            var Modo = _repo.Find(item.InteresadoId);

            if (Modo == null)
            {
                return(NotFound());
            }
            try
            {
                item.FechaActualizacion = DateTimeOffset.Now;
                _repo.Update(item);
                return(NoContent());
            }
            catch (System.Exception ex)
            {
                return(Utils.ResponseInternalError(ex));
            }
        }