示例#1
0
        public Response ModPaciente([FromBody] PacienteViewModel model)
        {
            Response oR = new Response();

            try
            {
                Models.Paciente oPaciente = db.Paciente.Find(model.Id);

                oPaciente.Nombre = model.Nombre;
                oPaciente.NumeroDeSeguroSocial = model.NumeroDeSeguroSocial;
                oPaciente.CodigoPostal         = model.CodigoPostal;
                oPaciente.Telefono             = model.Telefono;
                oPaciente.CedulaDoctor         = model.CedulaDoctor;

                db.Entry(oPaciente).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                db.SaveChanges();

                oR.Succes = 1;
            }
            catch (Exception ex)
            {
                oR.Succes  = 0;
                oR.Message = ex.Message;
            }
            return(oR);
        }
示例#2
0
        public ActionResult EditarPaciente(Models.Paciente collection)
        {
            Models.Data.PacienteData pd = new Models.Data.PacienteData();
            pd.EditarPaciente(collection);

            return(RedirectToAction(nameof(EditarPaciente)));
        }
示例#3
0
        public Response AddPaciente([FromBody] PacienteViewModel model)
        {
            Response oR = new Response();

            try
            {
                Models.Paciente oPaciente = new Models.Paciente
                {
                    Nombre = model.Nombre,
                    NumeroDeSeguroSocial = model.NumeroDeSeguroSocial,
                    CodigoPostal         = model.CodigoPostal,
                    Telefono             = model.Telefono,
                    CedulaDoctor         = model.CedulaDoctor
                };
                db.Paciente.Add(oPaciente);
                db.SaveChanges();

                oR.Succes = 1;
            }
            catch (Exception ex) {
                oR.Succes  = 0;
                oR.Message = ex.Message;
            }
            return(oR);
        }
        public async Task <IActionResult> PutPaciente(string id, Models.Paciente paciente)
        {
            if (id != paciente.PacIdentificacion)
            {
                return(BadRequest());
            }

            _context.Entry(paciente).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PacienteExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#5
0
        public ActionResult CadastrarPaciente(Models.Paciente collection)
        {
            Models.Data.PacienteData pacienteData = new Models.Data.PacienteData();
            pacienteData.CadastrarPaciente(collection);

            return(RedirectToAction(nameof(ListaPaciente)));
        }
示例#6
0
        public Response DelPaciente(int Id)
        {
            Response oR = new Response();

            try
            {
                Models.Paciente oPaciente = db.Paciente.Find(Id);
                db.Remove(oPaciente);
                db.SaveChanges();
                oR.Succes = 1;
            }
            catch (Exception ex)
            {
                oR.Succes  = 0;
                oR.Message = ex.Message;
            }
            return(oR);
        }
示例#7
0
 public Models.Paciente Store(PacienteVM model)
 {
     var paciente = new Models.Paciente() {
         PrimerNombre = model.PrimerNombre,
         SegundoNombre = model.SegundoNombre,
         PrimerApellido = model.PrimerApellido,
         SegundoApellido = model.SegundoApellido,
         Direccion = model.Direccion,
         Telefono = model.Telefono,
         CodigoPaciente = "",
         FechaNacimiento = model.FechaNacimiento,
         Ocupacion = model.Ocupacion,
         TipoSangreId = model.TipoSangreId,
         SexoId = model.SexoId,
     };
     DB.Paciente.Add(paciente);
     DB.SaveChanges();
     return paciente;
 }
        public async Task <ActionResult <Models.Paciente> > PostPaciente(Models.Paciente paciente)
        {
            _context.Paciente.Add(paciente);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (PacienteExists(paciente.PacIdentificacion))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetPaciente", new { id = paciente.PacIdentificacion }, paciente));
        }
 public ActionResult Edit(int id, IFormCollection collection)
 {
     try
     {
         var newPaciente = new Models.Paciente
         {
             dpi             = Convert.ToInt32(collection["dpi"]),
             nombre          = collection["nombre"],
             apellido        = collection["apellido"],
             departamento    = Convert.ToInt32(collection["departamento"]),
             municipio       = Convert.ToInt32(collection["municipio"]),
             edad            = Convert.ToInt32(collection["edad"]),
             grupo_prioridad = Convert.ToInt32(collection["grupo_prioridad"]),
             vacunado        = Convert.ToBoolean(collection["vacunado"])
         };
         Singleton.Instance.PacienteList.Add(newPaciente);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
示例#10
0
 public void Create(Models.Paciente ent)
 {
     _pacienteRepository.Create(ent);
 }
 public ActionResult Create(IFormCollection collection)
 {
     try
     {
         var newPaciente = new Models.Paciente
         {
             dpi             = Convert.ToInt32(collection["dpi"]),
             nombre          = collection["nombre"],
             apellido        = collection["apellido"],
             departamento    = Convert.ToInt32(collection["departamento"]),
             municipio       = Convert.ToInt32(collection["municipio"]),
             edad            = Convert.ToInt32(collection["edad"]),
             grupo_prioridad = Convert.ToInt32(collection["grupo_prioridad"]),
         };
         Singleton.Instance.PacienteList.Add(newPaciente);
         if (newPaciente.grupo_prioridad == -1)
         {
             newPaciente.grupo_prioridad = Defprioridad(newPaciente.edad);
         }
         newPaciente.prioString = asignarPrio(newPaciente.grupo_prioridad);
         Municipios_Departamentos piv = new Municipios_Departamentos();
         string municipioP            = piv.DevolverMunicipio(newPaciente.municipio);
         string departamentoP         = piv.DevolverDepartamento(newPaciente.departamento);
         newPaciente.municipioString    = municipioP;
         newPaciente.departamentoString = departamentoP;
         // se instancia un objeto centro de vacunación y se instancia objeto paciente para los procesos del centro de vacunacion
         CentroVacunacion newCentro     = new CentroVacunacion();
         Paciente         nuevoPaciente = new Paciente(newPaciente.nombre, newPaciente.apellido, newPaciente.dpi, newPaciente.departamento, newPaciente.municipio, newPaciente.edad, newPaciente.grupo_prioridad, municipioP, departamentoP, newPaciente.prioString);
         //se igualaran variables para poder procesos próximos
         int                    prioridad             = newPaciente.grupo_prioridad;
         int                    municipioPivot        = newPaciente.municipio;
         PacienteIndice         nuevoPacienteIndice   = new PacienteIndice(Convert.ToString(nuevoPaciente.dpi));
         PacienteIndiceApellido nuevoPacienteApellido = new PacienteIndiceApellido(nuevoPaciente.apellido);
         PacienteIndiceNombre   nuevoPacienteNombre   = new PacienteIndiceNombre(nuevoPaciente.nombre);
         newCentro.insertarPaciente(nuevoPaciente, nuevoPacienteIndice, prioridad, nuevoPacienteApellido, nuevoPacienteNombre);
         int  posicionEncontrada = 0;
         bool encontrado         = false;
         Singleton.Instance.listaPacientes.AgregarInicio(nuevoPaciente);
         //Lista de pacientes que servira para procesos de reporte
         Singleton.Instance.listaGeneralDePacientes.AgregarInicio(nuevoPaciente);
         //Validaciones para poder ingresar en la lista de pacientes
         if (Singleton.Instance.cantidadCentros == 0)
         {
             Singleton.Instance.listaReferencia.AgregarPos(Singleton.Instance.posicion, municipioPivot);
             Singleton.Instance.listaCentrosVacunacion.AgregarPos(Singleton.Instance.posicion, newCentro);
             Singleton.Instance.posicion++;
             Singleton.Instance.cantidadCentros++;
         }
         else
         {
             for (int i = 0; i < Singleton.Instance.cantidadCentros; i++)
             {
                 if (municipioPivot == Singleton.Instance.listaReferencia.DevolverValue(i))
                 {
                     encontrado         = true;
                     posicionEncontrada = i;
                     i = Singleton.Instance.cantidadCentros;
                 }
             }
             if (encontrado == false)
             {
                 Singleton.Instance.listaReferencia.AgregarPos(Singleton.Instance.posicion, municipioPivot);
                 Singleton.Instance.listaCentrosVacunacion.AgregarPos(Singleton.Instance.posicion, newCentro);
                 Singleton.Instance.posicion++;
                 Singleton.Instance.cantidadCentros++;
             }
             else
             {
                 CentroVacunacion tempVacunacion = new CentroVacunacion();
                 tempVacunacion = Singleton.Instance.listaCentrosVacunacion.DevolverValue(posicionEncontrada);
                 tempVacunacion.insertarPaciente(nuevoPaciente, nuevoPacienteIndice, prioridad, nuevoPacienteApellido, nuevoPacienteNombre);
                 Singleton.Instance.listaCentrosVacunacion.Eliminarpos(posicionEncontrada);
                 Singleton.Instance.listaCentrosVacunacion.AgregarPos(posicionEncontrada, tempVacunacion);
             }
         }
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }