PageAgentList.xaml.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Demo1.Classes;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. namespace Demo1.Pages
  17. {
  18. /// <summary>
  19. /// Логика взаимодействия для PageAgentList.xaml
  20. /// </summary>
  21. public partial class PageAgentList : Page
  22. {
  23. List<Agent> AgentsClear = ClassDataBase.DB.Agent.ToList();
  24. List<ProductSale> ProductSales = ClassDataBase.DB.ProductSale.ToList();
  25. public PageAgentList()
  26. {
  27. InitializeComponent();
  28. LVAgents.ItemsSource = AgentsClear;
  29. }
  30. private void TBSales_Count_Loaded(object sender, RoutedEventArgs e)
  31. {
  32. TextBlock tb = (TextBlock)sender;
  33. int id = Convert.ToInt32(tb.Uid);
  34. List<ProductSale> salesTemp = new List<ProductSale>();
  35. foreach (ProductSale item in ClassDataBase.DB.ProductSale)
  36. {
  37. if (item.AgentID == id)
  38. {
  39. salesTemp.Add(item);
  40. }
  41. }
  42. tb.Text = "Количество продаж:" + salesTemp.Count.ToString();
  43. }
  44. }
  45. }