Browse Source

Add create report and visual users report

Alexey 6 months ago
parent
commit
88d8d86afe

+ 1 - 1
PP_Ven_MosS/MainWindow.xaml

@@ -6,7 +6,7 @@
         xmlns:local="clr-namespace:PP_Ven_MosS"
         xmlns:local="clr-namespace:PP_Ven_MosS"
         mc:Ignorable="d"
         mc:Ignorable="d"
         Background="#D3D3D3"
         Background="#D3D3D3"
-        Title="MainWindow" WindowState="Maximized"
+        Title="Мининский" WindowState="Maximized"
         Icon="/Images/logo.png">
         Icon="/Images/logo.png">
     <Grid>
     <Grid>
         <Frame Name="MainFrame" NavigationUIVisibility="Hidden"></Frame>
         <Frame Name="MainFrame" NavigationUIVisibility="Hidden"></Frame>

+ 1 - 1
PP_Ven_MosS/ModelBase/Model1.Designer.cs

@@ -1,4 +1,4 @@
-// Создание кода T4 для модели "C:\Users\USER\source\repos\PP_Minin\PP_Ven_MosS\ModelBase\Model1.edmx" включено. 
+// Создание кода T4 для модели "C:\Users\vened\Source\Repos\PP_Minin\PP_Ven_MosS\ModelBase\Model1.edmx" включено. 
 // Чтобы включить формирование кода прежних версий, измените значение свойства "Стратегия создания кода" конструктора
 // Чтобы включить формирование кода прежних версий, измените значение свойства "Стратегия создания кода" конструктора
 // на "Legacy ObjectContext". Это свойство доступно в окне "Свойства", если модель
 // на "Legacy ObjectContext". Это свойство доступно в окне "Свойства", если модель
 // открыта в конструкторе.
 // открыта в конструкторе.

+ 3 - 3
PP_Ven_MosS/ModelBase/Model1.edmx.diagram

@@ -7,11 +7,11 @@
       <Diagram DiagramId="67dfd2639c1343d686890e1eee4ed78e" Name="Diagram1" ZoomLevel="93">
       <Diagram DiagramId="67dfd2639c1343d686890e1eee4ed78e" Name="Diagram1" ZoomLevel="93">
         <EntityTypeShape EntityType="PP_MininModel.Application_type" Width="1.5" PointX="3" PointY="5.75" IsExpanded="true" />
         <EntityTypeShape EntityType="PP_MininModel.Application_type" Width="1.5" PointX="3" PointY="5.75" IsExpanded="true" />
         <EntityTypeShape EntityType="PP_MininModel.Applications" Width="1.5" PointX="5.25" PointY="1.25" IsExpanded="true" />
         <EntityTypeShape EntityType="PP_MininModel.Applications" Width="1.5" PointX="5.25" PointY="1.25" IsExpanded="true" />
-        <EntityTypeShape EntityType="PP_MininModel.Event" Width="1.5" PointX="5.75" PointY="6" IsExpanded="true" />
+        <EntityTypeShape EntityType="PP_MininModel.Event" Width="1.5" PointX="12" PointY="1.25" IsExpanded="true" />
         <EntityTypeShape EntityType="PP_MininModel.Events_type" Width="1.5" PointX="7.75" PointY="0.75" IsExpanded="true" />
         <EntityTypeShape EntityType="PP_MininModel.Events_type" Width="1.5" PointX="7.75" PointY="0.75" IsExpanded="true" />
         <EntityTypeShape EntityType="PP_MininModel.People" Width="1.5" PointX="7.75" PointY="3.75" IsExpanded="true" />
         <EntityTypeShape EntityType="PP_MininModel.People" Width="1.5" PointX="7.75" PointY="3.75" IsExpanded="true" />
