wEventSee.xaml.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 teaTime.class_es;
  16. using TeaTime;
  17. namespace teaTime
  18. {
  19. public class DataSee
  20. {
  21. public int num { get; set; }
  22. public string value { get; set; }
  23. }
  24. /// <summary>
  25. /// Логика взаимодействия для wEventSee.xaml
  26. /// </summary>
  27. public partial class wEventSee : Page
  28. {
  29. public wEventSee(DataTimeEvent events)
  30. {
  31. InitializeComponent();
  32. init(events);
  33. loadData();
  34. }
  35. private void init(DataTimeEvent events)
  36. {
  37. aDate.Text = events.Data;
  38. aTime.Text = events.Time;
  39. aDescript.Text = events.Description;
  40. aName.Text = events.Name;
  41. aTheme.Text = events.Theme;
  42. }
  43. private void loadData()
  44. {
  45. using (KotkovaISazonovaEntities_ DB = new KotkovaISazonovaEntities_())
  46. {
  47. teaProgramm.ItemsSource = ConvertTea(DB.PertyTea.ToList());
  48. guestsList.ItemsSource = ConvertGuest(DB.goPhoto.ToList());
  49. }
  50. }
  51. public List<DataSee> ConvertGuest(List<goPhoto> List)
  52. {
  53. List<DataSee> val = new List<DataSee>();
  54. int j = 1;
  55. for (int i = 0; i < List.Count; i++)
  56. {
  57. if (DateTime.Parse(aDate.Text) == List[i].Date)
  58. {
  59. val.Add(new DataSee
  60. {
  61. num = j++,
  62. value = List[i].surname + " " + List[i].name + " " + List[i].middleName
  63. });
  64. }
  65. }
  66. return val;
  67. }
  68. public List<DataSee> ConvertTea(List<PertyTea> List)
  69. {
  70. List<DataSee> val = new List<DataSee>();
  71. int j = 1;
  72. for (int i = 0; i < List.Count; i++)
  73. {
  74. if (DateTime.Parse(aDate.Text) == List[i].Date)
  75. {
  76. val.Add(new DataSee
  77. {
  78. num = j++,
  79. value = List[i].Name.ToString()
  80. });
  81. }
  82. }
  83. return val;
  84. }
  85. private void bClose_Click(object sender, RoutedEventArgs e)
  86. {
  87. //NavigationService.Navigate(new wWorkerMain());
  88. }
  89. }
  90. }