예제 #1
0
        public ActionResult Edit(int id)
        {
            Consts.CheckIfLoggedIn(System.Web.HttpContext.Current);
            Visit visit = LoadMainDoctorDDLOptions(VisitFromId(id));

            visit.InitDateTime();
            return(View(visit));
        }
예제 #2
0
        public ActionResult Details(int id)
        {
            Consts.CheckIfLoggedIn(System.Web.HttpContext.Current);

            Patient p = PatientFromId(id);

            p = LoadAdmissionsList(p);
            return(View(p));
        }
예제 #3
0
        public ActionResult Create()
        {
            Consts.CheckIfLoggedIn(System.Web.HttpContext.Current);

            Patient patient = new Patient
            {
                DOB = DateTime.Now
            };

            return(View(LoadDDLOptions(patient)));
        }
예제 #4
0
 public ActionResult Index(string searchBy, string search)
 {
     Consts.CheckIfLoggedIn(System.Web.HttpContext.Current);
     if (searchBy == "Telephone")
     {
         return(View(ctx.Patients.Where(x => x.Telephone.Contains(search) || search == null).Include(x => x.Doctor)));
     }
     else
     {
         return(View(ctx.Patients.Where(x => x.Name.StartsWith(search) || search == null).Include(x => x.Doctor)));
     }
 }
예제 #5
0
        public ActionResult Create()
        {
            Consts.CheckIfLoggedIn(System.Web.HttpContext.Current);

            Visit visit = new Visit
            {
                DateAndTime = DateTime.Now
            };

            visit.InitDateTime();
            return(View(LoadDDLOptions(visit)));
        }
예제 #6
0
 public ActionResult DeleteConfirm(int id)
 {
     Consts.CheckIfLoggedIn(System.Web.HttpContext.Current);
     try
     {
         Patient patient = ctx.Patients.Single(x => x.Id == id);
         ctx.Patients.Remove(patient);
         ctx.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch (Exception e)
     {
         System.Diagnostics.Debug.WriteLine("Error deleting a patient: " + e.GetBaseException().ToString());
     }
     return(RedirectToAction("Index"));
 }
예제 #7
0
 public ActionResult DeleteConfirm(int id)
 {
     Consts.CheckIfLoggedIn(System.Web.HttpContext.Current);
     try
     {
         Doctor doctor = ctx.Doctors.Single(x => x.Id == id);
         ctx.Doctors.Remove(doctor);
         ctx.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch (Exception e)
     {
         //System.Data.SqlClient.SqlException: trying to delete a doctor referenced in a patient/visit
         System.Diagnostics.Debug.WriteLine("Error deleting a doctor: " + e.GetBaseException().ToString());
     }
     return(RedirectToAction("Index"));
 }
예제 #8
0
        public ActionResult Edit(Doctor doctor)
        {
            Consts.CheckIfLoggedIn(System.Web.HttpContext.Current);

            try
            {
                if (ModelState.IsValid)
                {
                    ctx.Entry(doctor).State = EntityState.Modified;
                    ctx.SaveChanges();
                }
                else
                {
                    return(Edit(doctor.Id));
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Error editing a doctor: " + e.GetBaseException().ToString());
            }
            return(RedirectToAction("Index"));
        }
예제 #9
0
        public ActionResult Create(Doctor doctor)
        {
            Consts.CheckIfLoggedIn(System.Web.HttpContext.Current);

            try
            {
                if (ModelState.IsValid)
                {
                    ctx.Doctors.Add(doctor);
                    ctx.SaveChanges();
                }
                else
                {
                    return(Create());
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Error creating a doctor: " + e.GetBaseException().ToString());
            }
            return(RedirectToAction("Index"));
        }
예제 #10
0
        public ActionResult Edit(int id)
        {
            Consts.CheckIfLoggedIn(System.Web.HttpContext.Current);

            return(ViewFromId(id));
        }
예제 #11
0
        public ActionResult Create()
        {
            Consts.CheckIfLoggedIn(System.Web.HttpContext.Current);

            return(View());
        }
예제 #12
0
        public ActionResult Delete(int id)
        {
            Consts.CheckIfLoggedIn(System.Web.HttpContext.Current);

            return(View(PatientFromId(id)));
        }