-        <EntityTypeShape EntityType="PP_MininModel.Place" Width="1.5" PointX="8" PointY="9.125" IsExpanded="true" />
-        <EntityTypeShape EntityType="PP_MininModel.Place_event" Width="1.5" PointX="8" PointY="6.5" IsExpanded="true" />
+        <EntityTypeShape EntityType="PP_MininModel.Place" Width="1.5" PointX="8.375" PointY="6.375" IsExpanded="true" />
+        <EntityTypeShape EntityType="PP_MininModel.Place_event" Width="1.5" PointX="10.5" PointY="5.75" IsExpanded="true" />
         <EntityTypeShape EntityType="PP_MininModel.Role" Width="1.5" PointX="0.75" PointY="2" IsExpanded="true" />
         <EntityTypeShape EntityType="PP_MininModel.Role" Width="1.5" PointX="0.75" PointY="2" IsExpanded="true" />
         <EntityTypeShape EntityType="PP_MininModel.Status_application" Width="1.5" PointX="3" PointY="8.125" IsExpanded="true" />
         <EntityTypeShape EntityType="PP_MininModel.Status_application" Width="1.5" PointX="3" PointY="8.125" IsExpanded="true" />
         <EntityTypeShape EntityType="PP_MininModel.Status_event" Width="1.5" PointX="9.75" PointY="0.75" IsExpanded="true" />
         <EntityTypeShape EntityType="PP_MininModel.Status_event" Width="1.5" PointX="9.75" PointY="0.75" IsExpanded="true" />

+ 3 - 3
PP_Ven_MosS/Pages/ApplicationsListUser.xaml

@@ -84,14 +84,14 @@
                         <Border Width="500" Height="140" BorderThickness="1" BorderBrush="Red">
                         <Border Width="500" Height="140" BorderThickness="1" BorderBrush="Red">
                             <StackPanel Orientation="Horizontal">
                             <StackPanel Orientation="Horizontal">
                             <StackPanel Margin="10,0,0,0" Width="300" Orientation="Vertical" HorizontalAlignment="Left">
                             <StackPanel Margin="10,0,0,0" Width="300" Orientation="Vertical" HorizontalAlignment="Left">
-                                <TextBlock Text="{Binding Date_event}"/>
+                                    <TextBlock Text="{Binding Date_event,StringFormat=dd.MM.yyyy}"/>
                                 <TextBlock Text="{Binding Place_for_event}" TextWrapping="Wrap"/>
                                 <TextBlock Text="{Binding Place_for_event}" TextWrapping="Wrap"/>
                                 <TextBlock Text="{Binding Title_event}"/>
                                 <TextBlock Text="{Binding Title_event}"/>
                                 <TextBlock Text="{Binding Path=Events_type.Title_events_type}"/>
                                 <TextBlock Text="{Binding Path=Events_type.Title_events_type}"/>
                                 <TextBlock Text="{Binding Description_event}"/>
                                 <TextBlock Text="{Binding Description_event}"/>
                                 <TextBlock Text="{Binding Path=User.Surname}"/>
                                 <TextBlock Text="{Binding Path=User.Surname}"/>
-                                <TextBlock Text="{Binding Path=Status_event.Title_status_event}" FontWeight="Bold"/>
-                                    <Button Name="Rep" Click="GoToCheckReport_Click" Content="Посмотреть отчет" Style="{StaticResource BtnSt}"></Button>
+                                    <TextBlock Text="{Binding Path=Status_event.Title_status_event}" FontWeight="Bold"/>
+                                    <TextBlock Uid="{Binding Id_event}" Loaded="TextBlock_Loaded"></TextBlock>
                                 </StackPanel>
                                 </StackPanel>
                                 <!--<Button Style="{StaticResource BtnSt}" Name="InfoEv" Click="GoInfoForEvent_Click" Content="Информаия"></Button>-->
                                 <!--<Button Style="{StaticResource BtnSt}" Name="InfoEv" Click="GoInfoForEvent_Click" Content="Информаия"></Button>-->
                         </StackPanel>
                         </StackPanel>

+ 14 - 0
PP_Ven_MosS/Pages/ApplicationsListUser.xaml.cs

@@ -148,6 +148,20 @@ namespace PP_Ven_MosS
         {
         {
             Filter();
             Filter();
         }
         }
