PageAgentsList.xaml.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. using Demo.Classes;
  16. namespace Demo.Pages
  17. {
  18. /// <summary>
  19. /// Логика взаимодействия для PageAgentsList.xaml
  20. /// </summary>
  21. public partial class PageAgentsList : Page
  22. {
  23. List<Agent> AgentClear = ClassDataBase.DB.Agent.ToList();
  24. List<ProductSale> AgentSales = ClassDataBase.DB.ProductSale.ToList();
  25. public PageAgentsList()
  26. {
  27. InitializeComponent();
  28. LVAgents.ItemsSource = AgentClear;
  29. }
  30. private void TbSalesCount_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. }