Example #1
0
 public List <AppointmentListViewModel> AppointmentList(int doctorId)
 {
     try {
         patientBusinessLayer     = new PatientBusinessLayer();
         appointmentListViewModel = new AppointmentListViewModel();
         List <Appointment> appointmentList = GetDoctorAppointments(doctorId);
         appointmentListViewModelList = new List <AppointmentListViewModel>();
         foreach (var appointment in appointmentList)
         {
             appointmentListViewModel             = new AppointmentListViewModel();
             appointmentListViewModel.Id          = appointment.Id;
             appointmentListViewModel.PatientId   = appointment.PatientId;
             appointmentListViewModel.PatientName = patientBusinessLayer.GetPatientNameById(appointment.PatientId);
             appointmentListViewModel.DoctorName  = GetDoctorNameById(appointment.DoctorId);
             appointmentListViewModel.Date        = appointment.Date.ToString().Split(' ')[0];
             if (appointment.Time == -1)
             {
                 appointmentListViewModel.Time = "---";
             }
             else
             {
                 appointmentListViewModel.Time = TimeSlots.Timings[appointment.Time];
             }
             appointmentListViewModel.Status = appointment.Status;
             appointmentListViewModelList.Add(appointmentListViewModel);
         }
         return(appointmentListViewModelList);
     }
     catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
Example #2
0
        public void SearchMine_ViewModel_RedirectToMineWithQueryAndPageNum()
        {
            //Arrange
            var viewModel = new AppointmentListViewModel()
            {
                SearchTerm = "test",
                PageNum    = 2
            };

            //Act
            var result = _controller.SearchMine(viewModel) as RedirectToRouteResult;

            //Assert
            result.Should().NotBeNull();
            result.RouteValues.Should().HaveCount(3);

            var routeValue = result.RouteValues["action"];

            routeValue.Should().Be("Mine");

            var routeValue1 = result.RouteValues["query"];

            routeValue1.Should().Be(viewModel.SearchTerm);

            var routeValue2 = result.RouteValues["pageNum"];

            routeValue2.Should().Be(viewModel.PageNum);
        }
Example #3
0
 public AppointmentController()
 {
     appointment = new Appointment();
     appointmentListViewModel = new AppointmentListViewModel();
     appointmentBusinessLayer = new AppointmentBusinessLayer();
     patientBusinessLayer     = new PatientBusinessLayer();
     doctorBusinessLayer      = new DoctorBusinessLayer();
 }
 public List <AppointmentListViewModel> GetAppointmentListView(int?id)
 {
     try
     {
         if (id == null)
         {
             id = -1;
         }
         List <Appointment> appointmentList = patientBusinessLayer.GetPatientAppointments((int)id);
         appointmentListViewModelList = new List <AppointmentListViewModel>();
         appointmentDataLayer         = new AppointmentDataLayer();
         foreach (var appointment in appointmentList)
         {
             MedicinesQuantity invoice = appointmentDataLayer.GetInvoiceByAppointmentId(appointment.Id);
             appointmentListViewModel             = new AppointmentListViewModel();
             appointmentListViewModel.Id          = appointment.Id;
             appointmentListViewModel.PatientName = patientBusinessLayer.GetPatientNameById(appointment.PatientId);
             appointmentListViewModel.DoctorName  = doctorBusinessLayer.GetDoctorNameById(appointment.DoctorId);
             appointmentListViewModel.Date        = appointment.Date.ToString().Split(' ')[0];
             if (appointment.Time == -1)
             {
                 appointmentListViewModel.Time = "---";
             }
             else
             {
                 appointmentListViewModel.Time = TimeSlots.Timings[appointment.Time];
             }
             appointmentListViewModel.Status = appointment.Status;
             if (invoice != null)
             {
                 appointmentListViewModel.showMedicineButton = false;
                 //appointmentListViewModelList.Add(appointmentListViewModel);
             }
             else if (invoice == null)
             {
                 appointmentListViewModel.showMedicineButton = true;
             }
             appointmentListViewModelList.Add(appointmentListViewModel);
         }
         return(appointmentListViewModelList);
     }catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
Example #5
0
        public ActionResult Mine(string query = null, int pageNum = 0)
        {
            var appointments = _appointmentService
                               .GetAppointmentsPaged(User.Identity.GetUserId(), pageNum, out int totalPages, query);

            var viewModel = new AppointmentListViewModel()
            {
                Appointments = Mapper.Map <IEnumerable <AppointmentViewModel> >(appointments),
                SearchTerm   = query,
                PageNum      = pageNum,
                TotalPages   = totalPages,
                Controller   = "Appointment",
                Action       = "Mine"
            };

            return(View(viewModel));
        }
Example #6
0
        public async Task <IActionResult> AppointmentList(string code, DateTime pDate)
        {
            if (pDate >= DateTime.Today)
            {
                Room room = await roomRepository.Rooms.FirstOrDefaultAsync(r => r.RoomCode == code);

                room.Schedule.Appointments = room.Schedule.GetAppointmentsInDate(pDate);


                var pagination = new RoomPagination
                {
                    CurrentDate   = pDate,
                    RoomCode      = code,
                    Action        = "AppointmentList",
                    Controller    = "Appointment",
                    AllowPrevious = pDate > DateTime.Today ? true : false
                };

                var appointmentListModel = new AppointmentListViewModel
                {
                    Room           = room,
                    Date           = pDate.Date + DateTime.Now.TimeOfDay,
                    RoomPagination = pagination,
                    BtnNew         = new BtnNewAppViewModel
                    {
                        RoomCode = room.RoomCode,
                        Message  = "Free Time"
                    }
                };

                if (room.Schedule.Appointments.Count > 0 &&
                    room.Schedule.Appointments.Any(a => a.Start > DateTime.Now))
                {
                    appointmentListModel.ResponsiveTable = "table-responsive-sm";
                }

                return(View(appointmentListModel));
            }

            return(RedirectToAction(nameof(Room), nameof(Room), new { code = code, pDate = pDate.ToString("MM-dd-yyyy") }));
        }
Example #7
0
        public ActionResult Edit(AppointmentListViewModel appointmentListViewModel)
        {
            int isAppointmentEdited = appointmentBusinessLayer.EditAppointment(appointmentListViewModel, (int)Session["Role"]);

            if (isAppointmentEdited != 0)
            {
                if ((int)Session["Role"] == 1)
                {
                    Logging.loggInfo($"Appointment  status id updated for appointment id { appointmentListViewModel.Id} having  patient id {appointmentListViewModel.PatientId} by Doctor as {appointmentListViewModel.Status}");
                    return(Redirect("/Doctors/Details/" + isAppointmentEdited.ToString()));
                }
                else if ((int)Session["Role"] == 3)
                {
                    Logging.loggInfo($"Appointment  status id updated for appointment id { appointmentListViewModel.Id} having  patient id {appointmentListViewModel.PatientId} by Patient as {appointmentListViewModel.Status}");
                    return(RedirectToAction("/Appointmentlist/" + (int)Session["userid"]));
                }
                return(new HttpNotFoundResult());
            }
            else
            {
                return(new HttpNotFoundResult());
            }
        }
 public int EditAppointment(AppointmentListViewModel appointmentListViewModel, int Role)
 {
     try
     {
         appointmentBusinessLayer = new AppointmentBusinessLayer();
         patientBusinessLayer     = new PatientBusinessLayer();
         appointment = appointmentBusinessLayer.GetAppointmentById(appointmentListViewModel.Id);
         if (Role == 1)
         {
             appointment.Status = appointmentListViewModel.Status;
             appointment        = patientBusinessLayer.UpdateAppointment(appointment);
         }
         else if (Role == 3)
         {
             appointment.Status = (appointmentListViewModel.isCancelled) ? AppointmentStatus.Cancelled : AppointmentStatus.Pending;
             appointment        = patientBusinessLayer.UpdateAppointment(appointment);
         }
         return(appointment.DoctorId);
     }catch (Exception e)
     {
         Database.ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
Example #9
0
        public ActionResult AppointmentList(string search, int?pageNo)
        {
            AppointmentListViewModel model = new AppointmentListViewModel();

            //model.SearchItem = search;

            model.PageNo = pageNo.HasValue ? pageNo.Value > 0 ? pageNo.Value : 1 : 1;

            // var totalRecords = DispensariesServices.Instance.GetDispensaryCount(search);

            model.AppointmentLists = AppoinmentListsServices.Instance.GetAppiontmentLists(model.PageNo);

            //model.Products = ProductsServices.Instance.GetProducts(search, pageNo.Value, 6);

            //model.Pager = new Pager(totalRecords, pageNo, 6);

            if (!string.IsNullOrEmpty(search))
            {
                model.SearchItem       = search;
                model.AppointmentLists = model.AppointmentLists.Where(p => p.Name != null && p.Name.Contains(search)).ToList();
            }

            return(PartialView(model));
        }
Example #10
0
 public ActionResult SearchMine(AppointmentListViewModel viewModel)
 {
     return(RedirectToAction("Mine", new { query = viewModel.SearchTerm, pageNum = viewModel.PageNum }));
 }
Example #11
0
 public AppointmentListPage()
 {
     InitializeComponent();
     BindingContext = viewModel = new AppointmentListViewModel();
 }