+
+        private void TextBlock_Loaded(object sender, RoutedEventArgs e)
+        {
+            TextBlock tb = (TextBlock)sender;
+            Event @event = Database.entities.Event.FirstOrDefault(X => X.Id_event.ToString() == tb.Uid);
+            if(@event != null)
+            {
+                tb.Text = @event.media;
+            }
+            else
+            {
+                tb.Visibility = Visibility.Collapsed;
+            }
+        }
     }
     }
 }
 }
 
 

+ 1 - 14
PP_Ven_MosS/Pages/CheckReport.xaml.cs

@@ -1,17 +1,4 @@
-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;
+using System.Windows.Controls;
 
 
 namespace PP_Ven_MosS.Pages
 namespace PP_Ven_MosS.Pages
 {
 {

+ 1 - 1
PP_Ven_MosS/Pages/CreateEvent.xaml

@@ -24,7 +24,7 @@
                 <TextBox Name="DescEv" Height="30"/>
                 <TextBox Name="DescEv" Height="30"/>
             </GroupBox>
             </GroupBox>
             <GroupBox Height="60" Header="Место" BorderThickness="2" BorderBrush="#FF0000" Margin="10,0,0,0">
             <GroupBox Height="60" Header="Место" BorderThickness="2" BorderBrush="#FF0000" Margin="10,0,0,0">
-                <ComboBox Name="PlaceEv" Height="30" Loaded="PlaceEv_Loaded"/>
+                <ComboBox Name="PlaceEv" Height="30" />
             </GroupBox>
             </GroupBox>
             <GroupBox Height="60" Header="Тип мероприятия" BorderThickness="2" BorderBrush="#FF0000" Margin="10,0,0,0">
             <GroupBox Height="60" Header="Тип мероприятия" BorderThickness="2" BorderBrush="#FF0000" Margin="10,0,0,0">
                 <ComboBox Name="CBTypeEv" Height="30"></ComboBox>
                 <ComboBox Name="CBTypeEv" Height="30"></ComboBox>

+ 24 - 28
PP_Ven_MosS/Pages/CreateEvent.xaml.cs

@@ -22,11 +22,17 @@ namespace PP_Ven_MosS.Pages
     /// </summary>
     /// </summary>
     public partial class CreateEvent : Page
     public partial class CreateEvent : Page
     {
     {
+
         public CreateEvent()
         public CreateEvent()
         {
         {
+            
             InitializeComponent();
             InitializeComponent();
             CBTypeEv.ItemsSource = new List<string>() { "Конференция", "Собрания", "Пленарное заседание", "Научная дискуссия", "Экспертно-оценочная сессия", "День открытых дверей", "Студентческое мероприятие" };
             CBTypeEv.ItemsSource = new List<string>() { "Конференция", "Собрания", "Пленарное заседание", "Научная дискуссия", "Экспертно-оценочная сессия", "День открытых дверей", "Студентческое мероприятие" };
             CBTypeEv.SelectedIndex = 0;
             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)
         private void CBPeople_Loaded(object sender, RoutedEventArgs e)
@@ -41,35 +47,33 @@ namespace PP_Ven_MosS.Pages
         
         
         private void Save_Click(object sender, RoutedEventArgs e)
         private void Save_Click(object sender, RoutedEventArgs e)
         {
         {
-            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,
-                
-            };
-            Place_event plev = new Place_event()
-            {
-                id_event = events.Id_event,
-                id_place = Convert.ToInt32(PlaceEv.Text),
-                
-            };
             switch (MessageBox.Show("Уверены в своем решении?", "Организация мероприятия", MessageBoxButton.YesNo))
             switch (MessageBox.Show("Уверены в своем решении?", "Организация мероприятия", MessageBoxButton.YesNo))
             {
             {
                 case MessageBoxResult.Yes:
                 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.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.Place_event.Add(plev);
-                    Database.entities.SaveChanges(); 
+                    Database.entities.SaveChanges();
                     MessageBox.Show("Мероприятие успешно запланировано"); break;
                     MessageBox.Show("Мероприятие успешно запланировано"); break;
 
 
                 case MessageBoxResult.No:
                 case MessageBoxResult.No:
                     MessageBox.Show("Вы отказались от мероприятия");
                     MessageBox.Show("Вы отказались от мероприятия");
                     break;
                     break;
-            }
+            }  
         }
         }
 
 
         private void Exit_Click(object sender, RoutedEventArgs e)
         private void Exit_Click(object sender, RoutedEventArgs e)
@@ -77,14 +81,6 @@ namespace PP_Ven_MosS.Pages
             FrameClass.MainFrame.Navigate(new ApplicationsListUser());
             FrameClass.MainFrame.Navigate(new ApplicationsListUser());
         }
         }
 
 
-        private void PlaceEv_Loaded(object sender, RoutedEventArgs e)
-        {
-            List<Place> places = Database.entities.Place.ToList();
-            foreach (var pla in places)
-            {
-                PlaceEv.Items.Add(pla.title_place);
-            }
-            PlaceEv.SelectedIndex = 0;
-        }
+      
     }
     }
 }
 }

