Esempio n. 1
0
        /// <summary>
        /// Copies this instance.
        /// </summary>
        /// <returns>A <see cref="Telerik.Windows.Controls.ScheduleView.IAppointment"/></returns>
        public IAppointment Copy()
        {
            IAppointment copy = new ClinicianAppointmentDto();

            copy.CopyFrom(this);
            return(copy);
        }
Esempio n. 2
0
        /// <summary>
        /// Handles the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>A <see cref="Agatha.Common.Response"/></returns>
        public override Response Handle(UpdateClinicianAppointmentRequest request)
        {
            var clinicianAppointmentDto = request.ClinicianAppointmentDto;
            var clinicianKey            = request.ClinicianKey;

            var visit = _visitRepository.GetByKey(clinicianAppointmentDto.Key);

            if (visit == null)
            {
                throw new ArgumentException(
                          "Could not find Visit Associated with ClinicianAppoitmentDto with key:" +
                          clinicianAppointmentDto.Key);
            }

            Staff newStaff = null;

            if (clinicianKey != visit.Staff.Key)
            {
                newStaff = _staffRepository.GetByKey(clinicianKey);
                if (newStaff == null)
                {
                    throw new ArgumentException("Could not find Staff with key:" + clinicianKey);
                }
            }

            if (visit.AppointmentDateTimeRange.StartDateTime != clinicianAppointmentDto.AppointmentStartDateTime ||
                visit.AppointmentDateTimeRange.EndDateTime != clinicianAppointmentDto.AppointmentEndDateTime)
            {
                visit.RescheduleAppointment(
                    new DateTimeRange(clinicianAppointmentDto.AppointmentStartDateTime, clinicianAppointmentDto.AppointmentEndDateTime));
            }

            if (newStaff != null)
            {
                visit.ReassignAppointment(newStaff);
            }

            clinicianAppointmentDto = new ClinicianAppointmentDto
            {
                Key                      = visit.Key,
                PatientKey               = visit.ClinicalCase.Patient.Key,
                PatientFirstName         = visit.ClinicalCase.Patient.Name.First,
                PatientLastName          = visit.ClinicalCase.Patient.Name.Last,
                AppointmentEndDateTime   = visit.AppointmentDateTimeRange.EndDateTime,
                AppointmentStartDateTime = visit.AppointmentDateTimeRange.StartDateTime,
                VisitStatus              = new LookupValueDto
                {
                    WellKnownName = visit.VisitStatus.WellKnownName,
                    Key           = visit.VisitStatus.Key,
                    Name          = visit.VisitStatus.Name
                },
                VisitTemplateName = visit.Name
            };

            var response = CreateTypedResponse();

            response.ClinicianAppointmentDto = clinicianAppointmentDto;

            return(response);
        }
