public void BookAppointment() { if (Timeslot == null) { Alert("No Avaliability.", "No appointments are avaliable today. Please book a reservation appointment to be seen on another day."); return; } int doctorID = int.Parse(Timeslot[0].ToString()); string timeslot = Timeslot[1].ToString(); if (PatientDBConverter.PatientHasAppointment(patientID)) { Alert("Appointment not booked", "You already have an appointment booked today. Please check your emails for notificaitons or speak to the receptionist."); MessengerInstance.Unregister(this); MessengerInstance.Send <string>("DecideHomeView"); return; } PatientDBConverter.BookAppointment(timeslot, doctorID, patientID, false); AppointmentLogic.ScheduleWalkInNotification(TimeSpan.Parse(timeslot), patientID); var dialog = new SuccessBoxViewModel("Appointment Booked.", //MOVE THIS "Appointment has been successfully booked. Please keep an eye on your emails for updates on when we can see you."); var result = _dialogService.OpenDialog(dialog); MessengerInstance.Unregister(this); MessengerInstance.Send <string>("DecideHomeView"); }
public IHttpActionResult GetAppointments(bool Canceled = false, bool Conflict = false) { AppointmentLogic appointmentLogic = new AppointmentLogic(); var appointments = appointmentLogic.GetAppointments(Canceled, Conflict); return(Ok(appointments)); }
public IActionResult Put(AppointmentPutBM inputs) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } else { AppointmentLogic aptLogic = new AppointmentLogic(_unitOfWork); try { if (aptLogic.Update(inputs.Id, inputs.PatientId, inputs.AppointmentTime, inputs.Notes) > 0) { return(Ok()); } else { return(NotFound()); } } catch (Exception ex) { return(BadRequest(ex)); } } }
public IActionResult Post(AppointmentPostBM inputs) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } else { AppointmentLogic aptLogic = new AppointmentLogic(_unitOfWork); Appointment apt; inputs.ConvertTo(out apt); try { Appointment result = aptLogic.Create(apt); if (result != null) { return(new JsonResult(result)); } else { return(NotFound()); } } catch (Exception ex) { return(BadRequest(ex)); } } }
public WalkInAppointmentViewModel() { _dialogService = new DialogBoxService(); Timeslot = AppointmentLogic.CalcWalkInTimeslot(); if (IsInDesignMode) { EstimatedTime = "2 Hours 45 Minutes"; } else { if (Timeslot == null) { EstimatedTime = "No Avaliable Time. Try booking a reservation."; } else { EstimatedTime = CalcWaitTime(); } } // When patientID message is received (from PatientDBConverter), set patient ID in VM. MessengerInstance.Register <double>(this, SetPatientID); BookAppointmentCommand = new RelayCommand(BookAppointment); }
public IHttpActionResult GetAppointmentsByPatientID(int PatientID) { AppointmentLogic appointmentLogic = new AppointmentLogic(); var appointments = appointmentLogic.GetAppointmentsByPatientID(PatientID); return(Ok(appointments)); }
private async void AppointmentsListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { var appointment = (AppointmentModel)e.SelectedItem; var patient = await PatientLogic.GetPatientAsync(General.UserId); var fullname = PatientLogic.GetFullName(patient.FirstName, patient.Surname); if (allAppointments.Any(a => a.PatientName == fullname && a.PatientID == patient.UserID)) { await DisplayAlert("Appointment", "You already have an appointment booked!", "Okay"); } else { var symptoms = await DisplayPromptAsync("Book Appointment", string.Format("{0}, {1}", appointment.AppointmentTime.ToLongDateString(), appointment.AppointmentTime.ToShortTimeString()), "Book", "Close", "Your symptoms ..."); if (string.IsNullOrEmpty(symptoms)) { } else { appointment.symtoms = symptoms; appointment.diagnosis = string.Empty; appointment.PatientModel = patient; appointment.PatientName = string.Format("{0} {1}", patient.FirstName, patient.Surname); appointment.PatientID = patient.UserID; await AppointmentLogic.UpdateCustomerAsync(appointment); } } }
private void StartAppointment() { DataTable CheckedInPatients = PatientDBConverter.GetCheckedInAppointments(); if (CheckedInPatients.Rows.Count == 0) { Alert("No avaliable appointments.", "No patients are checked in. There are no appointments avalaible to be seen."); return; } int averageDuration = AppointmentLogic.GetAverage(); int remainingShiftInMinutes = StaffDBConverter.GetRemainingShiftInMinutes(DoctorID); if (remainingShiftInMinutes < averageDuration) { if (Confirmation("Are you sure?", "There may not be enough time in your schedule to finish the next appointment. Are you sure you would like to proceed?") == "NO") { return; } } DataRow selectedAppointment = null; // check if any patients are waiting first. if (Convert.ToBoolean(CheckedInPatients.Rows[0]["isEmergency"]) == true) { selectedAppointment = CheckedInPatients.Rows[0]; } foreach (DataRow dr in CheckedInPatients.Rows) { if (selectedAppointment == null) { if (Convert.ToBoolean(dr["isReservation"]) == false) { selectedAppointment = dr; } else if (Convert.ToBoolean(dr["isReservation"]) == true && DoctorID.Equals(int.Parse(dr["AppointmentDoctorID"].ToString()))) { selectedAppointment = dr; } } else { TimeSpan selectedAppointmentTime = TimeSpan.Parse(selectedAppointment["AppointmentTime"].ToString()); TimeSpan drAppointmentTime = TimeSpan.Parse(dr["AppointmentTime"].ToString()); if (drAppointmentTime.Subtract(selectedAppointmentTime).TotalMinutes <= 10 && (Convert.ToBoolean(dr["isReservation"]) == false)) { selectedAppointment = dr; break; } } } PatientDBConverter.StartAppointment(selectedAppointment, DoctorID); MessengerInstance.Send <string>("DoctorAppointmentView"); }
public VolunteerController(QuestionLogic questionLogic, UserLogic userLogic, ReactionLogic reactionLogic, ChatLogic chatLogic, AppointmentLogic appointmentLogic) { _questionLogic = questionLogic; _userLogic = userLogic; _reactionLogic = reactionLogic; _chatLogic = chatLogic; _appointmentLogic = appointmentLogic; }
public WorkSheetModel(CarServiceDbContext context, IEmailSender emailSender) { _appUserLogic = new UserLogic(context); _appointmentLogic = new AppointmentLogic(context); _calendarLogic = new WorkSheetLogic(context); _workLogic = new WorkLogic(context); _emailLogic = new EmailLogic(context, emailSender); }
public CareRecipientController(QuestionLogic questionLogic, CategoryLogic categoryLogic, ReactionLogic reactionLogic, UserLogic userLogic, ChatLogic chatLogic, AppointmentLogic appointmentLogic) { _questionLogic = questionLogic; _categoryLogic = categoryLogic; _reactionLogic = reactionLogic; _userLogic = userLogic; _chatLogic = chatLogic; _appointmentLogic = appointmentLogic; }
private async void cancelBtn_Clicked(object sender, EventArgs e) { var date = current.AppointmentTime; await AppointmentLogic.CancelAppointmentAsync(current); await DisplayAlert("Appointment", string.Format("You cancelled your appointment on {0} at {1}", date.ToLongDateString(), date.ToShortTimeString()), "Okay"); OnAppearing(); }
public IHttpActionResult BookAppointment(BookAppointmentDTO BookAppointmentData) { AppointmentLogic appointmentLogic = new AppointmentLogic(); var AffectedRow = appointmentLogic.BookAppointment(BookAppointmentData.Appointment, BookAppointmentData.CurrentUserID); if (AffectedRow == 0 && !ModelState.IsValid) { BadRequest(); } return(Ok(AffectedRow)); }
public IHttpActionResult CancelAppointment([FromBody] CancelAppointmentDTO cancelAppointment) { AppointmentLogic appointmentLogic = new AppointmentLogic(); var AffectedRow = appointmentLogic.CancelAppointment(cancelAppointment.ID, cancelAppointment.CurrentUserID); if (AffectedRow == 0) { NotFound(); } return(Ok(AffectedRow)); }
public void Create_Appointment_Is_Called_Exactly_Once() { Mock <IAppointmentContext> mockContext = new Mock <IAppointmentContext>(); Appointment appointment = new Mock <Appointment>(1, 3, 2, DateTime.Today, DateTime.Today, "Test").Object; mockContext.Setup(x => x.CreateAppointment(appointment)); AppointmentLogic appointmentLogic = new AppointmentLogic(mockContext.Object); appointmentLogic.CreateAppointment(appointment); mockContext.Verify(x => x.CreateAppointment(appointment), Times.Exactly(1)); }
private void btMakeAppointment_Click(object sender, EventArgs e) { DateTime appointmentDateTime = dtpAppointment.Value; Appointment appointment = new Appointment(_questionID, _careRecipientID, _volunteerID, appointmentDateTime); AppointmentLogic AL = new AppointmentLogic(); AL.CreateAppointment(appointment); MessageBox.Show("Afspraak gemaakt."); ((MainForm)this.Parent.Parent).ReplaceForm(new FormVolunteerChatOverview()); }
public void EndAppointment() { TimeSpan timeNow = DateTime.Now.TimeOfDay; string startTimeString = ActiveAppointment[6].ToString(); TimeSpan startTime = TimeSpan.Parse(startTimeString.Insert(startTimeString.Length - 2, ":")); int appointmentDuration = (int)(timeNow - startTime).TotalMinutes; AppointmentLogic.EndAppointment(ActiveAppointment, appointmentDuration); MessengerInstance.Send <string>("DoctorHomeView"); return; }
public IActionResult Get(int id) { AppointmentLogic aptLogic = new AppointmentLogic(_unitOfWork); Appointment apt = aptLogic.ReadById(id); if (apt != null) { return(new JsonResult(apt)); } else { return(NotFound()); } }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } string[] elementsOfDate = Input.AppointmentDay.Split('-'); string[] elementsOfTime = Input.AppointmentTime.Split(':'); DateTime appointment = AppointmentLogic.CreateAppointmentDate(elementsOfDate, elementsOfTime); Work work = await AppointmentLogic.MakeAppointmentAsync(appointment, Input.CarId, SubTask, Input.Description); await _emailLogic.SendStatusChangeEmailAsync(work.WorkerUser, work); return(RedirectToPage("./BrowseSubTasks")); }
public IActionResult Delete(int id) { AppointmentLogic aptLogic = new AppointmentLogic(_unitOfWork); try { if (aptLogic.Delete(id) > 0) { return(Ok()); } else { return(NotFound()); } } catch (Exception ex) { return(BadRequest(ex)); } }
protected override async void OnAppearing() { base.OnAppearing(); var appointmentLogic = new AppointmentLogic(); await appointmentLogic.Init(); var patient = await PatientLogic.GetPatientAsync(General.UserId); if (appointmentLogic.AllAppointments.Any(a => a.PatientName == PatientLogic.GetFullName(patient.FirstName, patient.Surname) && !a.Complete && a.PatientID == patient.UserID)) { current = appointmentLogic.GetCurrentAppointment(patient, appointmentLogic.AllAppointments); titleLabel.IsVisible = false; loadingLabel.IsVisible = false; detailsFrame.IsVisible = true; dateSpan.Text = current.AppointmentTime.ToLongDateString() + ", "; timeSpan.Text = current.AppointmentTime.ToShortTimeString(); symptomsSpan.Text = current.symtoms; if (current.Confirmed) { statusSpan.TextColor = Color.Green; statusSpan.Text = "confirmed"; } else { statusSpan.TextColor = Color.Red; statusSpan.Text = "Pending"; } } else { titleLabel.IsVisible = true; titleLabel.Text = "You don't have an appointment booked."; titleLabel.HorizontalTextAlignment = TextAlignment.Center; loadingLabel.IsVisible = false; detailsFrame.IsVisible = false; } }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } ClientUser clientUser = await UserLogic.GetUserAsync(User); SubTask = await AppointmentLogic.GetSubTaskByIdAsync(id.Value); if (SubTask == null) { return(NotFound()); } Opening = AppointmentLogic.GetOpening(SubTask.CompanyUser.Opening); FinalOpening = await AppointmentLogic.GetFinalOpeningAsync(SubTask); Cars = await AppointmentLogic.GetCarsByIdAsync(clientUser.Id); return(Page()); }
protected override async void OnAppearing() { base.OnAppearing(); try { var appointmentLogic = new AppointmentLogic(); await appointmentLogic.Init(); allAppointments = appointmentLogic.AllAppointments; availableAppointments = appointmentLogic.AvailableAppointments; } catch (Exception e) { throw e; } General.AllAppointments = allAppointments; General.AvailableAppointments = availableAppointments; appointmentsListView.ItemsSource = availableAppointments; appointmentsListView.Refreshing += AppointmentsListView_Refreshing; //appointmentsListView.ItemSelected += AppointmentsListView_ItemSelected; }
public MakeAppointmentModel(CarServiceDbContext context, IEmailSender emailSender) { _appUserManager = new UserLogic(context); _appointmentManager = new AppointmentLogic(context); _emailLogic = new EmailLogic(context, emailSender); }
public IEnumerable <Appointment> Get() { AppointmentLogic aptLogic = new AppointmentLogic(_unitOfWork); return(aptLogic.ReadAll()); }