+ 22 - 19
PP_Ven_MosS/Pages/MenuAdmin.xaml

@@ -18,7 +18,7 @@
         <Grid.ColumnDefinitions>
         <Grid.ColumnDefinitions>
             <ColumnDefinition ></ColumnDefinition>
             <ColumnDefinition ></ColumnDefinition>
             <ColumnDefinition ></ColumnDefinition>
             <ColumnDefinition ></ColumnDefinition>
-            
+
         </Grid.ColumnDefinitions>
         </Grid.ColumnDefinitions>
         <StackPanel Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
         <StackPanel Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
             <TextBlock Text="Меню администратора" FontWeight="Bold" FontSize="30" Margin="100,0"></TextBlock>
             <TextBlock Text="Меню администратора" FontWeight="Bold" FontSize="30" Margin="100,0"></TextBlock>
@@ -55,16 +55,16 @@
                         <Border Width="500" Height="150" BorderThickness="1" BorderBrush="Red">
                         <Border Width="500" Height="150" BorderThickness="1" BorderBrush="Red">
                             <StackPanel Orientation="Horizontal">
                             <StackPanel Orientation="Horizontal">
                                 <StackPanel Margin="10,0,0,0" Width="300" Orientation="Vertical" HorizontalAlignment="Left">
                                 <StackPanel Margin="10,0,0,0" Width="300" Orientation="Vertical" HorizontalAlignment="Left">
-                                <TextBlock Text="{Binding Date_app}"/>
-                                <TextBlock Text="{Binding Place_app}"/>
-                                <TextBlock Text="{Binding Path=Application_type.Title_app_type}"/>
-                                <TextBlock Text="{Binding Description}"/>
-                                <TextBlock Text="{Binding Path=User.Surname}"/>
+                                    <TextBlock Text="{Binding Date_app}"/>
+                                    <TextBlock Text="{Binding Place_app}"/>
+                                    <TextBlock Text="{Binding Path=Application_type.Title_app_type}"/>
+                                    <TextBlock Text="{Binding Description}"/>
+                                    <TextBlock Text="{Binding Path=User.Surname}"/>
                                     <TextBlock Text="{Binding Path=Status_application.Title_status_app}" FontWeight="Bold"/>
                                     <TextBlock Text="{Binding Path=Status_application.Title_status_app}" FontWeight="Bold"/>
                                     <GroupBox Header="Назначить исполнителя" FontSize="10" Style="{StaticResource GBSt}" HorizontalAlignment="Right">
                                     <GroupBox Header="Назначить исполнителя" FontSize="10" Style="{StaticResource GBSt}" HorizontalAlignment="Right">
-                                            <ComboBox x:Name="CBEmpl" Height="20" Loaded="CBEmpl_Loaded" SelectionChanged="CBEmpl_SelectionChanged" Uid="{Binding Id_application}"/>
-                                        </GroupBox>
-                                    </StackPanel>
+                                        <ComboBox x:Name="CBEmpl" Height="20" Loaded="CBEmpl_Loaded" SelectionChanged="CBEmpl_SelectionChanged" Uid="{Binding Id_application}"/>
+                                    </GroupBox>
+                                </StackPanel>
                             </StackPanel>
                             </StackPanel>
                         </Border>
                         </Border>
                     </DataTemplate>
                     </DataTemplate>
