Esempio n. 1
0
        public async Task <HttpResponseMessage> PostKegUpload(KegBulkUpdateItemRequestModel model, string sessionId)
        {
            var cts  = new CancellationTokenSource();
            var task = RemoteRequestAsync(_dashboardApi.GetApi(Priority.UserInitiated).PostKegUpload(model, sessionId, cts.Token));

            runningTasks.Add(task.Id, cts);

            return(await task);
        }
        private async void SaveCommandRecieverAsync()
        {
            try
            {
                if (BarcodeCollection.Count > 0)
                {
                    Loader.StartLoading();
                    var           model             = new KegBulkUpdateItemRequestModel();
                    var           MassUpdateKegKegs = new List <MassUpdateKeg>();
                    MassUpdateKeg MassUpdateKeg     = null;
                    var           val = await _dashboardService.GetAssetVolumeAsync(AppSettings.SessionId, false);

                    foreach (var item in BarcodeCollection)
                    {
                        MassUpdateKeg = new MassUpdateKeg
                        {
                            AssetSize   = SelectedItemSize,
                            AssetType   = SelectedItemType,
                            Barcode     = item.Barcode,
                            AssetVolume = item.TagsStr,
                            KegId       = _uuidManager.GetUuId(),
                            OwnerId     = AppSettings.CompanyId,
                            OwnerSkuId  = "",
                            ProfileId   = "",
                        };

                        MassUpdateKegKegs.Add(MassUpdateKeg);
                    }
                    model.Kegs = MassUpdateKegKegs;

                    var value = await _dashboardService.PostKegUploadAsync(model, AppSettings.SessionId, Configuration.MassUpdateKegList);

                    if (value.Response.StatusCode == System.Net.HttpStatusCode.OK.ToString())
                    {
                        await _navigationService.GoBackAsync(new NavigationParameters
                        {
                            { "AssingSuccessMsgAsync", "AssingSuccessMsgAsync" }
                        }, animated : false);
                    }
                }
                else
                {
                    await _dialogService.DisplayAlertAsync("Alert", "Please add scan item", "Ok");
                }
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
            }
            finally
            {
                Loader.StopLoading();
            }
        }
Esempio n. 3
0
        public async Task <KegMassUpdateKegModel> PostKegUploadAsync(KegBulkUpdateItemRequestModel inModel, string sessionId, string RequestType)
        {
            KegMassUpdateKegModel outModel = new KegMassUpdateKegModel
            {
                Response = new KegIDResponse()
            };

            try
            {
                string url     = string.Format(Configuration.PostKegsUrl, sessionId);
                string content = JsonConvert.SerializeObject(inModel);
                var    value   = await App.kegIDClient.ExecuteServiceCall <KegIDResponse>(url, HttpMethodType.Send, content, RequestType : RequestType);

                outModel.Model = !string.IsNullOrEmpty(value.Response) ? App.kegIDClient.DeserializeObject <IList <KegMassUpdateKegResponseModel> >(value.Response) : new List <KegMassUpdateKegResponseModel>();
                outModel.Response.StatusCode = value.StatusCode;
            }
            catch (System.Exception)
            {
            }
            return(outModel);
        }