private async Task OnClockOut()
        {
            try
            {
                var userConfirmation = await Alert.ShowMessageConfirmation(
                    nameof(AppResources.AreYouSureYouWantToClockOut).Translate()
                    , nameof(AppResources.UpdatePackingSlip).Translate()
                    , nameof(AppResources.Yes).Translate(), nameof(AppResources.No).Translate());

                if (!userConfirmation)
                {
                    return;
                }

                IsBusy = true;
                var date    = DateTimeOffset.Now;
                var context = new ClockInTimeQueryContext
                {
                    ManifestId = _manifest.Key,
                    StopNumber = int.Parse(_manifest.StopNumber),
                    DateTime   = date
                };
                var result = await Api.UpdateManifestClockOutTime(context);

                if (!result.Successful.GetValueOrDefault())
                {
                    await Alert.DisplayApiCallError(result.ExceptionMessage, result.ValidationErrors,

                                                    $"{Translate.Get(nameof(AppResources.CouldNotMarkAsNotReady))}" +
                                                    $"-{Translate.Get(nameof(AppResources.ServerError))}");

                    return;
                }

                Manifest.ClockOutDateTime = date;
                RaisePropertyChanged(nameof(ShowClockIn));
                RaisePropertyChanged(nameof(ShowClockOut));
            }
            catch (Exception e)
            {
                await Alert.DisplayError(e);
            }
            finally
            {
                IsBusy = false;
            }
        }
示例#2
0
 public async Task <ApiResponseOfBoolean> UpdateManifestClockOutTime(ClockInTimeQueryContext context)
 {
     return(await AXClient.Instance.UpdateManifestClockOutTimeAsync(context)
            .ConfigureAwait(false));
 }