@@ -79,7 +79,7 @@
                 <ComboBox Name="CB_Sort_event" SelectionChanged="CB_Sort_event_SelectionChanged" Width="200" Height="30" Margin="10,10,0,0"></ComboBox>
                 <ComboBox Name="CB_Sort_event" SelectionChanged="CB_Sort_event_SelectionChanged" Width="200" Height="30" Margin="10,10,0,0"></ComboBox>
                 <ComboBox Name="CB_Filter_event" SelectionChanged="CB_Filter_event_SelectionChanged" Width="200" Height="30" Margin="10,10,0,0"></ComboBox>
                 <ComboBox Name="CB_Filter_event" SelectionChanged="CB_Filter_event_SelectionChanged" Width="200" Height="30" Margin="10,10,0,0"></ComboBox>
             </StackPanel>
             </StackPanel>
-            <ListView Grid.Row="2" Grid.Column="1" Name="EventList" Height="700">
+            <ListView Grid.Row="2" Grid.Column="1" Name="EventList" Height="700" Margin="0,0,20,0" >
                 <ListView.ItemsPanel>
                 <ListView.ItemsPanel>
                     <ItemsPanelTemplate>
                     <ItemsPanelTemplate>
                         <WrapPanel Orientation="Vertical" HorizontalAlignment="Center"/>
                         <WrapPanel Orientation="Vertical" HorizontalAlignment="Center"/>
@@ -88,15 +88,18 @@
                 <ListView.ItemTemplate>
                 <ListView.ItemTemplate>
                     <DataTemplate>
                     <DataTemplate>
                         <Border Width="500" Height="140" BorderThickness="1" BorderBrush="Red">
                         <Border Width="500" Height="140" BorderThickness="1" BorderBrush="Red">
-                            <StackPanel Margin="10,0,0,0" Width="300" HorizontalAlignment="Left" Orientation="Vertical">
-                                <TextBlock Text="{Binding Date_event}"/>
-                                <TextBlock Text="{Binding Place_for_event}" TextWrapping="Wrap"/>
-                                <TextBlock Text="{Binding Title_event}"/>
-                                <TextBlock Text="{Binding Path=Events_type.Title_events_type}"/>
-                                <TextBlock Text="{Binding Description_event}"/>
-                                <TextBlock Text="{Binding Path=User.Surname}"/>
-                                <TextBlock Text="{Binding Path=Status_event.Title_status_event}" FontWeight="Bold"/>
-                                <Button Content="Создать отчет" Click="Report_Click" Name="GoToReport" Style="{StaticResource BtnSt}"></Button>
+                            <StackPanel Orientation="Horizontal">
+                                <StackPanel Margin="10,0,0,0" Width="300" HorizontalAlignment="Left" Orientation="Vertical">
+                                    <TextBlock Text="{Binding Date_event}"/>
+                                    <TextBlock Text="{Binding Place_for_event}" TextWrapping="Wrap"/>
+                                    <TextBlock Text="{Binding Title_event}"/>
+                                    <TextBlock Text="{Binding Path=Events_type.Title_events_type}"/>
+                                    <TextBlock Text="{Binding Description_event}"/>
+                                    <TextBlock Text="{Binding Path=User.Surname}"/>
+                                    <TextBlock Text="{Binding Path=Status_event.Title_status_event}" FontWeight="Bold"/>
+                                    <Button Content="Создать отчет" Click="Report_Click" Name="GoToReport" Style="{StaticResource BtnSt}" Uid="{Binding Id_event}"></Button>
+                                </StackPanel>
+                                <Button VerticalAlignment="Bottom" HorizontalAlignment="Right" Content="Удалить" Name="DeleteBtn" Style="{StaticResource BtnSt}" Click="DeleteBtn_Click" Uid="{Binding Id_event}"></Button>
                             </StackPanel>
                             </StackPanel>
                         </Border>
                         </Border>
                     </DataTemplate>
                     </DataTemplate>

