public ActionResult DeleteConfirmed(int id)
        {
            Exp_AntPersoPatolog exp_AntPersoPatolog = db.Exp_AntPersoPatolog.Find(id);

            db.Exp_AntPersoPatolog.Remove(exp_AntPersoPatolog);
            db.SaveChanges();
            return(RedirectToAction("Index", "Cat_ExpMedico"));
        }
 public ActionResult Edit([Bind(Include = "i_Pk_AntPatologicos,vc_Piel,vc_ApaDigestivo,vc_ApaGeneUrinario,vc_SisNervioso,vc_SisMuscEsquele,vc_SisEndocri,vc_SisCardio,vc_Alergias,vc_ProblemPsicolo,vc_otros")] Exp_AntPersoPatolog exp_AntPersoPatolog)
 {
     if (ModelState.IsValid)
     {
         db.Entry(exp_AntPersoPatolog).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", "Cat_ExpMedico"));
     }
     return(View(exp_AntPersoPatolog));
 }
        // GET: Exp_AntPersoPatolog/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Exp_AntPersoPatolog exp_AntPersoPatolog = db.Exp_AntPersoPatolog.Find(id);

            if (exp_AntPersoPatolog == null)
            {
                return(HttpNotFound());
            }
            return(View(exp_AntPersoPatolog));
        }
        // GET: Exp_AntPersoPatolog/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Cat_ExpMedico       expediente          = db.Cat_ExpMedico.Find(id);
            Exp_AntPersoPatolog exp_AntPersoPatolog = db.Exp_AntPersoPatolog.Find(expediente.i_fk_AntPatoPersonales);

            if (exp_AntPersoPatolog == null)
            {
                return(HttpNotFound());
            }
            return(View(exp_AntPersoPatolog));
        }
Exemplo n.º 5
0
        public ActionResult Create([Bind(Include = "i_PK_ExpMedico,i_FK_idFuncionario,i_FK_idUsuExterno,d_ExpMedico,i_fk_GineObstetricos,i_fk_HereFamiliar,i_fk_QuirTrauma,i_fk_AntPatoPersonales,b_Estado")] Cat_ExpMedico cat_ExpMedico)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Exp_GinecoObstreticos gineco    = new Exp_GinecoObstreticos();
                    Exp_AnteQuirurTrauma  quiTraum  = new Exp_AnteQuirurTrauma();
                    Exp_HeredoFamiliar    hereFam   = new Exp_HeredoFamiliar();
                    Exp_AntPersoPatolog   persoPato = new Exp_AntPersoPatolog();

                    cat_ExpMedico.Exp_GinecoObstreticos = gineco;
                    cat_ExpMedico.Exp_AnteQuirurTrauma  = quiTraum;
                    cat_ExpMedico.Exp_HeredoFamiliar    = hereFam;
                    cat_ExpMedico.Exp_AntPersoPatolog   = persoPato;

                    var usuario_encontrado = from s in db.Funcionarios where s.vc_Cedula == cat_ExpMedico.i_FK_idFuncionario.ToString() select s;

                    if (usuario_encontrado.Count() == 0)
                    {
                        var usuarioTemp2 = from a in db.CM_UsuarioExterno where a.vc_Cedula == cat_ExpMedico.i_FK_idUsuExterno.ToString() select a;
                        if (usuarioTemp2.Count() == 0)
                        {
                            Response.Write("<script>window.alert('El usuario no se encuentra en el sistema.');</script>");
                        }
                        else
                        {
                            foreach (var s in usuarioTemp2)
                            {
                                cat_ExpMedico.i_FK_idUsuExterno = s.i_Pk_idUsuExterno;
                            }
                            Response.Write("<script>window.alert('Expediente creado correctamente.');</script>");
                            db.Cat_ExpMedico.Add(cat_ExpMedico);
                            db.SaveChanges();
                            return(RedirectToAction("Index"));
                        }
                    }
                    else
                    {
                        foreach (var s in usuario_encontrado)
                        {
                            cat_ExpMedico.i_FK_idFuncionario = s.i_Pk_Funcionario;
                        }
                        Response.Write("<script>window.alert('Expediente creado correctamente.');</script>");
                        db.Cat_ExpMedico.Add(cat_ExpMedico);
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }
                }
                catch (Exception) { Response.Write("<script>window.alert('Error al crear expediente.');</script>"); }
                return(RedirectToAction("Index"));
            }

            ViewBag.i_FK_idUsuExterno      = new SelectList(db.CM_UsuarioExterno, "i_Pk_idUsuExterno", "vc_Cedula", cat_ExpMedico.i_FK_idUsuExterno);
            ViewBag.i_fk_QuirTrauma        = new SelectList(db.Exp_AnteQuirurTrauma, "i_Pk_QuirurTrauma", "vc_FracDonde", cat_ExpMedico.i_fk_QuirTrauma);
            ViewBag.i_fk_AntPatoPersonales = new SelectList(db.Exp_AntPersoPatolog, "i_Pk_AntPatologicos", "vc_Piel", cat_ExpMedico.i_fk_AntPatoPersonales);
            ViewBag.i_fk_GineObstetricos   = new SelectList(db.Exp_GinecoObstreticos, "i_Pk_idGinObste", "vc_Menarca", cat_ExpMedico.i_fk_GineObstetricos);
            ViewBag.i_fk_HereFamiliar      = new SelectList(db.Exp_HeredoFamiliar, "i_Pk_HereFamiliar", "vc_Piel", cat_ExpMedico.i_fk_HereFamiliar);
            ViewBag.i_FK_idFuncionario     = new SelectList(db.Funcionarios, "i_Pk_Funcionario", "vc_Cedula", cat_ExpMedico.i_FK_idFuncionario);
            return(View(cat_ExpMedico));
        }