コード例 #1
0
ファイル: ApiService.cs プロジェクト: neovemx/ASTProBatch
 public async Task <Response> LogInquirieGetCommands(string accessToken, LogInquirieGetCommandsQueryValues QueryValues)
 {
     return(await HttpPost(accessToken, this.ApiControllerSet, ApiMethod.LogInquirieGetCommands, QueryValues));
 }
コード例 #2
0
        private async void LotSelectedItemChange()
        {
            try
            {
                if (this.LotSelected == null)
                {
                    this.NameLot = "Seleccione un lote...";
                    return;
                }
                this.NameLot = this.LotSelected.NameLot;
                UserDialogs.Instance.ShowLoading("Obteniendo comandos...", MaskType.Black);
                //ApiSrv = new Services.ApiService(ApiConsult.ApiAuth);
                if (!await ApiIsOnline())
                {
                    UserDialogs.Instance.HideLoading();
                    Toast.ShowError(AlertMessages.Error);
                    return;
                }
                else
                {
                    if (!TokenValidator.IsValid(TokenMenuB))
                    {
                        if (!await ApiIsOnline())
                        {
                            UserDialogs.Instance.HideLoading();
                            Toast.ShowError(AlertMessages.Error);
                            return;
                        }
                        else
                        {
                            if (!await GetTokenSuccess())
                            {
                                UserDialogs.Instance.HideLoading();
                                Toast.ShowError(AlertMessages.Error);
                                return;
                            }
                            else
                            {
                                TokenMenuB = TokenGet;
                            }
                        }
                    }
                    LogInquirieGetCommandsQueryValues logInquirieGetCommandsQueryValues = new LogInquirieGetCommandsQueryValues()
                    {
                        IdLot = this.LotSelected.IdLot
                    };
                    Response resultGetCommands = await ApiSrv.LogInquirieGetCommands(TokenMenuB.Key, logInquirieGetCommandsQueryValues);

                    if (!resultGetCommands.IsSuccess)
                    {
                        UserDialogs.Instance.HideLoading();
                        Toast.ShowError(AlertMessages.Error);
                        return;
                    }
                    else
                    {
                        Commands = JsonConvert.DeserializeObject <List <LogInquiriesCommand> >(Crypto.DecodeString(resultGetCommands.Data));
                        if (CommandItems == null)
                        {
                            CommandItems = new ObservableCollection <PickerCommandItem>();
                        }
                        else
                        {
                            CommandItems.Clear();
                        }
                        foreach (LogInquiriesCommand logInquiriesCommand in Commands)
                        {
                            CommandItems.Add(new PickerCommandItem()
                            {
                                IdCommand   = logInquiriesCommand.IdCommand,
                                NameCommand = logInquiriesCommand.Command,
                                NameDisplay = (logInquiriesCommand.Command.Length > 20) ? logInquiriesCommand.Command.Substring(0, 20) + "..." : logInquiriesCommand.Command,
                                CodeCommand = logInquiriesCommand.Command.Split('-')[0].Trim()
                            });
                        }
                        UserDialogs.Instance.HideLoading();
                    }
                }
            }
            catch //(Exception ex)
            {
                UserDialogs.Instance.HideLoading();
                Toast.ShowError(AlertMessages.Error);
            }
        }