Esempio n. 3
0
        /// <summary>
        /// Handles the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>A <see cref="Agatha.Common.Response"/></returns>
        public override Response Handle(DeleteClinicianAppointmentRequest request)
        {
            var clinicianKey = request.ClinicianKey;

            var visit = _visitRepository.GetByKey(clinicianKey);

            if (visit == null)
            {
                throw new ArgumentException("Could not find Visit Associated with ClinicianAppoitmentDto with key:" + clinicianKey);
            }

            ClinicianAppointmentDto clinicanAppointmentDto = null;

            if (visit.VisitStatus.WellKnownName.Equals(VisitStatus.Scheduled))
            {
                _visitFactory.DestroyVisit(visit);
            }
            else
            {
                clinicanAppointmentDto = new ClinicianAppointmentDto
                {
                    Key                      = visit.Key,
                    PatientKey               = visit.ClinicalCase.Patient.Key,
                    PatientFirstName         = visit.ClinicalCase.Patient.Name.First,
                    PatientLastName          = visit.ClinicalCase.Patient.Name.Last,
                    AppointmentEndDateTime   = visit.AppointmentDateTimeRange.EndDateTime,
                    AppointmentStartDateTime = visit.AppointmentDateTimeRange.StartDateTime,
                    VisitStatus              = new LookupValueDto
                    {
                        WellKnownName = visit.VisitStatus.WellKnownName,
                        Key           = visit.VisitStatus.Key,
                        Name          = visit.VisitStatus.Name
                    },
                    VisitTemplateName = visit.Name
                };

                var dataErrorInfo = new DataErrorInfo(
                    string.Format("Cannot remove an appointment with visit status as {0}.", visit.VisitStatus),
                    ErrorLevel.Error);
                clinicanAppointmentDto.AddDataErrorInfo(dataErrorInfo);
            }

            var response = CreateTypedResponse();

            response.ClinicianAppointmentDto = clinicanAppointmentDto;

            return(response);
        }
 private void ExecuteGoToPaymentCommand(ClinicianAppointmentDto clinicianAppointmentDto)
 {
     _navigationService.Navigate (
         RegionManager,
         "FrontDeskMainRegion",
         "BillingView",
         "MakePayment",
         new KeyValuePair<string, string> ( "PatientKey", clinicianAppointmentDto.PatientKey.ToString () ),
         new KeyValuePair<string, string> (
             "PatientFullName", string.Format ( "{0} {1}", clinicianAppointmentDto.PatientFirstName, clinicianAppointmentDto.PatientLastName ) ) );
 }
 private void ExecuteGoToPatientProfileCommand ( ClinicianAppointmentDto clinicianAppointmentDto )
 {
     _navigationService.Navigate (
         "WorkspacesRegion",
         "PatientWorkspaceView",
         "ViewPatient",
         new[]
             {
                 new KeyValuePair<string, string> ( "PatientKey", clinicianAppointmentDto.PatientKey.ToString () ),
                 new KeyValuePair<string, string> (
                     "FullName", clinicianAppointmentDto.PatientFirstName + " " + clinicianAppointmentDto.PatientLastName ),
                 new KeyValuePair<string, string> ( "SubViewName", "PatientEditorView" ),
             } );
 }
 private void ExecuteDoubleClickAppointmentCommand ( ClinicianAppointmentDto clinicianAppointmentDto )
 {
     _popupService.ShowPopup (
         "AppointmentDetailsView",
         "Edit",
         "Appointment Details",
         new[] { new KeyValuePair<string, string> ( "VisitKey", clinicianAppointmentDto.Key.ToString () ) } );
 }
 private void ExecuteAppointmentDeletedCommand ( ClinicianAppointmentDto clinicianAppointmentDto )
 {
     if ( clinicianAppointmentDto != null )
     { 
         _previousClinicanKey = clinicianAppointmentDto.ClinicianKey;
         DeleteClinicianAppointmentAsync ( clinicianAppointmentDto.Key );
     }
     else
     {
         _userDialogService.ShowDialog (
             "No Appointment was sent, couldn't delete appointment.",
             "Deleting Appointment Failed",
             UserDialogServiceOptions.Ok );
     }
 }
 /// <summary>
 /// Copies this instance.
 /// </summary>
 /// <returns>A <see cref="Telerik.Windows.Controls.ScheduleView.IAppointment"/></returns>
 public IAppointment Copy()
 {
     IAppointment copy = new ClinicianAppointmentDto ();
     copy.CopyFrom ( this );
     return copy;
 }
 private void RaiseVisitChanged ( ClinicianAppointmentDto clinicianAppointmentDto )
 {
     _eventAggregator.GetEvent<VisitChangedEvent> ().Publish (
         new VisitChangedEventArgs
             {
                 Sender = this,
                 ClinicianKey = ClinicianSchedule.ClinicianKey,
                 VisitKey = clinicianAppointmentDto.Key,
                 VisitStartDateTime = clinicianAppointmentDto.AppointmentStartDateTime,
                 PatientKey = clinicianAppointmentDto.PatientKey
             } );
 }
        /// <summary>
        /// Determines whether this instance [can execute appointment updated command] the specified clinician appointment dto.
        /// </summary>
        /// <param name="clinicianAppointmentDto">The clinician appointment dto.</param>
        /// <returns><c>true</c> if this instance [can execute appointment updated command] the specified clinician appointment dto; otherwise, <c>false</c>.</returns>
        public bool CanExecuteAppointmentUpdatedCommand ( ClinicianAppointmentDto clinicianAppointmentDto )
        {
            if ( clinicianAppointmentDto == null )
            {
                return false;
            }

            return IsScheduled ( clinicianAppointmentDto ) && clinicianAppointmentDto.ClinicianKey == ClinicianSchedule.ClinicianKey;
        }
        /// <summary>
        /// Determines whether this instance [can execute appointment deleted command] the specified clinician appointment dto.
        /// </summary>
        /// <param name="clinicianAppointmentDto">The clinician appointment dto.</param>
        /// <returns><c>true</c> if this instance [can execute appointment deleted command] the specified clinician appointment dto; otherwise, <c>false</c>.</returns>
        public bool CanExecuteAppointmentDeletedCommand ( ClinicianAppointmentDto clinicianAppointmentDto )
        {
            if ( clinicianAppointmentDto == null )
            {
                return false;
            }

            return IsScheduled ( clinicianAppointmentDto );
        }
 private void ExecuteDragStartingCommand( object obj )
 {
     var args = obj as DragDropQueryEventArgs;
     if ( args != null )
     {
         var result = args.Options.Payload as PatientSearchResultDto;
         if ( result != null )
         {
             var appointmentDto = new ClinicianAppointmentDto ();
             appointmentDto.PatientFirstName = result.FirstName;
             appointmentDto.PatientLastName = result.LastName;
             appointmentDto.PatientKey = result.Key;
             appointmentDto.AppointmentStartDateTime = DateTime.Now;
             appointmentDto.AppointmentEndDateTime = DateTime.Now.AddHours ( 1 );
             var payload = new ScheduleViewDragDropPayload ( null, new List<IOccurrence> { appointmentDto } );
             args.Options.Payload = payload;
         }
     }
 }
