private async Task Recieve()
        {
            var result = await loadingService.WithExecuteAsync("Master download", async() =>
            {
                using (var stream = await itemService.OpenItemAsync().ConfigureAwait(false))
                {
                    return(await networkClient.Download(
                               EndPoint.MasterItem(settingService.GetEndPoint()),
                               stream,
                               Definition.DownloadTimeout));
                }
            });

            if (result.Success)
            {
                await dialogService.DisplayInformation("Master download", "Download completed.");

                await Back();
            }
            else
            {
                await dialogService.DisplayNetworkError(result);

                await itemService.DeleteItem();
            }
        }
Esempio n. 2
0
        private async Task Send()
        {
            var result = await loadingService.WithExecuteAsync("Data send", async() =>
            {
                NetworkResult ret = null;

                foreach (var entity in allEntities)
                {
                    if (entity.IsChecked)
                    {
                        var pair = await inspectionService.QueryInspectionAsync(entity.StorageNo);

                        var request = new StorageDetailsRequest
                        {
                            Renew     = false,
                            StorageNo = entity.StorageNo,
                            UserId    = session.UserId,
                            Entries   = pair.Entities.Select(x => new StorageDetailsRequestEntry
                            {
                                ItemCode   = x.ItemCode,
                                ItemName   = x.ItemName,
                                SalesPrice = x.SalesPrice,
                                Qty        = x.Qty
                            }).ToArray()
                        };

                        ret = await networkClient.Post(
                            EndPoint.StorageDetails(settingService.GetEndPoint()),
                            request,
                            Definition.Timeout);
                        if (!ret.Success)
                        {
                            return(ret);
                        }
                    }

                    await inspectionService.DeleteInspectionLisAsynct(entity.StorageNo);
                }

                return(ret);
            });

            if (result.Success)
            {
                await dialogService.DisplayInformation("Data send", "Send completed.");

                await Back();
            }
            else
            {
                await dialogService.DisplayNetworkError(result);
            }
        }
Esempio n. 3
0
        public async void OnNavigatedTo(NavigationContext context)
        {
            if (!context.IsPopBack)
            {
                var result = await loadingService.WithExecuteAsync(
                    "Storage list",
                    async() => await networkClient.Get <StorageResponse>(
                        EndPoint.StorageList(settingService.GetEndPoint()),
                        Definition.Timeout));

                if (result.Success)
                {
                    foreach (var entry in result.Result.Entries)
                    {
                        Items.Add(new SelectableItem <StorageResponseEntry>(entry));
                    }
                }
                else
                {
                    await dialogService.DisplayNetworkError(result);
                }
            }
        }