Exemple #1
0
        public ActionResult PopulateTimeSlots(TimeSlotViewModel model)//int id)
        {
            DateTime date = DateTime.Now;

            if (Session["userId"] == null)
            {
                return(Redirect("~"));
            }
            DoctorScheduleViewModel  doctorScheduleViewModel  = new DoctorScheduleViewModel();
            DoctorScheduleManagement doctorScheduleManagement = new DoctorScheduleManagement();

            doctorScheduleViewModel.From           = doctorScheduleManagement.GetTimeSlots();
            doctorScheduleViewModel.SelectedFromId = model.SelectedSlot;
            if (model.SelectedSlot == 0)
            {
                doctorScheduleViewModel.PreviousFromScheduleTime = doctorScheduleManagement.GetExistingFromSchedule((int)Session["userId"], model.Date);
                doctorScheduleViewModel.PreviousToScheduleTime   = null;
            }
            else
            {
                doctorScheduleViewModel.PreviousFromScheduleTime = null;
                doctorScheduleViewModel.PreviousToScheduleTime   = doctorScheduleManagement.GetExistingToSchedule((int)Session["userId"], model.Date);
            }
            return(View(doctorScheduleViewModel));
        }
Exemple #2
0
        public ActionResult DoctorSchedule()
        {
            var doctorsIDsNames = GetNamesOfDoctors();
            var schedules       = GetSchedules(doctorsIDsNames.First().Key);

            var model = new DoctorScheduleViewModel
            {
                NamesOfDoctors = doctorsIDsNames,
                Schedules      = schedules
            };

            return(View(model));
        }
Exemple #3
0
        public ActionResult DoctorSchedule()
        {
            if (Session["userId"] == null)
            {
                return(Redirect("~"));
            }
            DoctorScheduleViewModel doctorSchedule = new DoctorScheduleViewModel();
            AppointmentTime         time           = new AppointmentTime();

            time.Id   = 0;
            time.Time = "";
            doctorSchedule.From.Add(time);
            return(View(doctorSchedule));
        }
Exemple #4
0
        public async Task <IActionResult> DailySchedule(DateTime date)
        {
            var currentUser = await this.userManager.GetUserAsync(HttpContext.User);

            var appointments = await this.bookingService.DoctorAppointmentsByDateAsync(currentUser.Id, date);

            var model = new DoctorScheduleViewModel
            {
                Date         = date,
                Appointments = appointments
            };

            return(View(model));
        }
Exemple #5
0
        public ActionResult DoctorScheduleSet(DoctorScheduleViewModel model)
        {
            if (Session["userId"] == null)
            {
                return(Redirect("~"));
            }
            model.DoctorId = (int)Session["userId"];
            model.ToAvailabilityList();
            DoctorScheduleManagement doctorSchedule = new DoctorScheduleManagement();

            if (doctorSchedule.MarkAvailability(model.AvailabilityList))
            {
                return(Json(Url.Action("Index", "Home")));
            }
            return(Json(Url.Action("DoctorSchedule", "Home")));
        }
Exemple #6
0
        public ActionResult PopulateToTimeSlots(TimeSlotViewModel model)
        {
            DoctorScheduleViewModel  doctorScheduleViewModel  = new DoctorScheduleViewModel();
            DoctorScheduleManagement doctorScheduleManagement = new DoctorScheduleManagement();

            doctorScheduleViewModel.From = doctorScheduleManagement.GetTimeSlots();
            doctorScheduleViewModel.PreviousToScheduleTime   = doctorScheduleManagement.GetExistingToSchedule((int)Session["userId"], model.Date);
            doctorScheduleViewModel.PreviousFromScheduleTime = doctorScheduleManagement.GetExistingFromSchedule((int)Session["userId"], model.Date);
            if (doctorScheduleViewModel.PreviousToScheduleTime != null)
            {
                return(View(doctorScheduleViewModel));
            }
            else
            {
                return(null);
            }
        }
