コード例 #1
0
        public ActionResult NhapVien(GiayNhapVien gnv)
        {
            if (ModelState.IsValid)
            {
                db.DbSetGiayNhapVien.Add(gnv);
                db.SaveChanges();

                HoSoDieuTriNoiTru hoSo = new HoSoDieuTriNoiTru
                {
                    BenhNhanID         = gnv.BenhNhanID,
                    NgayBatDauDieuTri  = DateTime.Now,
                    ChanDoan           = gnv.ChanDoan,
                    GiayNhapVienID     = gnv.MaGiayNhapVien,
                    BacSiDieuTriID     = gnv.BacSiDieuTriID,
                    NgayKetThucDieuTri = null
                };

                db.DbSetHoSoDieuTriNoiTru.Add(hoSo);
                db.SaveChanges();
                TempData["saved"] = true;
                return(RedirectToAction("NhapVien", new { MaBN = gnv.BenhNhanID, MaBS = gnv.BacSiDieuTriID, ChanDoan = gnv.ChanDoan, GhiChu = gnv.GhiChu }));
            }

            return(View(gnv));
        }
コード例 #2
0
        public ActionResult CapNhatTinhTrang(int maHoSo = 0)
        {
            ViewBag.Msg = (Message)TempData["msg"];
            HoSoDieuTriNoiTru hs = db.DbSetHoSoDieuTriNoiTru.Find(maHoSo);
            var dsChiTiet        = db.DbSetChiTietDieuTri.ToList().FindAll(c => c.HoSoDieuTriNoiTruID == maHoSo);

            ViewBag.dsChiTiet = dsChiTiet;
            ChiTietDieuTri ct = new ChiTietDieuTri();

            ct.HoSoDieuTriNoiTruID = maHoSo;
            ct.HoSoDieuTriNoiTru   = hs;
            return(View(ct));
        }
コード例 #3
0
        public ActionResult XuatVien(GiayRaVien grv)
        {
            if (ModelState.IsValid)
            {
                db.DbSetGiayRaVien.Add(grv);
                db.SaveChanges();

                HoSoDieuTriNoiTru hs = (HoSoDieuTriNoiTru)db.DbSetHoSoDieuTriNoiTru.Where(h => h.GiayNhapVienID == grv.GiayNhapVienID).First();
                if (hs != null)
                {
                    hs.NgayKetThucDieuTri = DateTime.Now;
                    db.Entry(hs).State    = EntityState.Modified;
                    db.SaveChanges();
                }

                TempData["saved"] = true;
                return(RedirectToAction("XuatVien", new { chanDoan = grv.ChanDoan, maBN = grv.BenhNhanID, maBS = grv.BacSiDieuTriID, loiDan = grv.LoiDan }));
            }
            return(View(grv));
        }