private void ExecuteEditProgramEnrollmentCommand( ProgramEnrollmentDto programEnrollmentDto )
 {
     _popupService.ShowPopup (
         "EditProgramEnrollmentView",
         "Edit",
         "Program Enrollment",
         new[] { new KeyValuePair<string, string> ( "ProgramEnrollmentKey", programEnrollmentDto.Key.ToString () ) },
         false,
         PopupClosed );
 }
 private bool CanExecuteDeleteProgramEnrollment( ProgramEnrollmentDto arg )
 {
     // TODO: may need some business rule check in the future
     return true;
 }
        private void ExecuteDeleteProgramEnrollment( ProgramEnrollmentDto programEnrollmentDto )
        {
            var result = _userDialogService.ShowDialog (
                "Are you sure you want to delete?", "Confirmation", UserDialogServiceOptions.OkCancel );

            if ( result == UserDialogServiceResult.Ok )
            {
                DeleteProgramEnrollment ( programEnrollmentDto.Key );
            }
        }
        private void InitializeAvailableSelectionList( ProgramEnrollmentDto dto )
        {
            if ( dto != null )
            {
                var request = new GetAvailableEnrollingStaffsRequest { ProgramOfferingKey = dto.ProgramOfferingKey };

                var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher ();
                requestDispatcher.Add ( request );

                IsLoading = true;
                requestDispatcher.ProcessRequests (
                    HandleInitializeAvailableSelectionListCompleted, HandleInitializeAvailableSelectionListException );
            }
            else
            {
                AvailableEnrollingStaffs = new List<StaffNameDto> ();
            }
        }
 private void RaiseProgramEnrollmentChangedEvent( ProgramEnrollmentDto dto )
 {
     _eventAggregator
         .GetEvent<ProgramEnrollmentChangedEvent> ()
         .Publish ( new ProgramEnrollmentChangedEventArgs { Sender = this, ProgramEnrollmentKey = dto.Key } );
 }
 private void EditProgramEnrollment( ProgramEnrollmentDto dto )
 {
     var request = new ReviseProgramEnrollmentRequest
         {
             ProgramEnrollmentKey = dto.Key,
             EnrollingStaffKey = SelectedEnrollingStaff != null ? SelectedEnrollingStaff.Key : 0,
             EnrollmentDate = dto.EnrollmentDate,
             DaysOnWaitingListCount = dto.DaysOnWaitingListCount,
             CommentsNote = dto.CommentsNote
         };
     var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher ();
     requestDispatcher.Add ( request );
     IsLoading = true;
     requestDispatcher.ProcessRequests ( HandleReviseProgramEnrollmentCompleted, HandleReviseProgramEnrollmentException );
 }
 private void ExecuteEditProgramEnrollment( ProgramEnrollmentDto programEnrollmentDto )
 {
     EditProgramEnrollment ( ProgramEnrollment );
 }
        private void HandleRequestComplete( ReceivedResponses receivedResponses )
        {
            var staffDtoResponse = receivedResponses.Get<DtoResponse<StaffSummaryDto>> ();
            var availableProgramDtosResponse = receivedResponses.Get<GetAvailableProgramsResponse> ();

            ProgramEnrollment = new ProgramEnrollmentDto
                {
                    ClinicalCaseKey = _clinicalCaseKey,
                    EnrollmentDate = DateTime.Now,
                    EnrollingStaff = staffDtoResponse.DataTransferObject
                };

            AvailablePrograms = availableProgramDtosResponse.ProgramDisplayNames;
            AvailableProgramOfferingLocations = new List<ProgramOfferingLocationDto> ();
            AvailableEnrollingStaffs = new List<StaffNameDto> ();

            IsLoading = false;
        }
 private void ExecuteCreateProgramEnrollment( ProgramEnrollmentDto programEnrollmentDto )
 {
     CreateProgramEnrollment ( ProgramEnrollment );
 }
 private void CreateProgramEnrollment( ProgramEnrollmentDto dto )
 {
     var request = new CreateProgramEnrollmentRequest
         {
             ClinicalCaseKey = _clinicalCaseKey,
             ProgramOfferingKey = SelectedProgramOfferingLocation != null ? SelectedProgramOfferingLocation.Key : 0,
             EnrollingStaffKey = SelectedEnrollingStaff != null ? SelectedEnrollingStaff.Key : 0,
             EnrollmentDate = dto.EnrollmentDate,
             DaysOnWaitingListCount = dto.DaysOnWaitingListCount,
             CommentsNote = dto.CommentsNote
         };
     var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher ();
     requestDispatcher.Add ( request );
     IsLoading = true;
     requestDispatcher.ProcessRequests ( HandleCreateProgramEnrollmentCompleted, HandleCreateProgramEnrollmentException );
 }
 private void ExecuteDisenrollProgramEnrollment( ProgramEnrollmentDto programEnrollmentDto )
 {
     DisenrollProgramEnrollment ( ProgramEnrollment );
 }
 private void DisenrollProgramEnrollment( ProgramEnrollmentDto dto )
 {
     var request = new DisenrollProgramEnrollmentRequest
         {
             ProgramEnrollmentKey = dto.Key,
             DisenrollmentDate = dto.DisenrollmentDate,
             DisenrollReasonKey = dto.DisenrollReason != null ? dto.DisenrollReason.Key : 0,
             DisenrollOtherReasonNote = dto.DisenrollOtherReasonNote
         };
     var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher ();
     requestDispatcher.Add ( request );
     IsLoading = true;
     requestDispatcher.ProcessRequests ( HandleDisenrollProgramEnrollmentCompleted, HandleDisenrollProgramEnrollmentException );
 }