コード例 #1
0
        private async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }
            await Task.Delay(1000);

            try
            {
                IsBusy = true;
                Items.Clear();
                List <HasilPemeriksaan> items = null;
                if (await Account.UserInRole(UserType.Gate))
                {
                    items = Model.HasilPemeriksaan;
                }
                else
                {
                    items = await ApprovalService.GetPenilaian(Model.Id);
                }
                if (items != null && items.Count > 0)
                {
                    var groups = items.Where(x => x.ItemPemeriksaan.JenisPemeriksaan == JenisPemeriksaan.Kelengkapan).GroupBy(x => x.ItemPemeriksaan.Pemeriksaan.Id);
                    foreach (var group in groups)
                    {
                        var data = group.FirstOrDefault();
                        Items.Add(new GroupPemeriksaan {
                            Name = data.ItemPemeriksaan.Kelengkapan, PemeriksaanId = group.Key, Items = group.ToList()
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }