protected override async void OnAppearing() { base.OnAppearing(); #region get forms to be processed try { _processFormRecords = await ViewModel.ProcessFormsAsync(); } catch { await DisplayAlert("Sorry!", "Something went wrong", "OK"); } if (_processFormRecords != null) { if (_processFormRecords.Success) { if (_processFormRecords.URLs.Count > 0) { Domain.Models.RequestModels.ProcessPatientFormModel domainUser = new Domain.Models.RequestModels.ProcessPatientFormModel(); domainUser.Forms = Settings.GetFormsList(); _processFormRecordsPvt = _processFormRecords; listUrlPvt = new List <UrlPvt>(); int x = 0; foreach (var url in _processFormRecordsPvt.URLs) { UrlPvt pvtu = new UrlPvt(); pvtu.UrlName = url; pvtu.FormName = domainUser.Forms[x].Name; listUrlPvt.Add(pvtu); x = x + 1; } listForms.ItemsSource = listUrlPvt; //end } else { await DisplayAlert("eForms", MessageNoFormsFound, "OK"); } } else { await DisplayAlert("eForms", MessageNoFormsFound, "OK"); } } #endregion listForms.IsVisible = true; ac.IsVisible = false; stkFinal.IsVisible = true; }
/// <summary>Processes the forms asynchronous.</summary> /// <param name="processFormRequest">The process form request.</param> /// <returns></returns> public async Task <Domain.Models.ResponseModels.ProcessPatientFormModel> ProcessFormsAsync( Domain.Models.RequestModels.ProcessPatientFormModel processFormRequest) { Domain.Models.ResponseModels.ProcessPatientFormModel result = null; try { var client = new HttpClient(); client.BaseAddress = new Uri(Settings.GetBaseUrl()); var data = JsonConvert.SerializeObject(processFormRequest); var content = new StringContent(data, Encoding.UTF8, "application/json"); // Add the form(s) to the patient's list of forms. HttpResponseMessage response = await client.PostAsync(Settings.GetBaseUrl() + "/efr/patient/forms", content); result = JsonConvert.DeserializeObject <Domain.Models.ResponseModels.ProcessPatientFormModel>( response.Content.ReadAsStringAsync().Result); } catch (Exception erf) { Debug.Write(erf); } return(result); }
public async Task <Domain.Models.ResponseModels.ProcessPatientFormModel> ProcessFormsAsync() { Domain.Models.RequestModels.ProcessPatientFormModel domainUser = new Domain.Models.RequestModels.ProcessPatientFormModel(); SetBaseProperties(domainUser); domainUser.AccountNumber = Settings.GetAccountNumber(); domainUser.VisitId = Settings.GetVisitId(); domainUser.Forms = Settings.GetFormsList(); // Call REST service Domain.Models.ResponseModels.ProcessPatientFormModel res = await _authService.ProcessFormsAsync(domainUser); return(res); }
async void OnProcessButtonClicked(object sender, EventArgs e) { if (IsSearched && IsFormsSelected) { using (UserDialogs.Instance.Loading("Loading", null, null, true, MaskType.Black)) { try { Settings.SetFormsList(_listOfFormsToBeProcessed); ProcessFormRecords = await ViewModel.ProcessFormsAsync(); } catch { await DisplayAlert(Constants.ErrorMsgTitleOops, Constants.ErrorMsgSorry, "OK"); } try { if (ProcessFormRecords != null) { if (ProcessFormRecords.Success) { if (ProcessFormRecords.URLs.Count > 0) { Forms.item = ProcessFormRecords.URLs[0]; await Navigation.PushAsync(new Forms()); } else { await DisplayAlert("Process Forms", "Please select a form to proceed.", "OK"); } } else { await DisplayAlert("Process Forms", "No form available for submission related to the supplied identifier.", "OK"); } } } catch (Exception exNew) { Debug.Write("Process Forms Exception" + exNew); await DisplayAlert("Process Forms", "No Form Url Found", "OK"); } } } }
public async System.Threading.Tasks.Task <Domain.Models.ResponseModels.ProcessPatientFormModel> ProcessFormsAsync() { Domain.Models.RequestModels.ProcessPatientFormModel domainUser = new Domain.Models.RequestModels.ProcessPatientFormModel(); domainUser.ApplicationId = Settings.GetApplicationId(); domainUser.SerialNumber = Settings.GetSerialNumber(); domainUser.Version = Settings.GetVersion(); domainUser.AuthToken = Settings.GetAuthorizationToken(); domainUser.AccessToken = Settings.GetAccessToken(); domainUser.AccountNumber = Settings.GetAccountNumber().ToString(); domainUser.VisitID = Settings.GetVisitId(); domainUser.Forms = Settings.GetFormsList(); // TODO: Call the REST Service for authentication Domain.Models.ResponseModels.ProcessPatientFormModel res = await _authService.ProcessFormsAsync(domainUser); return(res); }
async void OnProcessButtonClicked(object sender, EventArgs e) { if (IsSearched) { using (UserDialogs.Instance.Loading("Loading", null, null, true, MaskType.Black)) { await Task.Delay(5000); } try { processFormRecords = await ViewModel.ProcessFormsAsync(); } catch { await DisplayAlert("Sorry!", "Something went wrong", "OK"); } if (processFormRecords != null) { if (processFormRecords.Success) { if (processFormRecords.URLs.Count > 0) { //await Navigation.PushAsync(new ListToProcessFormss(processFormRecords)); Application.Current.MainPage = new NavigationPage(new ProcessFormsMaster()); } else { await DisplayAlert("Forms", "No forms were found", "OK"); } } else { await DisplayAlert("Forms", "No forms were found to be eligible for processing given the identifier.", "OK"); } } } }
protected override async void OnAppearing() { base.OnAppearing(); #region get forms to be processed try { _processFormRecords = await ViewModel.ProcessFormsAsync(); } catch { await DisplayAlert(Constants.ErrorMsgTitleOops, Constants.ErrorMsgSorry, "OK"); } try { if (_processFormRecords != null) { if (_processFormRecords.Success) { if (_processFormRecords.URLs.Count > 0) { //fill list View with data Domain.Models.RequestModels.ProcessPatientFormModel domainUser = new Domain.Models.RequestModels.ProcessPatientFormModel(); domainUser.Forms = Settings.GetFormsList(); _processFormRecordsPvt = _processFormRecords; ListUrlPvt = new List <UrlPvt>(); int ii = 0; foreach (var url in _processFormRecordsPvt.URLs) { UrlPvt pvtu = new UrlPvt(); pvtu.UrlName = url; pvtu.FormName = domainUser.Forms[ii].Name; ListUrlPvt.Add(pvtu); ii++; } listForms.ItemsSource = ListUrlPvt; //end } else { await DisplayAlert("Form Processing", "There are no forms to process for the given identifier", "OK"); } } else { await DisplayAlert("Form Processing", "There are no forms to process for the given identifier", "OK"); } } #endregion listForms.IsVisible = true; ac.IsVisible = false; stkFinal.IsVisible = true; } catch (Exception exs) { Debug.Write("Process Forms Issue :" + exs); } }