示例#1
0
        private async void ConfirmationCommandHandler()
        {
            if (Model.BillOfLadingCollectorViewInfo != null &&
                Model.PackIsValid())
            {
                if (await _notificationService.AskQuestionAsync("Confirma solicitação de impressão do volume?", SoundEnum.Alert))
                {
                    await _popupNavigation.PushAsync(new LoadingPopupPage());

                    var getBillOfLadingPackId = await _billOfLadingService.GetBillOfLadingPackId(Model.Number.ToInt(),
                                                                                                 Model.Digit, Model.UnitEmission, Model.Pack.ToInt());

                    if (getBillOfLadingPackId.Response != null && getBillOfLadingPackId.Response.PackId > 0)
                    {
                        var sendBillOfLadingPack = await _billOfLadingService.SendBillOfLadingPack(
                            new SendBillOfLadingPackModel(_wifiService.MacAddress,
                                                          getBillOfLadingPackId.Response.PackId));

                        await _popupNavigation.PopAllAsync();

                        if (sendBillOfLadingPack.IsSuccessStatusCode)
                        {
                            await _notificationService.NotifyAsync("Solicitação enviada com sucesso.", SoundEnum.Alert);
                        }
                    }
                    else
                    {
                        await _popupNavigation.PopAllAsync();
                    }
                }
            }
            else
            {
                await _notificationService.NotifyAsync("Informe todos os campos obrigatórios.", SoundEnum.Erros);
            }

            Model.Pack = String.Empty;
        }