1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using PP_Ven_MosS.Classes;
- using PP_Ven_MosS.ModelBase;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace PP_Ven_MosS.Pages
- {
- /// <summary>
- /// Логика взаимодействия для CreateEvent.xaml
- /// </summary>
- public partial class CreateEvent : Page
- {
- public CreateEvent()
- {
-
- InitializeComponent();
- CBTypeEv.ItemsSource = new List<string>() { "Конференция", "Собрания", "Пленарное заседание", "Научная дискуссия", "Экспертно-оценочная сессия", "День открытых дверей", "Студентческое мероприятие" };
- CBTypeEv.SelectedIndex = 0;
- PlaceEv.ItemsSource = Database.entities.Place.ToList();
- PlaceEv.DisplayMemberPath = "title_place";
- PlaceEv.SelectedValuePath = "id_place";
- PlaceEv.SelectedIndex = 0;
- }
- private void CBPeople_Loaded(object sender, RoutedEventArgs e)
- {
- List<People> peoples = Database.entities.People.ToList();
- foreach(var peop in peoples)
- {
- CBPeople.Items.Add(peop.Ttitle);
- }
- CBPeople.SelectedIndex = 0;
- }
-
- private void Save_Click(object sender, RoutedEventArgs e)
- {
- switch (MessageBox.Show("Уверены в своем решении?", "Организация мероприятия", MessageBoxButton.YesNo))
- {
- case MessageBoxResult.Yes:
- Event events = new Event()
- {
- Description_event = DescEv.Text,
- Id_user = UserID.userid,
- Id_events_type = CBTypeEv.SelectedIndex + 1,
- Date_event = dob.SelectedDate.Value,
- Id_status_event = 2,
- Title_event = TitleEv.Text,
- Id_people = CBPeople.SelectedIndex,
- };
- Database.entities.Event.Add(events);
- Database.entities.SaveChanges();
- Place_event plev = new Place_event();
- plev.id_event = events.Id_event;
- plev.id_place = ((Place)PlaceEv.SelectedItem).id_place;
- Database.entities.Place_event.Add(plev);
- Database.entities.SaveChanges();
- MessageBox.Show("Мероприятие успешно запланировано"); break;
- case MessageBoxResult.No:
- MessageBox.Show("Вы отказались от мероприятия");
- break;
- }
- }
- private void Exit_Click(object sender, RoutedEventArgs e)
- {
- FrameClass.MainFrame.Navigate(new ApplicationsListUser());
- }
-
- }
- }
|