コード例 #1
0
        public ActionResult Create([Bind(Include = "id,visitDate,visitStatus,visitSite,complaintType,PresentHistory,decision,requestedInvestigations,GeneralAppearance,mentality,Built,Pallor,jaundice,cyanosis,postureDuringWalking,postureStanding,postureSitting,postureLyingSupineorPhone,vitalSigns,DoctorId,patientId")] visit visit)
        {
            if (!HomeController.Authorized(this))
            {
                return(RedirectToAction("Login", "Accounts"));
            }
            if (ModelState.IsValid)
            {
                visit.id = Guid.NewGuid();
                db.visits.Add(visit);
                db.SaveChanges();
                return(RedirectToAction("Index", new { @id = visit.patientId }));
            }

            if (visit.patientId == null)
            {
                return(HttpNotFound());
            }

            patient patient = _patientService.get(visit.patientId);

            if (patient == null)
            {
                return(HttpNotFound());
            }
            ViewBag.patient  = patient;
            ViewBag.DoctorId = new SelectList(db.SystemPersons.Where(o => o.Job.name.ToLower() == "doctor"), "id", "name", visit.DoctorId);
            return(View(visit));
        }
コード例 #2
0
        public ActionResult Create(patient patient)
        {
            if (!HomeController.Authorized(this))
            {
                return(RedirectToAction("Login", "Accounts"));
            }
            if (ModelState.IsValid)
            {
                if (patient.birthDate != null)
                {
                    patient.age = DateTime.Now.Year - patient.birthDate.Value.Year;

                    if (patient.birthDate.Value.Month > DateTime.Now.Month)
                    {
                        patient.age--;
                    }
                    else if (patient.birthDate.Value.Month == DateTime.Now.Month)
                    {
                        if (patient.birthDate.Value.Day > DateTime.Now.Day)
                        {
                            patient.age--;
                        }
                    }
                }
                patient.id = Guid.NewGuid();
                db.patients.Add(patient);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.doctorId = new SelectList(db.SystemPersons, "id", "name", patient.doctorId);
            return(View(patient));
        }
コード例 #3
0
        public ActionResult Create(examination examination)
        {
            if (!HomeController.Authorized(this))
            {
                return(RedirectToAction("Login", "Accounts"));
            }
            if (ModelState.IsValid)
            {
                examination.id = Guid.NewGuid();
                db.examinations.Add(examination);
                db.SaveChanges();
                return(RedirectToAction("Index", new { id = examination.visitId }));
            }
            if (examination.visitId == null)
            {
                return(HttpNotFound());
            }

            visit visit = _visitService.get(examination.visitId);

            if (visit == null)
            {
                return(HttpNotFound());
            }
            ViewBag.visit = visit;
            return(View(examination));
        }
コード例 #4
0
        public ActionResult Create([Bind(Include = "id,Laboratory1,DateofLab,visitId")] Laboratory laboratory)
        {
            if (!HomeController.Authorized(this))
            {
                return(RedirectToAction("Login", "Accounts"));
            }
            if (ModelState.IsValid)
            {
                laboratory.id = Guid.NewGuid();
                db.Laboratories.Add(laboratory);
                db.SaveChanges();
                return(RedirectToAction("Index", new { @id = laboratory.visitId }));
            }
            if (laboratory.visitId == null)
            {
                return(HttpNotFound());
            }

            visit visit = _visitService.get(laboratory.visitId);

            if (visit == null)
            {
                return(HttpNotFound());
            }
            ViewBag.visit = visit;
            return(View(laboratory));
        }
コード例 #5
0
        public ActionResult Create([Bind(Include = "id,name")] Job job)
        {
            if (!HomeController.Authorized(this))
            {
                return(RedirectToAction("Login", "Accounts"));
            }
            if (ModelState.IsValid)
            {
                job.id = Guid.NewGuid();
                db.Jobs.Add(job);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(job));
        }
コード例 #6
0
        public ActionResult Create([Bind(Include = "id,name")] Group group)
        {
            if (!HomeController.Authorized(this))
            {
                return(RedirectToAction("Login", "Accounts"));
            }
            if (ModelState.IsValid)
            {
                group.id = Guid.NewGuid();
                db.Groups.Add(group);
                db.SaveChanges();
                createPermissions(group.id);
                return(RedirectToAction("Index"));
            }

            return(View(group));
        }
コード例 #7
0
        public ActionResult Create([Bind(Include = "id,name,jobId")] Specialization specialization)
        {
            if (!HomeController.Authorized(this))
            {
                return(RedirectToAction("Login", "Accounts"));
            }
            if (ModelState.IsValid)
            {
                specialization.id = Guid.NewGuid();
                db.Specializations.Add(specialization);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.jobId = new SelectList(db.Jobs, "id", "name", specialization.jobId);
            return(View(specialization));
        }
コード例 #8
0
        public ActionResult Create([Bind(Include = "id,patientName,fromTime,toTime,reservationType,notes,status,doctorId,roomNumber")] Reservation reservation)
        {
            if (!HomeController.Authorized(this))
            {
                return(RedirectToAction("Login", "Accounts"));
            }
            if (ModelState.IsValid)
            {
                reservation.id = Guid.NewGuid();
                db.Reservations.Add(reservation);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.doctorId = new SelectList(db.SystemPersons, "id", "name", reservation.doctorId);
            return(View(reservation));
        }
コード例 #9
0
 public ActionResult Create(Account account)
 {
     if (!HomeController.Authorized(this))
     {
         return(RedirectToAction("Login", "Accounts"));
     }
     if (_service.getbyNameandPassword(account.name, account.password) != null)
     {
         ModelState.AddModelError("name", "User Already Exisit , Please Choose Another one!");
     }
     if (ModelState.IsValid)
     {
         account.id           = Guid.NewGuid();
         account.creationDate = DateTime.Now;
         db.Accounts.Add(account);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.groupId = new SelectList(db.Groups, "id", "name");
     return(View(account));
 }
コード例 #10
0
        public ActionResult Create([Bind(Include = "id,Endoscopy1,EndoscopyType,site,comments,graph,visitId")] Endoscopy endoscopy)
        {
            if (!HomeController.Authorized(this))
            {
                return(RedirectToAction("Login", "Accounts"));
            }
            if (ModelState.IsValid)
            {
                endoscopy.id = Guid.NewGuid();
                db.Endoscopies.Add(endoscopy);
                db.SaveChanges();
                return(RedirectToAction("Index", new { @id = endoscopy.visitId }));
            }
            visit visit = _visitService.get(endoscopy.visitId);

            if (visit == null)
            {
                return(HttpNotFound());
            }
            ViewBag.visit = visit;
            return(View(endoscopy));
        }
コード例 #11
0
        public ActionResult Create(medicine medicine)
        {
            if (!HomeController.Authorized(this))
            {
                return(RedirectToAction("Login", "Accounts"));
            }
            if (ModelState.IsValid)
            {
                medicine.id = Guid.NewGuid();
                db.medicines.Add(medicine);
                db.SaveChanges();
                return(RedirectToAction("Index", new { @id = medicine.prescriptionId }));
            }
            prescription presc = db.prescriptions.FirstOrDefault(i => i.id == medicine.prescriptionId);

            if (presc == null)
            {
                return(HttpNotFound());
            }
            ViewBag.prescription = presc;
            return(View(medicine));
        }
コード例 #12
0
        public ActionResult Create([Bind(Include = "id,notes,visitId")] prescription prescription)
        {
            if (!HomeController.Authorized(this))
            {
                return(RedirectToAction("Login", "Accounts"));
            }
            if (ModelState.IsValid)
            {
                prescription.id = Guid.NewGuid();
                db.prescriptions.Add(prescription);
                db.SaveChanges();
                return(RedirectToAction("Index", new { @id = prescription.visitId }));
            }
            visit visit = _visitService.get(prescription.visitId);

            if (visit == null)
            {
                return(HttpNotFound());
            }
            ViewBag.visit = visit;
            return(View(prescription));
        }
コード例 #13
0
        public ActionResult Create([Bind(Include = "id,ImageDate,ImageCenter,TypeofImage,Site,Comments,ImageName,VisitId")] Imaging imaging)
        {
            if (!HomeController.Authorized(this))
            {
                return(RedirectToAction("Login", "Accounts"));
            }
            if (ModelState.IsValid)
            {
                imaging.id = Guid.NewGuid();
                db.Imagings.Add(imaging);
                db.SaveChanges();
                return(RedirectToAction("Index", new { @id = imaging.VisitId }));
            }
            visit visit = _visitService.get(imaging.VisitId);

            if (visit == null)
            {
                return(HttpNotFound());
            }
            ViewBag.visit = visit;
            return(View(imaging));
        }
コード例 #14
0
 public ActionResult Edit([Bind(Include = "id,groupId,tableId,canAdd,canEdit,canDelete,canRead")] Permission permission)
 {
     if (!HomeController.Authorized(this))
     {
         return(RedirectToAction("Login", "Accounts"));
     }
     if (ModelState.IsValid)
     {
         db.Entry(permission).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", new { @id = permission.groupId }));
     }
     return(View(permission));
 }