ReportForEvent.xaml.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using PP_Ven_MosS.Classes;
  2. using PP_Ven_MosS.ModelBase;
  3. using System.Linq;
  4. using System.Windows;
  5. using System.Windows.Controls;
  6. namespace PP_Ven_MosS.Pages
  7. {
  8. /// <summary>
  9. /// Логика взаимодействия для ReportForEvent.xaml
  10. /// </summary>
  11. public partial class ReportForEvent : Page
  12. {
  13. public Event Eventedit = null;
  14. public ReportForEvent(Event Mer)
  15. {
  16. InitializeComponent();
  17. Eventedit = Mer;
  18. txtTitleEv.Text = Mer.Title_event;
  19. txtDesc.Text = Mer.Description_event;
  20. txtDate.Text = Mer.Date_event.ToString();
  21. Place_event pev = Classes.Database.entities.Place_event.FirstOrDefault(x => x.id_event == Mer.Id_event);
  22. if (pev != null)
  23. {
  24. Place pl = Classes.Database.entities.Place.FirstOrDefault(x => x.id_place == pev.id_place);
  25. txtPlace.Text = pl.title_place;
  26. }
  27. }
  28. private void Exit_Click(object sender, RoutedEventArgs e)
  29. {
  30. FrameClass.MainFrame.Navigate(new MenuAdmin());
  31. }
  32. private void Save_Click(object sender, RoutedEventArgs e)
  33. {
  34. if (Eventedit != null)
  35. {
  36. Event evnt = Classes.Database.entities.Event.FirstOrDefault(x => x.Id_event == Eventedit.Id_event);
  37. evnt.media = txtURL.Text;
  38. Classes.Database.entities.SaveChanges();
  39. MessageBox.Show("Отчет успешно сохранен", "Уведомление", MessageBoxButton.OK, MessageBoxImage.Information);
  40. }
  41. }
  42. }
  43. }