public ActionResult Login(UserVM doc) // recieves the doctor's viewmodel
        {
            if (ModelState.IsValid)
            {
                DoctorsBL dbl = new DoctorsBL(context);
                if (dbl.doctorExists(doc))
                {
                    if (dbl.verifyDoctor(doc))
                    {
                        FormsAuthentication.SetAuthCookie(doc.userName, false);
                        dbl.setOnline(doc.userName);

                        return(View("DoctorDash"));
                    }
                    else
                    {
                        ViewBag.WrongPW = true;
                        return(View("~/Areas/Global/Views/Home/Home.cshtml"));
                    }
                }

                ViewBag.NoUser = true;

                return(View("~/Areas/Global/Views/Home/Home.cshtml"));
            }
            else
            {
                return(View("~/Areas/Global/Views/Home/Home.cshtml"));
            }
        }
        public ActionResult AddPatient([Bind(Include = "FirstName,LastName,Email,ContactNo")] PatientVM pvm)
        {
            PatientsBL pbl = new PatientsBL(context);
            DoctorsBL  dbl = new DoctorsBL(context);


            if (!ModelState.IsValid)
            {
                ViewBag.error = true;
                return(PartialView("~/Areas/Doctors/Views/Partials/AddPatientPartial.cshtml", pvm));
            }
            else
            {
                //Patient newPatient = pvm.mapPatientDataFromVM();
                Patient p = new Patient();
                p.Email        = pvm.Email;
                p.PatientSince = DateTime.Now;
                p.FirstName    = pvm.FirstName;
                p.LastName     = pvm.LastName;
                p.Contact      = pvm.ContactNo;
                p.Doctor       = dbl.getByUN(User.Identity.Name);
                p.Supervisor   = dbl.getByUN(User.Identity.Name).DocID;

                pbl.insertPatient(p);
                ViewBag.dataSaved = true;


                return(PartialView("~/Areas/Doctors/Views/Partials/AddPatientPartial.cshtml", pvm));
            }
        }
        public JsonResult getDocInfo()
        {
            DoctorsBL dbl         = new DoctorsBL(context);
            var       doclist     = dbl.getAll();
            var       docCardList = (IEnumerable <DocCardInfoVM>)dbl.getDocCardList(doclist);

            return(Json(docCardList, JsonRequestBehavior.AllowGet));
        }
        public ActionResult SignOut()
        {
            DoctorsBL  dbl                   = new DoctorsBL(context);
            HttpCookie authCookie            = Request.Cookies[FormsAuthentication.FormsCookieName];
            FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);

            dbl.setOffline(ticket.Name);

            FormsAuthentication.SignOut();
            return(RedirectToAction("Index", "Home", new { area = "Global" }));
        }
 public ActionResult Edit_Doctor(Doctors ob)
 {
     if (ModelState.IsValid)
     {
         DoctorsBL.Update(ob);
         return(RedirectToAction("Doctors"));
     }
     else
     {
         return(View());
     }
 }
Exemplo n.º 6
0
        // GET: Doctors/Profile
        public ActionResult Index()
        {
            DoctorsBL dbl         = new DoctorsBL(context);
            Doctor    loggedInDoc = dbl.getByUN(User.Identity.Name);

            ViewBag.doctor = loggedInDoc;
            DocProfileVM profVM = dbl.docProfVMfromDoc(loggedInDoc);

            ViewBag.profile = profVM;

            return(View("ProfileView"));
        }
        // GET: Doctors/PatientView
        public ActionResult Index(String searchString)
        {
            DoctorsBL  dbl         = new DoctorsBL(context);
            PatientsBL pbl         = new PatientsBL(context);
            Doctor     LoggedInDoc = dbl.getByUN(User.Identity.Name);
            //sorting desc by PatientSince Value
            List <Patient> patientsOfThisDoc = pbl.getPatientList(LoggedInDoc.DocID).OrderByDescending(o => o.PatientSince).OrderBy(o => o.FirstName).ToList();

            ViewBag.Stag = searchString;


            if (!String.IsNullOrEmpty(searchString))
            {
                patientsOfThisDoc = patientsOfThisDoc.Where(o => o.FirstName.ToLower().Contains(searchString.ToLower()) || o.LastName.ToLower().Contains(searchString.ToLower()) || o.Contact.ToLower().Contains(searchString.ToLower()) || o.Email.Contains(searchString.ToLower())).ToList();
            }

            return(View("PatientList", patientsOfThisDoc));
        }
        public ActionResult Register([Bind(Include = "DocID,Address,FirstName,LastName,UserName,DOB,Email,RegionID,Password")] Doctor doc)

        {
            DoctorsBL dbl = new DoctorsBL(context);
            RegionsBL rbl = new RegionsBL(context);

            doc.isOnline   = false;
            doc.isActive   = false;
            doc.TariffCode = String.Empty;

            if (ModelState.IsValid)
            {
                dbl.insertDoc(doc);
                ViewBag.RegSuccess = true;
                return(View("~/Areas/Global/Views/Home/Home.cshtml"));
            }

            ViewData["RegionID"] = rbl.getRegionList();
            return(View("Register"));
        }
        public ViewResult Edit_Doctor(int id)
        {
            var ob = DoctorsBL.GetById(id);

            return(View(ob));
        }
 public ActionResult EditActivation_doctor(int id, int StatusID)
 {
     DoctorsBL.EditActive(id, StatusID);
     return(RedirectToAction("Doctors"));
 }
 public ActionResult Doctors()
 {
     return(View(DoctorsBL.GetAll()));
 }