public ActionResult Create([Bind(Include = "Id,color,doctor,anotaciones,fecha")] Evento evento, String Padecimiento, String Medicina, String CentroSalud)
        {
            if (ModelState.IsValid)
            {
                Enfermedad enf = getEnfermedadByName(Padecimiento);
                evento.Enfermedad = enf;
                Usuario u = db.Usuarios.Find(Session["idLoggead"]);
                evento.Usuario = u;

                if (Medicina != null)
                {
                    Medicinas medicina = getMedicinaByName(Medicina);
                    evento.Medicina = medicina;
                }
                if (CentroSalud != null)
                {
                    CentroSalud cs = getCentroByName(CentroSalud);
                    evento.CentroSalud = cs;
                }
                db.Eventoes.Add(evento);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(evento));
        }
Example #2
0
        public void Setup()
        {
            enfermedad = new Enfermedad
            {
                Codigo   = "123",
                Nombre   = "cancer-pulmonar",
                Gravedad = "grave",
                Tipo     = "cancer",
            };

            medico = new Medico
            {
                Apellidos       = "quintero",
                Nombres         = "cristian",
                Direccion       = "valledupar",
                Edad            = 18,
                Identificacion  = "1234",
                Sexo            = "M",
                Especializacion = "pulmonar"
            };

            paciente = new Paciente
            {
                Apellidos      = "quintero",
                Nombres        = "fabian",
                Direccion      = "valledupar",
                Edad           = 18,
                Identificacion = "123",
                Sexo           = "M",
                Medico         = medico
            };
        }
Example #3
0
        public EliminarResponse DeleteEnfermedad(string codigo)
        {
            Enfermedad enfermedad            = _unitOfWork.EnfermedadRepository.FindFirstOrDefault(p => p.Codigo == codigo);
            var        enfermedadSintoma     = _unitOfWork.IEnfermedadSintoma.FindBy(p => p.Enfermedad.Codigo == codigo, includeProperties: "Sintoma,Enfermedad").ToList();
            var        enfermedadTratamiento = _unitOfWork.IEnfermedadTratamientoRepository.FindBy(p => p.enfermedad.Codigo == codigo, includeProperties: "tratamiento,enfermedad").ToList();

            if (enfermedad == null)
            {
                return(new EliminarResponse()
                {
                    Message = $"No Existe la enfermedad"
                });
            }
            else
            {
                _unitOfWork.EnfermedadRepository.Delete(enfermedad);
                if (enfermedadSintoma != null)
                {
                    _unitOfWork.IEnfermedadSintoma.DeleteRange(enfermedadSintoma);
                }
                if (enfermedadTratamiento != null)
                {
                    _unitOfWork.IEnfermedadTratamientoRepository.DeleteRange(enfermedadTratamiento);
                }

                _unitOfWork.Commit();
                return(new EliminarResponse()
                {
                    Message = $"Se elimio la enfermedad"
                });
            }
        }
        public async Task <AgregarEnfermedadResponse> Handle(AgregarEnfermedadCommand request, CancellationToken cancellationToken)
        {
            //Search if exist a Enfermedad with equals or similar name
            string     nombre        = NormalizeString(request.Nombre);
            Enfermedad oldEnfermedad = await
                                       db.Enfermedad.Where(el =>
                                                           el.Nombre.Replace(" ", "").ToLower().Equals(nombre))
                                       .FirstOrDefaultAsync();

            if (oldEnfermedad == null)
            {
                Enfermedad newEnfermedad = new Enfermedad
                {
                    Nombre = request.Nombre
                };
                db.Enfermedad.Add(newEnfermedad);
            }
            else
            {
                oldEnfermedad.IsDeleted   = false;
                oldEnfermedad.DeletedDate = null;
            }
            await db.SaveChangesAsync(cancellationToken);

            return(new AgregarEnfermedadResponse());
        }
        public async Task <int> InsertarEnfermedadAsync(Enfermedad enfermedad)
        {
            MySqlConnection conexion       = AbrirConexionSql();
            string          sql            = "INSERT into enfermedades (CodEnfermedad, Descripcion) values (@CodEnfermedad, @Descripcion)";
            int             FilasAfectadas = 0;

            try
            {
                if (conexion != null)
                {
                    FilasAfectadas = await conexion.ExecuteAsync(sql, new { CodEnfermedad = enfermedad.CodEnfermedad, Descripcion = enfermedad.Descripcion });
                }
                return(FilasAfectadas);
            }
            catch
            {
                return(FilasAfectadas);
            }
            finally
            {
                if (conexion.State == System.Data.ConnectionState.Open)
                {
                    conexion.Close();
                }
            }
        }
