コード例 #1
0
        private async void SelectedLogItemChange()
        {
            try
            {
                if (this.LogSelected == null)
                {
                    if (this.LotSelected != null)
                    {
                        this.LotSelected = null;
                    }
                    return;
                }

                UserDialogs.Instance.ShowLoading("Obteniendo lotes...", MaskType.Black);
                if (!await ApiIsOnline())
                {
                    UserDialogs.Instance.HideLoading();
                    Toast.ShowError(AlertMessages.Error);
                    return;
                }
                else
                {
                    if (!TokenValidator.IsValid(TokenGet))
                    {
                        if (!await ApiIsOnline())
                        {
                            UserDialogs.Instance.HideLoading();
                            Toast.ShowError(AlertMessages.Error);
                            return;
                        }
                        else
                        {
                            if (!await GetTokenSuccess())
                            {
                                UserDialogs.Instance.HideLoading();
                                Toast.ShowError(AlertMessages.Error);
                                return;
                            }
                        }
                    }
                    LotAndCommandLotQueryValues lotAndCommandLotQueryValues = new LotAndCommandLotQueryValues()
                    {
                        IdLog = this.LogSelected.IdLog
                    };
                    Response resultGetLots = await ApiSrv.LotAndCommandGetLots(TokenGet.Key, lotAndCommandLotQueryValues);

                    if (!resultGetLots.IsSuccess)
                    {
                        UserDialogs.Instance.HideLoading();
                        Toast.ShowError(AlertMessages.Error);
                        return;
                    }
                    else
                    {
                        LotAndCommandLots = JsonConvert.DeserializeObject <List <LotAndCommandLot> >(Crypto.DecodeString(resultGetLots.Data));
                        if (PickerLotItems == null)
                        {
                            PickerLotItems = new ObservableCollection <PickerLotItem>();
                        }
                        else
                        {
                            PickerLotItems.Clear();
                        }
                        foreach (LotAndCommandLot lotAndCommandLot in LotAndCommandLots)
                        {
                            PickerLotItems.Add(new PickerLotItem()
                            {
                                IdLot   = lotAndCommandLot.IdLot,
                                NameLot = lotAndCommandLot.Lot
                            });
                        }
                        UserDialogs.Instance.HideLoading();
                    }
                }
            }
            catch (Exception ex)
            {
                UserDialogs.Instance.HideLoading();
                Toast.ShowError(AlertMessages.Error);
            }
        }
コード例 #2
0
ファイル: ApiService.cs プロジェクト: neovemx/ASTProBatch
 public async Task <Response> LotAndCommandGetLots(string accessToken, LotAndCommandLotQueryValues QueryValues)
 {
     return(await HttpPost(accessToken, this.ApiControllerSet, ApiMethod.LotAndCommandGetLots, QueryValues));
 }