+ 29 - 19
PP_Ven_MosS/Pages/MenuAdmin.xaml.cs

@@ -3,18 +3,8 @@ using PP_Ven_MosS.ModelBase;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
-using System.Net;
-using System.Text;
-using System.Threading.Tasks;
 using System.Windows;
 using System.Windows;
 using System.Windows.Controls;
 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
 namespace PP_Ven_MosS.Pages
 {
 {
@@ -61,7 +51,10 @@ namespace PP_Ven_MosS.Pages
         }
         }
         private void Report_Click(object sender, RoutedEventArgs e)
         private void Report_Click(object sender, RoutedEventArgs e)
         {
         {
-            FrameClass.MainFrame.Navigate(new ReportForEvent());
+            Button btn = (Button)sender;
+            Event evn = DB.Event.FirstOrDefault(x => x.Id_event.ToString() == btn.Uid);
+            if (evn != null)
+                FrameClass.MainFrame.Navigate(new ReportForEvent(evn));
         }
         }
 
 
         private void CBEmpl_SelectionChanged(object sender, SelectionChangedEventArgs e)
         private void CBEmpl_SelectionChanged(object sender, SelectionChangedEventArgs e)
@@ -70,7 +63,8 @@ namespace PP_Ven_MosS.Pages
             ComboBox cb = (ComboBox)sender;
             ComboBox cb = (ComboBox)sender;
             cb.DisplayMemberPath = "Surname";
             cb.DisplayMemberPath = "Surname";
             cb.SelectedValuePath = "Id_user";
             cb.SelectedValuePath = "Id_user";
-            if(cb.Uid != null) { 
+            if (cb.Uid != null)
+            {
                 int appId = int.Parse(cb.Uid);
                 int appId = int.Parse(cb.Uid);
                 Applications ap = DB.Applications.FirstOrDefault(x => x.Id_application == appId);
                 Applications ap = DB.Applications.FirstOrDefault(x => x.Id_application == appId);
                 if (cb.SelectedItem != null)
                 if (cb.SelectedItem != null)
@@ -81,7 +75,7 @@ namespace PP_Ven_MosS.Pages
                         DB.SaveChanges();
                         DB.SaveChanges();
                     }
                     }
                 }
                 }
-                
+
             }
             }
         }
         }
 
 
@@ -94,6 +88,22 @@ namespace PP_Ven_MosS.Pages
         {
         {
             FrameClass.MainFrame.Navigate(new Diagram());
             FrameClass.MainFrame.Navigate(new Diagram());
         }
         }