Esempio n. 13
0
 /// <summary>
 /// Causes the object to leave editing mode and commit the edited value.
 /// </summary>
 public void EndEdit()
 {
     _cacheObject = null;
 }
Esempio n. 14
0
 /// <summary>
 /// Causes the object to enter editing mode.
 /// </summary>
 public void BeginEdit()
 {
     _cacheObject = new ClinicianAppointmentDto();
     _cacheObject.CopyFrom(this);
 }
 /// <summary>
 /// Causes the object to leave editing mode and commit the edited value.
 /// </summary>
 public void EndEdit()
 {
     _cacheObject = null;
 }
        private void ExecuteStatusUpdatedCommand ( ClinicianAppointmentDto clinicianAppointmentDto )
        {
            var visitStatusUpdateDto = new VisitStatusUpdateDto
                {
                    VisitKey = clinicianAppointmentDto.Key,
                    VisitStatus = clinicianAppointmentDto.VisitStatus,
                    UpdateDateTime = DateTime.Now
                };

            var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher ();
            requestDispatcher.Add ( new UpdateVisitStatusRequest { VisitStatusUpdateDto = visitStatusUpdateDto } );
            IsLoading = true;
            requestDispatcher.ProcessRequests ( HandleUpdateVisitStatusCompleted, HandleUpdateVisitStatusException );

            RefreshView ( this, null );
        }
 private bool IsScheduled ( ClinicianAppointmentDto dto )
 {
     return dto != null
            &&
            ( dto.VisitStatus == null
              || dto.VisitStatus.WellKnownName.Equals ( VisitStatus.Scheduled, StringComparison.InvariantCultureIgnoreCase ) );
 }
 /// <summary>
 /// Determines whether this instance [can execute double click appointment command] the specified clinician appointment dto.
 /// </summary>
 /// <param name="clinicianAppointmentDto">The clinician appointment dto.</param>
 /// <returns><c>true</c> if this instance [can execute double click appointment command] the specified clinician appointment dto; otherwise, <c>false</c>.</returns>
 public bool CanExecuteDoubleClickAppointmentCommand ( ClinicianAppointmentDto clinicianAppointmentDto )
 {
     return ( clinicianAppointmentDto != null );
 }
 private void UpdateClinicianAppointmentAsync ( long clinicianKey, ClinicianAppointmentDto clinicianAppointmentDto )
 {
     var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher ();
     requestDispatcher.Add (
         new UpdateClinicianAppointmentRequest { ClinicianKey = clinicianKey, ClinicianAppointmentDto = clinicianAppointmentDto } );
     IsLoading = true;
     requestDispatcher.ProcessRequests ( HandleUpdateClinicianAppointmentCompleted, HandleUpdateClinicianAppointmentException );
 }
 /// <summary>
 /// Executes the appointment updated command.
 /// </summary>
 /// <param name="clinicianAppointmentDto">The clinician appointment dto.</param>
 public void ExecuteAppointmentUpdatedCommand ( ClinicianAppointmentDto clinicianAppointmentDto )
 {
     if ( clinicianAppointmentDto != null )
     {
         UpdateClinicianAppointmentAsync ( ClinicianSchedule.ClinicianKey, clinicianAppointmentDto );
     }
     else
     {
         _userDialogService.ShowDialog (
             "No Appointment was sent, couldn't update appointment.",
             "Updating Appointment Failed",
             UserDialogServiceOptions.Ok );
     }
 }
        private void ExecuteAppointmentAddedCommand ( ClinicianAppointmentDto clinicianAppointmentDto )
        {
            if ( clinicianAppointmentDto.Key != 0 )
            {
                _previousClinicanKey = clinicianAppointmentDto.ClinicianKey;
                UpdateClinicianAppointmentAsync ( ClinicianSchedule.ClinicianKey, clinicianAppointmentDto );

                _eventAggregator.GetEvent<AppointmentCreatedEvent> ().Publish (
                    new AppointmentCreatedEventArgs
                        {
                            AppointmentKey =
                                clinicianAppointmentDto.Key,
                            ClinicianKey =
                                ClinicianSchedule.ClinicianKey,
                            EndDateTime =
                                clinicianAppointmentDto.AppointmentEndDateTime,
                            PatientKey =
                                clinicianAppointmentDto.PatientKey,
                            StartDateTime =
                                clinicianAppointmentDto.AppointmentStartDateTime
                        } );
            }
            else
            {
                //TODO: fix this to somehow be based off of how timeslots are setup
                var startTime = new DateTime (
                    clinicianAppointmentDto.Start.Year,
                    clinicianAppointmentDto.Start.Month,
                    clinicianAppointmentDto.Start.Day,
                    clinicianAppointmentDto.AppointmentStartDateTime.Hour,
                    0,
                    0 );
                var parameters = new List<KeyValuePair<string, string>>
                    {
                        new KeyValuePair<string, string> ( "PatientKey", clinicianAppointmentDto.PatientKey.ToString () ),
                        new KeyValuePair<string, string> ( "PatientFirstName", clinicianAppointmentDto.PatientFirstName ),
                        new KeyValuePair<string, string> ( "PatientLastName", clinicianAppointmentDto.PatientLastName ),
                        new KeyValuePair<string, string> ( "StartDateTime", startTime.ToString () ),
                        new KeyValuePair<string, string> ( "EndTime", startTime.AddMinutes ( 59 ).ToString () ),
                        new KeyValuePair<string, string> ( "ClinicianKey", ClinicianSchedule.ClinicianKey.ToString () ),
                        new KeyValuePair<string, string> ( "ShouldReload", false.ToString () )
                    };
                if ( clinicianAppointmentDto.VisitTemplateKey.HasValue )
                {
                    parameters.Add (
                        new KeyValuePair<string, string> ( "VisitTemplateKey", clinicianAppointmentDto.VisitTemplateKey.Value.ToString () ) );
                }
                _navigationService.NavigateToActiveView ( "WorkspacesRegion", "CreateAppointment", parameters.ToArray () );
                ClinicianSchedule.ClinicianAppointments.Remove ( clinicianAppointmentDto );
            }
        }
 /// <summary>
 /// Causes the object to enter editing mode.
 /// </summary>
 public void BeginEdit()
 {
     _cacheObject = new ClinicianAppointmentDto ();
     _cacheObject.CopyFrom ( this );
 }