Example #6
0
        public IActionResult Edit(int id)
        {
            Enfermedad oEnfermedad = _db.Enfermedad
                                     .Where(e => e.EnfermedadId == id).First();

            return(View(oEnfermedad));
        }
Example #7
0
        public IActionResult Create(Enfermedad enfermedad)
        {
            string Error = "";

            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(enfermedad));
                }
                else
                {
                    cargarUltimoRegistro();
                    Enfermedad _enfermedad = new Enfermedad
                    {
                        EnfermedadId = ViewBag.Id,
                        Nombre       = enfermedad.Nombre,
                        Descripcion  = enfermedad.Descripcion
                    };
                    _db.Enfermedad.Add(_enfermedad);
                    _db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                Error = ex.Message;
            }
            return(RedirectToAction(nameof(Index)));
        }
Example #8
0
        private void SeedEnfermedad(FitoReportDbContext context)
        {
            var enfermedadades = new Enfermedad[]
            {
                new Enfermedad
                {
                    Nombre = "Mancha negra (Cercospora purpura)"
                },
                new Enfermedad
                {
                    Nombre = "Anillamiento del Pedúnculo"
                },
                new Enfermedad
                {
                    Nombre = "Roña (Sphaceloma persea)",
                },
                new Enfermedad
                {
                    Nombre = "Antracnosis (colletotrichum gloesporoides)",
                },
                new Enfermedad
                {
                    Nombre = "Phytophthora cinnamomi",
                },
            };

            foreach (var enfermedad in enfermedadades)
            {
                context.Enfermedad.Add(enfermedad);
                context.SaveChanges();
            }
        }
