Esempio n. 1
0
        public ActionResult Reposo(int id)
        {
            try
            {
                reposo reposo = db.reposo.Find(id);
                if (reposo == null)
                {
                    return(RedirectToAction("Message", "Home", new { mensaje = "La historia no tiene certificado de reposo" }));
                }
                dsReposo       dsReposo  = new dsReposo();
                string         conn      = ConfigurationManager.AppSettings["conexion"];
                SqlConnection  sqlcon    = new SqlConnection(conn);
                historia       historia  = db.historia.Find(id);
                string         strReposo = "Select top 1 * from view_reposo where his_id=" + id;
                SqlDataAdapter daReposo  = new SqlDataAdapter(strReposo, sqlcon);
                daReposo.Fill(dsReposo, "view_reposo");
                RptReposo rp         = new RptReposo();
                string    reportPath = Server.MapPath("~/Reports/RptReposo.rpt");
                rp.Load(reportPath);
                rp.SetDataSource(dsReposo);
                rp.SetParameterValue("fecha", get_fecha(historia.his_fecha));

                Stream stream = rp.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                stream.Seek(0, SeekOrigin.Begin);
                return(File(stream, "application/pdf", "Certificado.pdf"));
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Message", "Home", new { mensaje = ex.Message + ex.InnerException }));
            }
        }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            reposo reposo = db.reposo.Find(id);

            db.reposo.Remove(reposo);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
        //
        // GET: /Reposo/Details/5

        public ActionResult Details(int id = 0)
        {
            reposo reposo = db.reposo.Find(id);

            if (reposo == null)
            {
                return(HttpNotFound());
            }
            return(View(reposo));
        }
Esempio n. 4
0
 public ActionResult Edit(reposo reposo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(reposo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Message", "Home", new { mensaje = "Datos Guardados" }));
     }
     ViewBag.rep_id = reposo.rep_id;
     return(PartialView(reposo));
 }
Esempio n. 5
0
        //
        // GET: /Reposo/Edit/5

        public ActionResult Edit(int id = 0)
        {
            reposo reposo = db.reposo.Find(id);

            if (reposo == null)
            {
                return(RedirectToAction("Create", new { id = id }));
            }
            ViewBag.rep_id = reposo.rep_id;
            return(PartialView(reposo));
        }
Esempio n. 6
0
        //
        // GET: /Reposo/Create

        public ActionResult Create(int id)
        {
            reposo reposo = db.reposo.Find(id);

            if (reposo != null)
            {
                return(RedirectToAction("Edit", new { id = id }));
            }
            ViewBag.rep_id = id;
            return(PartialView());
        }
Esempio n. 7
0
        public ActionResult Create(reposo reposo)
        {
            if (ModelState.IsValid)
            {
                db.reposo.Add(reposo);
                db.SaveChanges();
                return(RedirectToAction("Message", "Home", new { mensaje = "Datos Guardados" }));
            }

            ViewBag.rep_id = reposo.rep_id;
            return(PartialView(reposo));
        }