Beispiel #1
0
 public async Task <Response> OperationsLogGetCommands(string accessToken, OperationsLogCommandQueryValues QueryValues)
 {
     return(await HttpPost(accessToken, this.ApiControllerSet, ApiMethod.OperationsLogGetCommands, QueryValues));
 }
Beispiel #2
0
        private async void SelectedLotItemChange()
        {
            try
            {
                if (this.LotItemSelected == null || this.LotItemSelected.IdLot == 0)
                {
                    if (PickerCommandItems != null)
                    {
                        PickerCommandItems.Clear();
                    }
                    return;
                }

                UserDialogs.Instance.ShowLoading("Obteniendo comandos...", 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;
                            }
                        }
                    }
                    OperationsLogCommandQueryValues operationsLogCommandQueryValues = new OperationsLogCommandQueryValues()
                    {
                        IdLot = this.LotItemSelected.IdLot
                    };
                    Response resultGetCommands = await ApiSrv.OperationsLogGetCommands(TokenGet.Key, operationsLogCommandQueryValues);

                    if (!resultGetCommands.IsSuccess)
                    {
                        UserDialogs.Instance.HideLoading();
                        Toast.ShowError(AlertMessages.Error);
                        return;
                    }
                    else
                    {
                        OperationsLogCommands = JsonConvert.DeserializeObject <List <OperationsLogCommand> >(Crypto.DecodeString(resultGetCommands.Data));
                        if (PickerCommandItems == null)
                        {
                            PickerCommandItems = new ObservableCollection <PickerCommandItem>();
                        }
                        else
                        {
                            PickerCommandItems.Clear();
                        }
                        foreach (OperationsLogCommand item in OperationsLogCommands)
                        {
                            PickerCommandItems.Add(new PickerCommandItem()
                            {
                                IdCommand   = item.IdCommand,
                                NameCommand = item.Command
                            });
                        }
                        UserDialogs.Instance.HideLoading();
                    }
                }
            }
            catch //(Exception ex)
            {
                UserDialogs.Instance.HideLoading();
                Toast.ShowError(AlertMessages.Error);
            }
        }