private async Task Next() { Status.Value.IsChecked = true; await inspectionService.UpdateAsync(Status.Value, Entities.Reverse()); await navigator.ForwardAsync("Inspection1Page"); }
private async Task Recieve() { var storageNos = Items .Where(x => x.IsSelected) .Select(x => x.Item.StorageNo) .ToList(); var exists = storageNos .Any(x => inspectionService.IsInspectionExists(x)); if (exists) { if (!await dialogService.DisplayConfirm("Data recieve", "Data already exists. delete it ?")) { return; } } var result = await loadingService.WithExecuteAsync("Data recieve", async() => { NetworkResult <StorageDetailsResponse> ret = null; foreach (var storageNo in storageNos) { ret = await networkClient.Get <StorageDetailsResponse>( EndPoint.StorageDetails(settingService.GetEndPoint(), storageNo), Definition.Timeout); if (!ret.Success) { return(ret); } var summary = ret.Result.Entries .Aggregate(new EntrySummaryView(), (s, e) => { s.DetailCount += 1; s.TotalPrice += e.SalesPrice *e.Qty; s.TotalQty += e.Qty; return(s); }); // MEMO DetailNo discards it as it will change again when sending await inspectionService.UpdateAsync( new InspectionStatusEntity { StorageNo = ret.Result.StorageNo, EntryUserId = ret.Result.EntryUserId, EntryAt = ret.Result.EntryAt, InspectionUserId = ret.Result.InspectionUserId, InspectionAt = ret.Result.InspectionAt, DetailCount = summary.DetailCount, TotalPrice = summary.TotalPrice, TotalQty = summary.TotalQty, IsChecked = false }, ret.Result.Entries.Select((x, i) => new InspectionEntity { ItemCode = x.ItemCode, ItemName = x.ItemName, SalesPrice = x.SalesPrice, Qty = x.Qty, OriginalQty = x.Qty, })); } return(ret); }); if (result.Success) { await dialogService.DisplayInformation("Data recieve", "Recieve completed."); await Back(); } else { await dialogService.DisplayNetworkError(result); } }