Example #9
0
        public static int ActualizarEnfermedadPorId(Enfermedad enfermedad)
        {
            int resultado = 0;

            using (SqlConnection sqlConnection = new SqlConnection(connectionString))
            {
                SqlCommand sqlCommand = new SqlCommand(null, sqlConnection);
                sqlCommand.CommandText = "Update ENFERMEDAD SET DESCRIPCION = @DESCRIPCION where IDENFERMEDAD = @IDENFERMEDAD";

                sqlCommand.Parameters.AddWithValue("@DESCRIPCION", enfermedad.DESCRIPCION);
                sqlCommand.Parameters.AddWithValue("@IDENFERMEDAD", enfermedad.IDENFERMEDAD);

                try
                {
                    sqlConnection.Open();
                    resultado = sqlCommand.ExecuteNonQuery();
                    sqlConnection.Close();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }


            return(resultado);
        }
Example #10
0
        public static int AgregarEnfermedad(Enfermedad enfermedad)
        {
            int filasAfectadas = 0;

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand sqlCommand = new SqlCommand(null, connection);
                sqlCommand.CommandText = "Insert into ENFERMEDAD (IDENFERMEDAD,DESCRIPCION) values (@IDENFERMEDAD,@DESCRIPCION)";
                sqlCommand.Parameters.AddWithValue("@IDENFERMEDAD", enfermedad.IDENFERMEDAD);
                sqlCommand.Parameters.AddWithValue("@DESCRIPCION", enfermedad.DESCRIPCION);


                try
                {
                    connection.Open();
                    filasAfectadas = sqlCommand.ExecuteNonQuery();
                    connection.Close();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            return(filasAfectadas);
        }
Example #11
0
        public EliminarResponse DeleteEnfermedad(int id)
        {
            Enfermedad enfermedad            = _unitOfWork.EnfermedadRepository.Find(id);
            var        enfermedadSintoma     = _unitOfWork.IEnfermedadSintoma.FindBy(p => p.Enfermedad.Id == id, includeProperties: "Sintoma,Enfermedad").ToList();
            var        enfermedadTratamiento = _unitOfWork.IEnfermedadTratamientoRepository.FindBy(p => p.enfermedad.Id == id, includeProperties: "tratamiento,enfermedad").ToList();

            if (enfermedad == null)
            {
                return(new EliminarResponse()
                {
                    Message = $"No Existe"
                });
            }
            else
            {
                _unitOfWork.EnfermedadRepository.Delete(enfermedad);
                if (enfermedadSintoma != null)
                {
                    _unitOfWork.IEnfermedadSintoma.DeleteRange(enfermedadSintoma);
                }
                if (enfermedadTratamiento != null)
                {
                    _unitOfWork.IEnfermedadTratamientoRepository.DeleteRange(enfermedadTratamiento);
                }

                _unitOfWork.Commit();
                return(new EliminarResponse()
                {
                    Message = $"Se Elimio"
                });
            }
        }
Example #12
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Detalle")] Enfermedad enfermedad)
        {
            if (id != enfermedad.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(enfermedad);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EnfermedadExists(enfermedad.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(enfermedad));
        }
Example #13
0
        public static int ActualizarEnfermedad(Enfermedad enfermedad)
        {
            int resultado = 0;

            using (SqlConnection sqlConnection = new SqlConnection(connectionString))
            {
                SqlCommand sqlCommand = new SqlCommand(null, sqlConnection);
                sqlCommand.CommandText = "UPDATE Enfermedad SET nombre_enfermedad = @nombre_enfermedad where id_enfermedad = @id_enfermedad";

                sqlCommand.Parameters.AddWithValue("@nombre_enfermedad", enfermedad.NombreEnfermedad);
                sqlCommand.Parameters.AddWithValue("@id_enfermedad", enfermedad.IdEnfermedad);



                try
                {
                    sqlConnection.Open();

                    resultado = sqlCommand.ExecuteNonQuery();

                    sqlConnection.Close();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                return(resultado);
            }
        }
Example #14
0
        public static int AgregarEnfermedad(Enfermedad enfermedad)
        {
            int resultado = 0;

            using (SqlConnection sqlConnection = new SqlConnection(connectionString))
            {
                SqlCommand sqlCommand = new SqlCommand(null, sqlConnection);
                sqlCommand.CommandText = "Insert into Enfermedad(nombre_enfermedad) values (@nombre_enfermedad)";

                sqlCommand.Parameters.AddWithValue("@nombre_enfermedad", enfermedad.NombreEnfermedad);



                try
                {
                    sqlConnection.Open();

                    resultado = sqlCommand.ExecuteNonQuery();

                    sqlConnection.Close();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                return(resultado);
            }
        }
        /// <summary>
        /// Alta de enfermedad
        /// </summary>
        /// <param name="pId"></param>
        /// <param name="pNombre"></param>
        /// <param name="pFichaId"></param>
        public void AltaEnfermedad(int pId, string pNombre, int pFichaId)
        {
            var unaFichaMedica = this.iUnitOfWork.HistorialMedicoRepository.Get(pFichaId);
            var unaEnfermedad  = new Enfermedad(pId, pNombre, unaFichaMedica);

            unaFichaMedica.Enfermedades.Add(unaEnfermedad);
        }
        public async Task <int> UpdateEnfermedadAsync(Enfermedad enfermedad)
        {
            MySqlConnection conexion          = AbrirConexionSql();
            string          sql               = "UPDATE enfermedades SET  CodEnfermedad = @CodEnfermedad, Descripcion = @Descripcion WHERE CodEnfermedad = @CodEnfermedad";
            int             NroFilasAfectadas = 0;

            try
            {
                if (conexion != null)
                {
                    NroFilasAfectadas = await conexion.ExecuteAsync(sql, new
                    {
                        CodEnfermedad = enfermedad.CodEnfermedad,
                        Descripcion   = enfermedad.Descripcion
                    });
                }
                ;
                return(NroFilasAfectadas);
            }
            catch (Exception ex)
            {
                return(NroFilasAfectadas);
            }
            finally
            {
                if (conexion.State == System.Data.ConnectionState.Open)
                {
                    conexion.Close();
                }
            }
        }
        /// <summary>
        /// Descripción: Muestra la informacion de los examenes agregados.
        /// Author: Terceros.
        /// Fecha Creacion: 01/01/2017.
        /// Fecha Modificación: 02/02/2017.
        /// Modificación: Se agregaron comentarios, funcion no utilizada.
        /// </summary>
        /// <param name="idEnfermedad"></param>
        /// <param name="idExamen"></param>
        /// <returns></returns>
        public ActionResult ShowTableExamen(int idEnfermedad, string idExamen)
        {
            List <TipoMuestra> examenListAgregados = new List <TipoMuestra>();

            if (this.Session["ExamenListAgregados"] != null)
            {
                examenListAgregados = (List <TipoMuestra>) this.Session["ExamenListAgregados"];
            }


            if (this.Session["enfermedadList"] != null && this.Session["examenList"] != null)
            {
                List <Enfermedad> enfermedadList = (List <Enfermedad>) this.Session["enfermedadList"];
                List <Examen>     examenList     = (List <Examen>) this.Session["examenList"];

                Enfermedad  enfermedad  = enfermedadList.Where(x => x.idEnfermedad == idEnfermedad).FirstOrDefault();
                Examen      examen      = examenList.Where(x => x.idExamen == Guid.Parse(idExamen)).FirstOrDefault();
                TipoMuestra tipoMuestra = new TipoMuestra();
                tipoMuestra.examen     = examen;
                tipoMuestra.enfermedad = enfermedad;
                tipoMuestra.posicion   = examenListAgregados.Count + 1;

                examenListAgregados.Add(tipoMuestra);
            }
            //var model = tipoMuestraListAgregados;
            this.Session["ExamenListAgregados"] = examenListAgregados;
            return(PartialView("_AgregarTblExamen", examenListAgregados));
        }
Example #18
0
        //public string RecomendacionMedica { get; set; }

        public DiagnosticoRequest(string descripcion, Enfermedad enfermedad, Paciente paciente, Medico medico, string estado)
        {
            this.Descripcion = descripcion;
            this.Enfermedad  = enfermedad;
            this.Paciente    = paciente;
            this.Medico      = medico;
            this.Estado      = estado;
        }
Example #19
0
 //OBTIENE LISTA ENFERMEDADES EnfermedadId | CategoriaId | Descripcion
 public DataTable Enfermedad_Verificar(Enfermedad ObjEnfermedad)
 {
     cmd             = new SqlCommand();
     cmd.CommandText = "sp2_ate_Enfermedad_Verificar";
     cmd.Parameters.AddWithValue("@CategoriaId", ObjEnfermedad.CategoriaId);
     cmd.Parameters.AddWithValue("@EnfermedadId", ObjEnfermedad.EnfermedadId);
     return(Datos.ObtenerDatosProcedure(cmd));
 }
        public ActionResult DeleteConfirmed(int id)
        {
            Enfermedad enfermedad = db.Enfermedads.Find(id);

            db.Enfermedads.Remove(enfermedad);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #21
0
 //OBTIENE LISTA ENFERMEDADES X CATEGORIA
 public DataTable Enfermedad_listar(Enfermedad ObjEnfermedad)
 {
     cmd             = new SqlCommand();
     cmd.CommandText = "sp2_ATE_enfermedad_EnfermedadXCategoria";
     cmd.Parameters.AddWithValue("@CategoriaId", ObjEnfermedad.CategoriaId);
     cmd.Parameters.AddWithValue("@Descripcion", ObjEnfermedad.Descripcion);
     return(Datos.ObtenerDatosProcedure(cmd));
 }
        public async Task <DeleteEnfermedadResponse> Handle(DeleteEnfermedadCommand request, CancellationToken cancellationToken)
        {
            Enfermedad entity = await db.Enfermedad.FindAsync(request.IdEnferemedad);

            db.Enfermedad.Remove(entity);
            await db.SaveChangesAsync(cancellationToken);

            return(new DeleteEnfermedadResponse());
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Enfermedad enfermedad = await db.Enfermedades.FindAsync(id);

            db.Enfermedades.Remove(enfermedad);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public void ActualizarEnfermedades(String nom, int diasReposo, String tratamiento)
        {
            Enfermedad enfermedad = iEnf.getPorCriterio <Enfermedad>(nom).First();

            enfermedad.tratamiento = tratamiento;
            enfermedad.diasReposo  = diasReposo;

            guardado = true;
        }
        protected void btnConsultarSintoma_Click(object sender, EventArgs e)
        {
            ClsEnfermedad clsEnfermedad = new ClsEnfermedad();
            Enfermedad    enfermedad    = new Enfermedad();

            gdgGrid.DataSource = clsEnfermedad.ConsultarEnfermedad(DropDownEnfermedad.SelectedItem.Text, DropDownSintoma.SelectedItem.Text);
            gdgGrid.DataBind();
            gdgGrid.HeaderRow.TableSection = TableRowSection.TableHeader; // Agrega etiqueta: <thead> a la tabla
        }
 public DiagnosticoRequest(string descripcion, Enfermedad enfermedad, Paciente paciente, Medico medico, string estado, string recomendacionmedica, DateTime fecha)
 {
     this.Descripcion         = descripcion;
     this.Enfermedad          = enfermedad;
     this.Paciente            = paciente;
     this.Medico              = medico;
     this.Estado              = estado;
     this.RecomendacionMedica = recomendacionmedica;
     this.Fecha = fecha;
 }
 public ActionResult Edit([Bind(Include = "Id,nombre,fecha_diagnostico,ultimo_evento,tipo")] Enfermedad enfermedad)
 {
     if (ModelState.IsValid)
     {
         db.Entry(enfermedad).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(enfermedad));
 }
Example #28
0
    public void UsarVacuna(Enfermedad enfermedad, Actor actor)
    {
        if (enfermedad is VirusA && tipo == 0)
        {
            if (actor.inmunidadOcumuladaA < 0.5)
            {
                actor.Contagiado             = false;
                actor.TiempoContagiadoVirusA = enfermedad.Onset * 0.1f;
                actor.TiempoMorirActivo      = false;
                actor.TiempoParaMorir        = 0;
                actor.inmunidadOcumuladaA   += 0.1f;
                if (actor.ProbabilidadVirusA > 0.4f)
                {
                    actor.ProbabilidadVirusA -= inmunidadOfrecida;
                }
                Destroy(actor.GetComponent <Enfermedad>());
            }
        }

        if (enfermedad is VirusS && tipo == 1)
        {
            if (actor.inmunidadOcumuladaS < 0.5)
            {
                actor.Contagiado             = false;
                actor.TiempoContagiadoVirusS = enfermedad.Onset * 0.1f;
                actor.TiempoMorirActivo      = false;
                actor.TiempoParaMorir        = 0;
                actor.inmunidadOcumuladaS   += 0.1f;
                if (actor.ProbabilidadVirusS > 0.4f)
                {
                    actor.ProbabilidadVirusS -= inmunidadOfrecida;
                }
                Destroy(actor.GetComponent <Enfermedad>());
            }
        }

        if (enfermedad is BlackDeath && tipo == 2)
        {
            if (actor.inmunidadOcumuladaBlack < 0.5)
            {
                actor.Contagiado               = false;
                actor.TiempoContagiadoBlack    = enfermedad.Onset * 0.1f;
                actor.inmunidadOcumuladaBlack += 0.1f;
                actor.TiempoParaMorir          = 0;
                actor.TiempoMorirActivo        = false;
                if (actor.ProbabilidadBlackDeath > 0.4f)
                {
                    actor.ProbabilidadBlackDeath -= inmunidadOfrecida;
                }
                Destroy(actor.GetComponent <Enfermedad>());
            }
        }

        GameObject.Destroy(gameObject);
    }
Example #29
0
        public async Task <IActionResult> Create([Bind("Id,Nombre,Detalle")] Enfermedad enfermedad)
        {
            if (ModelState.IsValid)
            {
                _context.Add(enfermedad);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(enfermedad));
        }
Example #30
0
 private static List <Enfermedad> LLenadoEnfermedades(DataTable dataTable)
 {
     enfermedades = new List <Enfermedad>();
     for (int i = 0; i < dataTable.Rows.Count; i++)
     {
         Enfermedad enfermedad = new Enfermedad();
         enfermedad.IDENFERMEDAD = int.Parse(dataTable.Rows[i]["IDENFERMEDAD"].ToString());
         enfermedad.DESCRIPCION  = dataTable.Rows[i]["DESCRIPCION"].ToString();
         enfermedades.Add(enfermedad);
     }
     return(enfermedades);
 }
        public void crearEnfermedad(object sender, EventArgs e)
        {
            try
             {
                 enfermedad = new Enfermedad();
                 enfermedad.descripcionEnfermedad = txt_nombre.Text.ToString();
                 enfermedad.gravedad = int.Parse(dl_gravedad.SelectedItem.Value);
                 enfermedad.tratamiento = txt_tratamiento.Text.ToString();
                 enfermedad.diasReposo = int.Parse(dl_diasReposo.SelectedItem.Value);
                 //enfermedad.requiereInternacion= Boolean(dl_internacion.SelectedItem.Value);

                 enfermedad.codigoEnfermedad = generarCodigo();

                 iEnf.save<Enfermedad>(enfermedad);
                 txt_nombre.Text = "";
                 dl_gravedad.SelectedIndex = 0;
                 txt_tratamiento.Text = "";
                 String msj = "La enfermedad ha sido creado correctamente.";
                 Intermediario.confirmarCambios();
                 this.Page.Response.Write("<script language='JavaScript'>window.alert('" + msj + "');</script>");

             }
             catch (Exception) { }
        }