private void Delete(int ID) { var bus = new BusGiaoDich(); bus.DeleteGiaoDichByID(ID); LoadGDChi(); LoadGDThu(); }
private async void LoadGDChoVay() { var business = new BusGiaoDich(); var listChoVay = await business.LoadGiaoDichByLoaiGD(_idChoVay); if (listChoVay.Count == 0) { var status = new TextBlock() { FontSize = 30, FontStyle = FontStyle.Italic, Foreground = new SolidColorBrush(Colors.DimGray), TextWrapping = TextWrapping.Wrap, Text = "Hiện chưa có giao dịch nào trong sổ cho vay" }; ChoVayPanel.Children.Add(status); } else { ChoVayPanel.Children.Clear(); foreach (var giaoDich in listChoVay) { var giaoDichItem = new ViewData(giaoDich) { Margin = new Thickness(10) }; ChoVayPanel.Children.Add(giaoDichItem); } } }
private async void LoadGDThu() { var business = new BusGiaoDich(); var listThu = await business.LoadGiaoDichByLoaiGD(_idThu); if (listThu.Count == 0) { var status = new TextBlock() { FontSize = 30, FontStyle = FontStyle.Italic, Foreground = new SolidColorBrush(Colors.DimGray), TextWrapping = TextWrapping.Wrap, Text = "Hiện chưa có giao dịch thu trong sổ thu chi" }; ThuPanel.Children.Add(status); } else { ThuPanel.Children.Clear(); foreach (var giaoDich in listThu) { var giaoDichItem = new ViewData(giaoDich); giaoDichItem.delete += Delete; ThuPanel.Children.Add(giaoDichItem); } } }