Exemple #7
0
        // Show the schedule of a doctor.
        public ActionResult DoctorSchedule(int doctorId)
        {
            Doctor                  doctor = _doctorRepository.GetDoctor(doctorId);
            List <Appointment>      appointmentsForDoctor   = _schedulingService.ViewDoctorSchedule(doctorId);
            DoctorScheduleViewModel doctorScheduleViewModel = new DoctorScheduleViewModel {
                Doctor = doctor, SingleAppointmentDoctorViewModels = new List <SingleAppointmentDoctorViewModel>()
            };

            foreach (Appointment appointment in appointmentsForDoctor)
            {
                SingleAppointmentDoctorViewModel singleAppointment = new SingleAppointmentDoctorViewModel();
                singleAppointment.SPatient     = _schedulingService.GetPatientForAppointment(appointment.AppointmentId);
                singleAppointment.SAppointment = _appointmentRepository.GetAppointment(appointment.AppointmentId);
                doctorScheduleViewModel.SingleAppointmentDoctorViewModels.Add(singleAppointment);
            }
            return(View(doctorScheduleViewModel));
        }
        public async Task <IActionResult> Index(string sortParam, string searchField, string searchParam, int studentPage = 1, int PageSize = 3)
        {
            DoctorScheduleViewModel doctorScheduleVM = new DoctorScheduleViewModel()
            {
                DoctorSchedules = new List <Models.DoctorSchedule>()
            };

            if (searchField != null)
            {
                ViewBag.DropDownColor = "abc";
            }

            FillSearchField(searchField);

            doctorScheduleVM.DoctorSchedules = await db.DoctorSchedules.ToListAsync();

            if (searchParam != null)
            {
                if (searchField == "DoctorName")
                {
                    doctorScheduleVM.DoctorSchedules = (db.DoctorSchedules.Where(b => b.DoctorName.ToLower().Contains(searchParam.ToLower())).ToList());
                }
                else if (searchField == "DepartmentName")
                {
                    doctorScheduleVM.DoctorSchedules = (db.DoctorSchedules.Where(b => b.DepartmentName.ToLower().Contains(searchParam.ToLower())).ToList());
                }
            }


            StringBuilder param = new StringBuilder();

            param.Append("/DoctorSchedule?studentPage=:");


            param.Append("&searchField=");
            if (searchField != null)
            {
                param.Append(searchField);
            }

            param.Append("&sortParam=");
            if (sortParam != null)
            {
                param.Append(sortParam);
            }

            param.Append("&searchParam=");
            if (searchParam != null)
            {
                param.Append(searchParam);
            }

            if (PageSize <= 0)
            {
                PageSize = 3;
            }

            ViewBag.PageSize = PageSize;


            param.Append("&PageSize=");
            if (PageSize != 0)
            {
                param.Append(PageSize);
            }


            var count = doctorScheduleVM.DoctorSchedules.Count;

            if (count == 0)
            {
                studentPage = 0;
            }


            if (sortParam == "SortDec")
            {
                doctorScheduleVM.DoctorSchedules = doctorScheduleVM.DoctorSchedules.OrderByDescending(p => p.DoctorName)
                                                   .Skip((studentPage - 1) * PageSize)
                                                   .Take(PageSize).ToList();
                ViewBag.sortParamView = "SortDec";
            }
            else if (sortParam == "SortDecDept")
            {
                doctorScheduleVM.DoctorSchedules = doctorScheduleVM.DoctorSchedules.OrderByDescending(p => p.DepartmentName)
                                                   .Skip((studentPage - 1) * PageSize)
                                                   .Take(PageSize).ToList();
                ViewBag.sortParamView = "SortDecDept";
            }
            else if (sortParam == "SortAscDept")
            {
                doctorScheduleVM.DoctorSchedules = doctorScheduleVM.DoctorSchedules.OrderBy(p => p.DepartmentName)
                                                   .Skip((studentPage - 1) * PageSize)
                                                   .Take(PageSize).ToList();
                ViewBag.sortParamView = "SortAscDept";
            }

            else
            {
                doctorScheduleVM.DoctorSchedules = doctorScheduleVM.DoctorSchedules.OrderBy(p => p.DepartmentName)
                                                   .Skip((studentPage - 1) * PageSize)
                                                   .Take(PageSize).ToList();
                ViewBag.sortParamView = "SortAsc";
            }


            //doctorScheduleVM.DoctorSchedules = doctorScheduleVM.DoctorSchedules.OrderBy(p => p.DoctorName)
            //.Skip((studentPage - 1) * PageSize)
            //.Take(PageSize).ToList();
            ////ViewBag.sortParamView = "SortAsc";



            doctorScheduleVM.PagingInfo = new PagingInfo()
            {
                CurrentPage  = studentPage,
                ItemsPerPage = PageSize,
                TotalItems   = count,
                urlParam     = param.ToString(),
                //PagerSize = 5,
            };

            //if(country!=0)
            //{
            //    return View("Index");
            //}

            return(View(doctorScheduleVM));
        }
Exemple #9
0
 public IActionResult DailySchedule(DoctorScheduleViewModel model)
 => RedirectToAction(nameof(DailySchedule), model.Date);