예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            rayos rayos = db.rayos.Find(id);

            db.rayos.Remove(rayos);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
        public ActionResult Edit(rayos rayos)
        {
            //string nom_pac;
            if (Request.Files.Count > 0)
            {
                var      file     = Request.Files[0];
                string   fileName = Path.GetFileName(file.FileName);
                string   ext      = Path.GetExtension(fileName);
                string[] formatos = new string[] { ".jpg", ".jpeg", ".bmp", ".png", ".gif", ".JPG", ".JPEG", ".BMP", ".PNG", ".GIF" };
                if (fileName != "")
                {
                    if (ModelState.IsValid && (Array.IndexOf(formatos, ext) >= 0))
                    {
                        if (fileName != rayos.ray_imagen)
                        {
                            string path = Path.Combine(Server.MapPath("~/Content/rayos"), fileName);
                            file.SaveAs(path);
                        }
                        rayos.ray_imagen      = fileName;
                        db.Entry(rayos).State = EntityState.Modified;
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        ModelState.AddModelError("ext", "Extensión no Válida");
                    }
                }
                else
                {
                    if (ModelState.IsValid)
                    {
                        UserManager usermanager = new UserManager();
                        rayos.ray_responsable = usermanager.get_user_id(User);
                        rayos.ray_perfil      = usermanager.get_perfil(User);
                        db.Entry(rayos).State = EntityState.Modified;
                        db.SaveChanges();
                        if (rayos.ray_observacion != "")
                        {
                            notificar(rayos.ray_paciente);
                        }
                        return(RedirectToAction("Index"));
                    }
                }
            }

            paciente paciente = db.paciente.Find(rayos.ray_paciente);

            ViewBag.paciente = paciente.pac_nombres + " " + paciente.pac_apellidos;

            return(View(rayos));
        }
예제 #3
0
        public ActionResult Download(int id = 0)
        {
            rayos rayos = db.rayos.Find(id);

            string[] filename    = rayos.ray_imagen.Split('.');
            string   contentType = "application/" + filename[1];

            if (rayos == null)
            {
                return(HttpNotFound());
            }
            return(File(Server.MapPath("~/Content/rayos/") + rayos.ray_imagen, contentType, rayos.ray_imagen));
        }
예제 #4
0
        public ActionResult Details(int id = 0)
        {
            rayos rayos = db.rayos.Find(id);

            if (rayos == null)
            {
                return(HttpNotFound());
            }
            paciente paciente = db.paciente.Find(rayos.ray_paciente);

            ViewBag.paciente = paciente.pac_nombres + " " + paciente.pac_apellidos;

            return(View(rayos));
        }
예제 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.reportDocument != null)
            {
                this.reportDocument.Close();
                this.reportDocument.Dispose();
            }

            dsRayos dsPrueba = new dsRayos();
            string  conn     = ConfigurationManager.AppSettings["conexion"];
            int     id       = Convert.ToInt32(Session["ray_id"]);
            rayos   rayos    = db.rayos.Find(id);
            //string fileName = medico.med_firma;
            //if (String.IsNullOrEmpty(fileName))
            //    fileName = "firma.png";

            string strAudiometia = "Select * from rayos where ray_id=" + id;
            string strPaciente   = "Select * from paciente where pac_id=" + rayos.ray_paciente;


            SqlConnection  sqlcon        = new SqlConnection(conn);
            SqlDataAdapter daAudiometria = new SqlDataAdapter(strAudiometia, sqlcon);
            SqlDataAdapter daPaciente    = new SqlDataAdapter(strPaciente, sqlcon);

            daAudiometria.Fill(dsPrueba, "rayos");
            daPaciente.Fill(dsPrueba, "paciente");


            reportDocument = new ReportDocument();
            //Report path
            string reportPath = Server.MapPath("~/Reports/RptRayos.rpt");

            reportDocument.Load(reportPath);
            reportDocument.SetDataSource(dsPrueba);
            reportDocument.SetParameterValue("hc", "");
            reportDocument.SetParameterValue("orden", "");
            //string path01 = Path.Combine(Server.MapPath("~/Content/firmas"), fileName);
            //reportDocument.SetParameterValue("picturePath", path01);
            crViewer.ReportSource = reportDocument;
            crViewer.DataBind();
        }
예제 #6
0
        public ActionResult Delete(int id = 0)
        {
            rayos rayos = db.rayos.Find(id);

            if (rayos == null)
            {
                return(HttpNotFound());
            }
            paciente paciente = db.paciente.Find(rayos.ray_paciente);
            string   nom_pac  = String.Empty;

            if (paciente != null)
            {
                nom_pac = paciente.pac_nombres + " " + paciente.pac_apellidos;
            }
            else
            {
                nom_pac = "";
            }
            @ViewBag.paciente = nom_pac;
            return(View(rayos));
        }
예제 #7
0
        public ActionResult Create(rayos rayos)
        {
            string nom_pac;
            string nom_med;

            if (Request.Files.Count > 0)
            {
                var      file     = Request.Files[0];
                string   fileName = Path.GetFileName(file.FileName);
                string   ext      = Path.GetExtension(fileName);
                string[] formatos = new string[] { ".jpg", ".jpeg", ".bmp", ".png", ".gif", ".JPG", ".JPEG", ".BMP", ".PNG", ".GIF" };
                if (fileName != "")
                {
                    rayos.ray_imagen = fileName;
                    DateTime dd = DateTime.Now;
                    rayos.ray_fecha         = dd.Date.ToString("d");
                    rayos.ray_laboratorista = get_user();
                    rayos.ray_orden         = get_orden(rayos.ray_fecha);
                    if (ModelState.IsValid && (Array.IndexOf(formatos, ext) >= 0))
                    //if (ModelState.IsValid)
                    {
                        string path = Path.Combine(Server.MapPath("~/Content/rayos"), fileName);
                        file.SaveAs(path);
                        db.rayos.Add(rayos);
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        ModelState.AddModelError("ext", "Extensión no Válida " + ext);
                    }
                }
                else
                {
                    ModelState.AddModelError("ext", "Debe seleccionar un archivo");
                }
            }

            paciente paciente = db.paciente.Find(rayos.ray_paciente);

            if (paciente != null)
            {
                nom_pac = paciente.pac_nombres + " " + paciente.pac_apellidos;
            }
            else
            {
                nom_pac = "";
            }
            ViewBag.paciente = nom_pac;
            medico medico = db.medico.Find(rayos.ray_paciente);

            if (medico != null)
            {
                nom_med = medico.med_nombres + " " + medico.med_apellidos;
            }
            else
            {
                nom_med = "";
            }
            ViewBag.medico = nom_med;
            return(View(rayos));
        }