Beispiel #1
0
 public async Task <Response> LogInquirieGetOperators(string accessToken, LogInquirieGetOperatorsQueryValues QueryValues)
 {
     return(await HttpPost(accessToken, this.ApiControllerSet, ApiMethod.LogInquirieGetOperators, QueryValues));
 }
Beispiel #2
0
        private async void GetInitialData()
        {
            try
            {
                UserDialogs.Instance.ShowLoading("Obteniendo lotes...", MaskType.Black);
                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;
                        Response resultGetLots = await ApiSrv.LogInquirieGetLots(TokenMenuB.Key);

                        if (!resultGetLots.IsSuccess)
                        {
                            UserDialogs.Instance.HideLoading();
                            Toast.ShowError(AlertMessages.Error);
                            return;
                        }
                        else
                        {
                            Lots     = JsonConvert.DeserializeObject <List <LogInquiriesLot> >(Crypto.DecodeString(resultGetLots.Data));
                            LotItems = new ObservableCollection <PickerLotItem>();
                            foreach (LogInquiriesLot logInquiriesLot in Lots)
                            {
                                LotItems.Add(new PickerLotItem()
                                {
                                    IdLot       = logInquiriesLot.IdLot,
                                    NameLot     = logInquiriesLot.Lot,
                                    NameDisplay = (logInquiriesLot.Lot.Length > 20) ? logInquiriesLot.Lot.Substring(0, 20) + "..." : logInquiriesLot.Lot,
                                    CodeLot     = logInquiriesLot.Lot.Split('-')[0].Trim()
                                });
                            }
                            UserDialogs.Instance.HideLoading();
                            UserDialogs.Instance.ShowLoading("Obteniendo operadores...", MaskType.Black);
                            LogInquirieGetOperatorsQueryValues logInquirieGetOperatorsQueryValues = new LogInquirieGetOperatorsQueryValues()
                            {
                                IdLog = this.LogItem.IdLog
                            };
                            Response resultGetOperators = await ApiSrv.LogInquirieGetOperators(TokenMenuB.Key, logInquirieGetOperatorsQueryValues);

                            if (!resultGetOperators.IsSuccess)
                            {
                                UserDialogs.Instance.HideLoading();
                                Toast.ShowError(AlertMessages.Error);
                                return;
                            }
                            else
                            {
                                Operators = JsonConvert.DeserializeObject <List <LogInquiriesOperator> >(Crypto.DecodeString(resultGetOperators.Data));
                                LogInquirieOperatorItems = new ObservableCollection <LogInquirieOperatorItem>();
                                foreach (LogInquiriesOperator logInquiriesOperator in Operators)
                                {
                                    LogInquirieOperatorItems.Add(new LogInquirieOperatorItem()
                                    {
                                        NameInstance = logInquiriesOperator.NameInstance,
                                        Number       = logInquiriesOperator.Number,
                                        NameOperator = logInquiriesOperator.Operator
                                    });
                                }
                                UserDialogs.Instance.HideLoading();
                            }
                        }
                    }
                }
            }
            catch //(Exception ex)
            {
                UserDialogs.Instance.HideLoading();
                Toast.ShowError(AlertMessages.Error);
            }
        }