/// <summary> /// Post the EndControls Delivery asynchronous. /// </summary> /// <returns></returns> public async Task <DeliveryEndControls> GetDeliveryEndControl(string FileNumber) { DeliveryEndControls endControl = new DeliveryEndControls(); try { using (var client = new RestClient(new Uri("https://api-tray.intragest.info/api/"))) { client.Authenticator = new HttpBasicAuthenticator("astek.tracker", "3B]U/2Z8w7fDce=("); var request = new RestRequest("PackingGetDeliveryEndControls", Method.GET); request.AddQueryParameter("file_number", FileNumber); var result = await client.Execute <DeliveryEndControls>(request).ConfigureAwait(false); endControl = result.Data; } } catch (Exception e) { var da = new DatabaseAccessAsync(); da.InsertException(new PackingCygestExceptionModel { Message = e.Message, StackTrace = e.StackTrace, TimeSpan = DateTime.Today.ToString(System.Globalization.CultureInfo.CurrentCulture), MethodName = e.Source }); } return(endControl); }
/// <summary> /// Initializes a new instance of the <see cref="DelFinalSummaryViewModel"/> class. /// </summary> /// <param name="pageService">The page service.</param> /// <param name="info">The information.</param> /// <param name="end">The end.</param> /// <param name="isSuccess">if set to <c>true</c> [is success].</param> public DelFinalSummaryViewModel(IPageService pageService, FileInfoDeliveryModel info, DeliveryEndControls end, bool isSuccess) { HandleTranslation(_appViewModel.DefaultedCultureInfo); LanguageSelected = _appViewModel.DefaultedCultureInfo; PageService = pageService; InfoModel = info; _delEndControl = end; _isSucess = isSuccess; _db = new DatabaseAccess(); GetDeliverySummaryDetail(end); GetDeliveryItem(InfoModel.File_number); GoToSignature = new Command(GoToSignaturePage); Back = new Command(BackToControlAsync); }
private async void GetDeliverySummaryDetail(DeliveryEndControls endDel) { if (!string.IsNullOrEmpty(endDel.file_number)) { ExpectedValue = endDel.qt_items_attendus; RecievedValue = endDel.qt_items_recus; } else { await PageService.DisplayAlert("Info", "No data recieved", "ok"); ExpectedValue = 0; RecievedValue = 0; } }
private async Task GetSummaryDelDetails() { if (InfoModel.File_number != null) { _endControls = await _service.GetDeliveryEndControl(InfoModel.File_number); } else { _endControls.file_number = null; } ProgressValue = 100; LoadingText = ""; LoadingIndicator = false; await Task.Delay(TimeSpan.FromSeconds(1)); await PageService.PushAsync(new DelFinalSummary(InfoModel, _endControls, _isSucess)); }
/// <summary> /// Initializes a new instance of the <see cref="DelFinalSummary"/> class. /// </summary> public DelFinalSummary(FileInfoDeliveryModel info, DeliveryEndControls end, bool success) { InitializeComponent(); BindingContext = new DelFinalSummaryViewModel(new PageService(), info, end, success); }