private void PageDanhGia_Loaded(object sender, RoutedEventArgs e) { ws = new kidmathwebserviceSoapClient(); dsdanhGia = ws.getDataDanhGiaAsync().Result.Body.getDataDanhGiaResult.ToList <danhGia>(); dsdanhGia = dsdanhGia.FindAll(danhGia => danhGia.username != ""); foreach (var danhGia in dsdanhGia) { //c : chưa duyệt ; d: đã duyệt if (danhGia.tinhTrang == "d") { danhGia.tinhTrang = "Đã duyệt"; } else if (danhGia.tinhTrang == "c") { danhGia.tinhTrang = "Phê duyệt"; } // danhGia.maKhoaHoc = "Mã khóa học: " + danhGia.maKhoaHoc + " Điểm đánh giá: "; } gvdsachdanhgia.ItemsSource = dsdanhGia; }
private void DanhGiaPage_Loaded(object sender, RoutedEventArgs e) { ws = new kidmathwebserviceSoapClient(); List <danhGia> dsbinhluan = new List <danhGia>(); dsbinhluan = ws.getDataDanhGiaAsync().Result.Body.getDataDanhGiaResult.ToList <danhGia>(); dsbinhluan = dsbinhluan.FindAll(binhluan => binhluan.maKhoaHoc == khoahocdangxem.maKhoaHoc && binhluan.tinhTrang == "d"); danhGiaTrungBinh.Text = Convert.ToString(khoahocdangxem.danhGia) + " / 5"; soluongnhanxet.Text = Convert.ToString(khoahocdangxem.soLuongDanhGia) + " Nhận xét"; foreach (var binhluan in dsbinhluan) { string imglink = Convert.ToString(binhluan.rate); string imglink2 = ""; switch (imglink) { case "1": imglink = @"Assets\StarVote\1.png"; break; case "2": imglink = @"Assets\StarVote\2.png"; break; case "3": imglink = @"Assets\StarVote\3.png"; break; case "4": imglink = @"Assets\StarVote\4.png"; break; case "5": imglink = @"Assets\StarVote\5.png"; break; default: imglink = @"Assets\StarVote\5.png"; break; } switch (khoahocdangxem.danhGia) { case 1: imglink2 = @"Assets\StarVote\1.png"; break; case 2: imglink2 = @"Assets\StarVote\2.png"; break; case 3: imglink2 = @"Assets\StarVote\3.png"; break; case 4: imglink2 = @"Assets\StarVote\4.png"; break; case 5: imglink2 = @"Assets\StarVote\5.png"; break; default: imglink2 = @"Assets\StarVote\5.png"; break; } binhluan.rate = imglink; BitmapImage bitmapImage = new BitmapImage(); Uri uri = new Uri("ms-appx:///" + imglink2); bitmapImage.UriSource = uri; starimg.Source = bitmapImage; } GridView_dsBinhLuan.ItemsSource = dsbinhluan; }