Пример #1
0
        public ActionResult GetAppointmentsVacantByJson()
        {
            if (!Authorize())
            {
                return(RedirectToAction("RedirectByUser", "Home"));
            }
            AppointmentDal     appDal       = new AppointmentDal();
            List <Appointment> appointments = (from app in appDal.Appointments
                                               where app.PatientUserName == null && DateTime.Compare(DateTime.Now, app.Date) < 0
                                               select app).ToList <Appointment>();

            Thread.Sleep(1000);
            return(Json(appointments, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public ActionResult AppointmentScheduling()
        {
            if (!Authorize())
            {
                return(RedirectToAction("RedirectByUser", "Home"));
            }
            AppointmentViewModel AppVM  = new AppointmentViewModel();
            AppointmentDal       appDal = new AppointmentDal();

            AppVM.Appointments = (from app in appDal.Appointments
                                  where app.PatientUserName == null && DateTime.Compare(DateTime.Now, app.Date) < 0
                                  select app).ToList <Appointment>();

            return(View(AppVM));
        }
Пример #3
0
        public ActionResult YourAppointments()
        {
            if (!Authorize())
            {
                return(RedirectToAction("RedirectByUser", "Home"));
            }
            User curr = (User)Session["CurrentUser"];
            AppointmentViewModel AppVM  = new AppointmentViewModel();
            AppointmentDal       appDal = new AppointmentDal();

            AppVM.Appointments = (from app in appDal.Appointments
                                  where app.PatientUserName == curr.UserName && DateTime.Compare(DateTime.Now, app.Date) < 0
                                  select app).ToList <Appointment>();

            return(View(AppVM));
        }
Пример #4
0
        public ActionResult GetYourAppointmentssByJson()
        {
            if (!Authorize())
            {
                return(RedirectToAction("RedirectByUser", "Home"));
            }
            User               currentUser    = (User)Session["CurrentUser"];
            AppointmentDal     appDal         = new AppointmentDal();
            PatientDal         pdal           = new PatientDal();
            Patient            currentPatient = pdal.Patients.FirstOrDefault <Patient>(x => x.UserName == currentUser.UserName);
            List <Appointment> appointments   = (from app in appDal.Appointments
                                                 where app.PatientUserName == currentPatient.UserName && DateTime.Compare(DateTime.Now, app.Date) < 0
                                                 select app).ToList <Appointment>();

            Thread.Sleep(1000);
            return(Json(appointments, JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        public ActionResult CancelAppointment(string DoctorName, DateTime date)
        {
            if (!Authorize())
            {
                return(RedirectToAction("RedirectByUser", "Home"));
            }
            Appointment chosen = new Appointment {
                DoctorName = DoctorName, Date = date
            };
            AppointmentDal appDal = new AppointmentDal();
            Appointment    update = appDal.Appointments.FirstOrDefault <Appointment>(x => x.Date == chosen.Date && x.DoctorName == chosen.DoctorName);

            update.PatientUserName = null;
            appDal.SaveChanges();
            DoctorDal dctDal = new DoctorDal();

            return(View("PatientPage"));
        }
Пример #6
0
        public ActionResult ChooseAppointment(string DoctorName, DateTime date)
        {
            if (!Authorize())
            {
                return(RedirectToAction("RedirectByUser", "Home"));
            }
            Appointment chosen = new Appointment {
                DoctorName = DoctorName, Date = date
            };
            PatientDal     pdal           = new PatientDal();
            User           currentUser    = (User)Session["CurrentUser"];
            Patient        currentPatient = pdal.Patients.FirstOrDefault <Patient>(x => x.UserName == currentUser.UserName);
            AppointmentDal appDal         = new AppointmentDal();
            Appointment    update         = appDal.Appointments.FirstOrDefault <Appointment>(x => x.Date == chosen.Date && x.DoctorName == chosen.DoctorName);

            update.PatientUserName = currentPatient.UserName;
            appDal.SaveChanges();
            return(View("PatientPage"));
        }