private void SavePatientDocumentAsync( PatientDocumentDto dto ) { var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher (); requestDispatcher.Add ( new SaveDtoRequest<PatientDocumentDto> { DataTransferObject = dto } ); requestDispatcher.ProcessRequests ( HandleSavePatientDocumentCompleted, HandleSavePatientDocumenException ); IsLoading = true; }
private void HandleErrors(PatientDocumentDto patientDocumentDto) { if (patientDocumentDto.HasErrors) { var errors = patientDocumentDto.GetErrors(null); var errorMessageSb = new StringBuilder(); foreach (DataErrorInfo dataErrorInfo in errors) { errorMessageSb.AppendLine(dataErrorInfo.ToString()); } errors = patientDocumentDto.GetErrors("ClinicalStartDate"); foreach (DataErrorInfo dataErrorInfo in errors) { errorMessageSb.AppendLine(dataErrorInfo.ToString()); } errors = patientDocumentDto.GetErrors("DocumentProviderName"); foreach (DataErrorInfo dataErrorInfo in errors) { errorMessageSb.AppendLine(dataErrorInfo.ToString()); } errors = patientDocumentDto.GetErrors("OtherDocumentTypeName"); foreach (DataErrorInfo dataErrorInfo in errors) { errorMessageSb.AppendLine(dataErrorInfo.ToString()); } var errorMessage = errorMessageSb.ToString(); if (!string.IsNullOrEmpty(errorMessage)) { _userDialogService.ShowDialog(errorMessage, "Save Patient Document", UserDialogServiceOptions.Ok); } } }
/// <summary> /// Navigates to default command. /// </summary> /// <param name="parameters">The parameters.</param> protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters ) { PatientDocumentDto = new PatientDocumentDto (); PatientDocumentDto.PatientKey = parameters.GetValue<long> ( "PatientKey" ); var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher (); requestDispatcher.AddLookupValuesRequest ( "PatientDocumentType" ); requestDispatcher.ProcessRequests ( HandleGetPatientDocumentTypeCompleted, HandleGetPatientDocumentTypeException ); }
private void ExecuteSaveNewDocument(PatientDocumentDto patientDocumentDto) { if (patientDocumentDto.Key == 0) { var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher(); if (patientDocumentDto is MailAttachmentPatientDocumentDto) { requestDispatcher.Add( new SaveDtoRequest<MailAttachmentPatientDocumentDto> { DataTransferObject = patientDocumentDto as MailAttachmentPatientDocumentDto }); IsLoading = true; requestDispatcher.ProcessRequests(HandleSaveMailAttachmentPatientDocumentCompleted, HandleSavePatientDocumentException); } else { requestDispatcher.Add(new SaveDtoRequest<PatientDocumentDto> { DataTransferObject = patientDocumentDto }); IsLoading = true; requestDispatcher.ProcessRequests(HandleSavePatientDocumentCompleted, HandleSavePatientDocumentException); } } }
private void ExecuteUpdateDocument( PatientDocumentDto patientDocumentDto ) { ActAfterCheckIfHavingUnsavedNewDocument ( () => { if ( patientDocumentDto.Key > 0 ) { var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher (); requestDispatcher.Add ( new SaveDtoRequest<PatientDocumentDto> { DataTransferObject = patientDocumentDto } ); IsLoading = true; requestDispatcher.ProcessRequests ( HandleSavePatientDocumentCompleted, HandleSavePatientDocumentException ); } } ); }
private void ExecuteOpenDocumentCommand( PatientDocumentDto patientDocumentDto ) { var relativePath = string.Format ( "../{0}?{1}={2}&{3}={4}", HttpHandlerPaths.PatientModuleHttpHandlerPath, HttpUtility.UrlEncode ( HttpHandlerQueryStrings.RequestName ), HttpUtility.UrlEncode ( HttpHandlerRequestNames.DownloadPatientDocument ), HttpUtility.UrlEncode ( HttpHandlerQueryStrings.PatientDocumentKey ), patientDocumentDto.Key ); var uri = new Uri ( Application.Current.Host.Source, relativePath ); HtmlPage.Window.Navigate ( uri, "_blank" ); }
private void ExecuteOpenEncryptedDocumentCommand( PatientDocumentDto patientDocumentDto ) { var u = new Uri ( Application.Current.Host.Source, "../DownloadEncryptedDocument.ashx?DocumentKey=" + patientDocumentDto.Key ); HtmlPage.Window.Navigate ( u, "_blank" ); }
private void ExecuteImportC32DocumentCommand(PatientDocumentDto patientDocumentDto) { ActAfterCheckIfHavingUnsavedNewDocument ( () => _popupService.ShowPopup ( "ImportC32View", "Default", "Import C32 Document", new[] { new KeyValuePair<string, string> ( "PatientDocumentKey", patientDocumentDto.Key.ToString ( CultureInfo.InvariantCulture ) ), new KeyValuePair<string, string> ( "PatientKey", patientDocumentDto.PatientKey.ToString ( CultureInfo.InvariantCulture ) ) }, true, () => ExecuteGoToDashboard ( patientDocumentDto.PatientKey ) ) ); }
private void ExecuteDeleteDocumentCommand( PatientDocumentDto patientDocumentDto ) { ActAfterCheckIfHavingUnsavedNewDocument ( () => { var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher (); IsLoading = true; requestDispatcher.Add ( new DeletePatientDocumentRequest { PatientDocumentKey = patientDocumentDto.Key } ); requestDispatcher.ProcessRequests ( HandleDeletePatientDocumentCompleted, HandleDeletePatientDocumentException ); } ); }
private void ExecuteCancelNewDocument(PatientDocumentDto patientDocumentDto) { PatientDocumentDtos.Remove ( patientDocumentDto ); }
private bool CanExecuteImportC32DocumnetCommand(PatientDocumentDto arg) { bool result = arg != null && ( arg.PatientDocumentType.WellKnownName == PatientDocumentType.C32 || arg.PatientDocumentType.WellKnownName == PatientDocumentType.XDM ) && !( arg.C32ImportedIndicator.HasValue && arg.C32ImportedIndicator.Value ) && _patientDocumentDtos.All ( p => p.Key > 0 ); return result; }
private bool CanExecuteDeleteDocumentCommand(PatientDocumentDto arg) { bool result = arg != null && !(arg.C32ImportedIndicator.HasValue && arg.C32ImportedIndicator.Value) && _patientDocumentDtos.All(p => p.Key > 0); return result; }