+
+        private void DeleteBtn_Click(object sender, RoutedEventArgs e)
+        {
+            Button btn = (Button)sender;
+            Event evn = Database.entities.Event.FirstOrDefault(x => x.Id_event.ToString() == btn.Uid);
+            MessageBoxResult mr = MessageBox.Show("Точно ли вы хотите удалить эту запись?", "Удаление", MessageBoxButton.YesNo, MessageBoxImage.Question);
+            switch (mr)
+            {
+                case MessageBoxResult.Yes:
+                    Database.entities.Event.Remove(evn);
+                    Database.entities.SaveChanges(); break;
+                case MessageBoxResult.No:
+                    break;
+            }
+            EventList.ItemsSource = Database.entities.Event.ToList();
+        }
     }
     }
     public partial class MenuAdmin : Page
     public partial class MenuAdmin : Page
     {
     {
@@ -103,15 +113,15 @@ namespace PP_Ven_MosS.Pages
         {
         {
 
 
             InitializeComponent();
             InitializeComponent();
-            
+
             ApplicationList.ItemsSource = DB.Applications.ToList();
             ApplicationList.ItemsSource = DB.Applications.ToList();
             Applications appl = DB.Applications.Where(x => x.Id_status_app == id).FirstOrDefault();
             Applications appl = DB.Applications.Where(x => x.Id_status_app == id).FirstOrDefault();
             CB_Filter_app.ItemsSource = new List<string> { "Фильтр по статусу", "Выполнен", "Не выполнен" };
             CB_Filter_app.ItemsSource = new List<string> { "Фильтр по статусу", "Выполнен", "Не выполнен" };
             CB_Sort_app.ItemsSource = new List<string>() { "Фильтр по дате", "Не сегодня", "Сегодня" };
             CB_Sort_app.ItemsSource = new List<string>() { "Фильтр по дате", "Не сегодня", "Сегодня" };
             CB_Sort_app.SelectedIndex = 0;
             CB_Sort_app.SelectedIndex = 0;
             CB_Filter_app.SelectedIndex = 0;
             CB_Filter_app.SelectedIndex = 0;
-           
-            
+
+
             EventList.ItemsSource = DB.Event.ToList();
             EventList.ItemsSource = DB.Event.ToList();
             Event evnt = DB.Event.Where(x => x.Id_event == id).FirstOrDefault();
             Event evnt = DB.Event.Where(x => x.Id_event == id).FirstOrDefault();
             CB_Filter_event.ItemsSource = new List<string>() { "Фильтр по статусу", "Проведено", "Не проведено" };
             CB_Filter_event.ItemsSource = new List<string>() { "Фильтр по статусу", "Проведено", "Не проведено" };
@@ -119,7 +129,7 @@ namespace PP_Ven_MosS.Pages
             CB_Sort_event.SelectedIndex = 0;
             CB_Sort_event.SelectedIndex = 0;
             CB_Filter_event.SelectedIndex = 0;
             CB_Filter_event.SelectedIndex = 0;
         }
         }
-        
+
         public MenuAdmin(int id)
         public MenuAdmin(int id)
         {
         {
             InitializeComponent();
             InitializeComponent();
@@ -129,7 +139,7 @@ namespace PP_Ven_MosS.Pages
             CB_Sort_app.ItemsSource = DB.Applications.ToList();
             CB_Sort_app.ItemsSource = DB.Applications.ToList();
             CB_Sort_app.SelectedIndex = 0;
             CB_Sort_app.SelectedIndex = 0;
             CB_Filter_app.SelectedIndex = 0;
             CB_Filter_app.SelectedIndex = 0;
-            
+
 
 
             this.id = id;
             this.id = id;
 
 
@@ -141,7 +151,7 @@ namespace PP_Ven_MosS.Pages
             CB_Filter_event.SelectedIndex = 0;
             CB_Filter_event.SelectedIndex = 0;
             this.id = id;
             this.id = id;
         }
         }
-        
+
         private void Filter()
         private void Filter()
         {
         {
             List<Applications> applications = DB.Applications.ToList();
             List<Applications> applications = DB.Applications.ToList();

+ 12 - 6
PP_Ven_MosS/Pages/ReportForEvent.xaml

@@ -21,15 +21,21 @@
                 <GroupBox Width="500" Height="50" Header="Название мероприятия">
                 <GroupBox Width="500" Height="50" Header="Название мероприятия">
                     <TextBlock x:Name="txtTitleEv" MinWidth="500"/>
                     <TextBlock x:Name="txtTitleEv" MinWidth="500"/>
                 </GroupBox>
                 </GroupBox>
-                <GroupBox  Width="500" Height="50" Header="Описание">
-                    <TextBlock x:Name="txtDesc" MinWidth="500" />
-                </GroupBox>
-            <GroupBox Width="500" Height="50" Header="Оценка мероприятия">
-                <TextBox x:Name="txtestimation" MinWidth="500" />
+            <GroupBox  Width="500" Height="50" Header="Описание">
+                <TextBlock x:Name="txtDesc" MinWidth="500" />
+            </GroupBox>
+            <GroupBox Width="500" Height="50" Header="Дата">
+                <TextBlock x:Name="txtDate" MinWidth="500"> </TextBlock>
+            </GroupBox>
+            <GroupBox Width="500" Height="50" Header="Зал">
+                <TextBlock x:Name="txtPlace" MinWidth="500"></TextBlock>
+            </GroupBox>
+            <GroupBox Width="500" Height="50" Header="Ссылка">
+                <TextBox x:Name="txtURL" MinWidth="500"></TextBox>
             </GroupBox>
             </GroupBox>
         </StackPanel>
         </StackPanel>
         <StackPanel Grid.Row="3" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
         <StackPanel Grid.Row="3" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
-            <!--<Button Height="30" Content="Сохранить" FontSize="20" Style="{StaticResource BtnSt}" Name="Save" Click="Save_Click"></Button>-->
+            <Button Height="30" Content="Сохранить" FontSize="20" Style="{StaticResource BtnSt}" Name="Save" Click="Save_Click"></Button>
             <Button Height="30" Content="Выйти" FontSize="20" Style="{StaticResource BtnSt}" Name="Exit" Click="Exit_Click"></Button>
             <Button Height="30" Content="Выйти" FontSize="20" Style="{StaticResource BtnSt}" Name="Exit" Click="Exit_Click"></Button>
         </StackPanel>
         </StackPanel>
     </Grid>
     </Grid>

+ 22 - 36
PP_Ven_MosS/Pages/ReportForEvent.xaml.cs

@@ -1,20 +1,8 @@
 using PP_Ven_MosS.Classes;
 using PP_Ven_MosS.Classes;
 using PP_Ven_MosS.ModelBase;
 using PP_Ven_MosS.ModelBase;
-using System;
-using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using System.Windows;
 using System.Windows;
 using System.Windows.Controls;
 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;
-using System.Xml.Linq;
 
 
 namespace PP_Ven_MosS.Pages
 namespace PP_Ven_MosS.Pages
 {
 {
@@ -23,36 +11,34 @@ namespace PP_Ven_MosS.Pages
     /// </summary>
     /// </summary>
     public partial class ReportForEvent : Page
     public partial class ReportForEvent : Page
     {
     {
-        public Event buffer;
-        public Event changeevent;
-        Event evnt = new Event();
-        Events evnts = new Events();
-        public ReportForEvent(Event Id_Event)
+        public Event Eventedit = null;
+        public ReportForEvent(Event Mer)
         {
         {
-          
             InitializeComponent();
             InitializeComponent();
-            DataContext = Id_Event;
-            buffer = Id_Event;
-            changeevent = Id_Event;
-            int evid = int.Parse(Uid);
-            Event eve = Database.entities.Event.ToList().FirstOrDefault(x => x.Id_event == evid);
-            txtTitleEv.Text = evnt.Title_event;
-            txtDesc.Text = evnt.Description_event;
-          
-        }
-        public ReportForEvent()
-        {
-            InitializeComponent();
-            Sort();
-        }
-        async public void Sort()
-        {
-            List<Event> rectangles = new List<Event>();
-            
+            Eventedit = Mer;
+            txtTitleEv.Text = Mer.Title_event;
+            txtDesc.Text = Mer.Description_event;
+            txtDate.Text = Mer.Date_event.ToString();
+            Place_event pev = Classes.Database.entities.Place_event.FirstOrDefault(x => x.id_event == Mer.Id_event);
+            if (pev != null)
+            {
+                Place pl = Classes.Database.entities.Place.FirstOrDefault(x => x.id_place == pev.id_place);
+                txtPlace.Text = pl.title_place;
+            }
         }
         }
         private void Exit_Click(object sender, RoutedEventArgs e)
         private void Exit_Click(object sender, RoutedEventArgs e)
         {
         {
             FrameClass.MainFrame.Navigate(new MenuAdmin());
             FrameClass.MainFrame.Navigate(new MenuAdmin());
         }
         }
+        private void Save_Click(object sender, RoutedEventArgs e)
+        {
+            if (Eventedit != null)
+            {
+                Event evnt = Classes.Database.entities.Event.FirstOrDefault(x => x.Id_event == Eventedit.Id_event);
+                evnt.media = txtURL.Text;
+                Classes.Database.entities.SaveChanges();
+                MessageBox.Show("Отчет успешно сохранен", "Уведомление", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
+        }
     }
     }
 }
 }