Przeglądaj źródła

Diagramm 50% working and finish score event on 85%

Alexey 6 miesięcy temu
rodzic
commit
aeb9644186

+ 1 - 0
PP_Ven_MosS/Classes/EmployeeID.cs

@@ -9,5 +9,6 @@ namespace PP_Ven_MosS.Classes
     internal class EmployeeID
     {
         public static int employeeid;
+        public static int scores;
     }
 }

+ 1 - 0
PP_Ven_MosS/ModelBase/Event.cs

@@ -29,6 +29,7 @@ namespace PP_Ven_MosS.ModelBase
         public int Id_status_event { get; set; }
         public string media { get; set; }
         public int Id_people { get; set; }
+        public Nullable<int> score { get; set; }
     
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
         public virtual ICollection<Place_event> Place_event { get; set; }

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

@@ -1,4 +1,4 @@
-// Создание кода T4 для модели "C:\Users\vened\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". Это свойство доступно в окне "Свойства", если модель
 // открыта в конструкторе.

+ 3 - 0
PP_Ven_MosS/ModelBase/Model1.edmx

@@ -38,6 +38,7 @@
           <Property Name="Id_status_event" Type="int" Nullable="false" />
           <Property Name="media" Type="varchar(max)" />
           <Property Name="Id_people" Type="int" Nullable="false" />
+          <Property Name="score" Type="int" />
         </EntityType>
         <EntityType Name="Events_type">
           <Key>
@@ -324,6 +325,7 @@
           <NavigationProperty Name="People1" Relationship="PP_MininModel.FK_Event_People" FromRole="Event" ToRole="People" />
           <NavigationProperty Name="Status_event" Relationship="PP_MininModel.FK_Event_Status_event" FromRole="Event" ToRole="Status_event" />
           <NavigationProperty Name="User" Relationship="PP_MininModel.FK_Event_User1" FromRole="Event" ToRole="User" />
+          <Property Name="score" Type="Int32" />
         </EntityType>
         <EntityType Name="Events_type">
           <Key>
@@ -606,6 +608,7 @@
           <EntitySetMapping Name="Event">
             <EntityTypeMapping TypeName="PP_MininModel.Event">
               <MappingFragment StoreEntitySet="Event">
+                <ScalarProperty Name="score" ColumnName="score" />
                 <ScalarProperty Name="Id_people" ColumnName="Id_people" />
                 <ScalarProperty Name="Id_event" ColumnName="Id_event" />
                 <ScalarProperty Name="Description_event" ColumnName="Description_event" />

+ 4 - 1
PP_Ven_MosS/Pages/ApplicationsListAdmin.xaml

@@ -78,7 +78,7 @@
                 </ListView.ItemsPanel>
                 <ListView.ItemTemplate>
                     <DataTemplate>
-                        <Border Width="500" Height="140" BorderThickness="1" BorderBrush="Red">
+                        <Border Width="500" Height="170" BorderThickness="1" BorderBrush="Red">
                             <StackPanel  Width="300" HorizontalAlignment="Left" Orientation="Vertical">
                                 <CheckBox Name="TFE" IsChecked="{Binding status}" Uid="{Binding Id_event}" Checked="TFE_Checked"></CheckBox>
                                 <TextBlock Text="{Binding Date_event}"/>
@@ -88,6 +88,9 @@
                                 <TextBlock Text="{Binding Description_event}"/>
                                 <TextBlock Text="{Binding Path=User.Surname}"/>
                                 <TextBlock Text="{Binding Path=Status_event.Title_status_event}" FontWeight="Bold"/>
+                                <GroupBox Header="Поставить оценку" FontSize="10" Style="{StaticResource GBSt}" HorizontalAlignment="Right">
+                                    <ComboBox x:Name="CBCount" Height="20" SelectionChanged="CBCount_SelectionChanged" Uid="{Binding Id_Event}" Loaded="CBCount_Loaded" />
+                                </GroupBox>
                             </StackPanel>
                         </Border>
                     </DataTemplate>

+ 35 - 2
PP_Ven_MosS/Pages/ApplicationsListAdmin.xaml.cs

@@ -38,6 +38,39 @@ namespace PP_Ven_MosS.Pages
             get { return apptype; }
             set { apptype = value; }
         }
+        private void CBCount_Loaded(object sender, RoutedEventArgs e)
+        {
+            ComboBox comboBox = (ComboBox)sender;
+            comboBox.ItemsSource = new List<string> { "1", "2", "3", "4", "5" };
+            Event ev = Classes.Database.entities.Event.FirstOrDefault(x=>x.Id_event.ToString() == comboBox.Uid);
+            if (ev.score != null)
+            {
+                comboBox.SelectedValue = Convert.ToInt32(ev.score);
+                EmployeeID.scores = Convert.ToInt32(comboBox.SelectedValue);
+            }
+
+        }
+        private void CBCount_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            ComboBox cb = (ComboBox)sender;
+            EventList.SelectedItem = cb.SelectedItem;
+            if (cb.Uid != null)
+            {
+                //int evid = int.Parse(cb.Uid);
+                Event ev = Classes.Database.entities.Event.FirstOrDefault(x=>x.Id_event.ToString() == cb.Uid);
+                if (cb.SelectedItem != null)
+                {
+                    if (ev != null)
+                    {
+                        ev.score = Convert.ToInt32(cb.SelectedValue);
+                        Classes.Database.entities.SaveChanges();
+                    }
+                }
+
+            }
+
+
+        }
     }
     public partial class ApplicationsListAdmin : Page
     {
@@ -47,12 +80,12 @@ namespace PP_Ven_MosS.Pages
         { 
             
             InitializeComponent();
-           
+
             ApplicationList.ItemsSource = DB.Applications.Where(x => x.Id_employee == UserID.userid).ToList();
             CB_Filter_app.ItemsSource = new List<string> { "Фильтр по статусу", "Выполнен", "Не выполнен" };
             CB_Sort_app.ItemsSource = new List<string>() { "Фильтр по дате","Не сегодня", "Сегодня" };
             CB_Sort_app.SelectedIndex = 0;
-            CB_Filter_app.SelectedIndex = 0;
+            CB_Filter_app.SelectedIndex = 0; 
             
             EventList.ItemsSource = DB.Event.ToList();
             Event evnt = DB.Event.Where(x => x.Id_event == id).FirstOrDefault();

+ 2 - 1
PP_Ven_MosS/Pages/ApplicationsListUser.xaml

@@ -81,7 +81,7 @@
                 </ListView.ItemsPanel>
                 <ListView.ItemTemplate>
                     <DataTemplate>
-                        <Border Width="500" Height="140" BorderThickness="1" BorderBrush="Red">
+                        <Border Width="500" Height="150" BorderThickness="1" BorderBrush="Red">
                             <StackPanel Orientation="Horizontal">
                             <StackPanel Margin="10,0,0,0" Width="300" Orientation="Vertical" HorizontalAlignment="Left">
                                     <TextBlock Text="{Binding Date_event,StringFormat=dd.MM.yyyy}"/>
@@ -92,6 +92,7 @@
                                 <TextBlock Text="{Binding Path=User.Surname}"/>
                                     <TextBlock Text="{Binding Path=Status_event.Title_status_event}" FontWeight="Bold"/>
                                     <TextBlock Uid="{Binding Id_event}" Loaded="TextBlock_Loaded"></TextBlock>
+                                    <TextBlock  Text="{Binding score}"></TextBlock>
                                 </StackPanel>
                                 <!--<Button Style="{StaticResource BtnSt}" Name="InfoEv" Click="GoInfoForEvent_Click" Content="Информаия"></Button>-->
                         </StackPanel>

+ 11 - 2
PP_Ven_MosS/Pages/CheckReport.xaml

@@ -8,7 +8,16 @@
       d:DesignHeight="450" d:DesignWidth="800"
       Title="CheckReport">
 
-    <Grid>
-        
+    <Grid x:Name="Report">
+        <Grid.RowDefinitions>
+            <RowDefinition></RowDefinition>
+            <RowDefinition Height="50"></RowDefinition>
+        </Grid.RowDefinitions>
+        <StackPanel Grid.Row="0" Name="diag" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal"></StackPanel>
+        <StackPanel Grid.Row="0" Name="diagr" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal"></StackPanel>
+        <StackPanel Grid.Row="1"  HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
+            <Button Height="30" Content="Сохранить отчет" FontSize="20" Style="{StaticResource BtnSt}" Name="Save" Click="Button_Click" Margin="0,0,10,0"></Button>
+            <Button Height="30" Content="Выйти" FontSize="20" Style="{StaticResource BtnSt}" Name="Exit" Click="Exit_Click"></Button>
+        </StackPanel>
     </Grid>
 </Page>

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

@@ -1,4 +1,11 @@
-using System.Windows.Controls;
+using PP_Ven_MosS.Classes;
+using PP_Ven_MosS.ModelBase;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using System.Windows.Shapes;
 
 namespace PP_Ven_MosS.Pages
 {
@@ -10,6 +17,83 @@ namespace PP_Ven_MosS.Pages
         public CheckReport()
         {
             InitializeComponent();
+            Sort();
+        }
+        async public void Sort()
+        {
+            int k = 0;
+            Place_event plev = Database.entities.Place_event.ToList().FirstOrDefault();
+            List<Rectangle> rectangles = new List<Rectangle>();
+            List<Place> place = Database.entities.Place.ToList();
+            List<Place_event> plevs = Database.entities.Place_event.ToList();
+            int[] mass = new int[plevs.Count];
+
+            foreach (var pl in plevs)
+            {
+                
+                Rectangle newRectangle = new Rectangle();
+                newRectangle.Width = 100;
+                for (int i = 0; i < mass.Length; i++)
+                {
+                   
+                        if (pl.id_place == plev.id_place)
+                        {
+                            k++;
+                        }
+                }
+                
+                newRectangle.Height = k * 30;
+
+                if (k > 5)
+                {
+                    newRectangle.Fill = new SolidColorBrush(Colors.Green);
+                }
+                else if (k < 2)
+                {
+                    newRectangle.Fill = new SolidColorBrush(Colors.Red);
+                }
+                else
+                {
+                    newRectangle.Fill = new SolidColorBrush(Colors.Blue);
+                }
+                newRectangle.Margin = new Thickness(20, 0, 0, 0);
+                newRectangle.VerticalAlignment = VerticalAlignment.Bottom;
+                diag.Children.Add(newRectangle);
+                rectangles.Add(newRectangle);
+            }
+            
+
+            foreach (var pl in place)
+            {
+                if (pl.id_place == plev.id_place)
+                {
+                    TextBlock block = new TextBlock
+                    {
+                        Text = pl.title_place,
+                        HorizontalAlignment = HorizontalAlignment.Center,
+                        VerticalAlignment = VerticalAlignment.Bottom,
+                        Width = 100,
+                        Margin = new Thickness(20, 250, 0, 0)
+                    };
+                    diagr.Children.Add(block);
+                }
+
+            }
+        }
+
+        private void Button_Click(object sender, RoutedEventArgs e)
+        {
+            System.Windows.Controls.PrintDialog printDialog = new PrintDialog();
+            if (printDialog.ShowDialog() == true)
+            {
+                printDialog.PrintVisual(Report, "Отчет");
+            }
+        }
+
+        private void Exit_Click(object sender, RoutedEventArgs e)
+        {
+            FrameClass.MainFrame.Navigate(new MenuAdmin());
         }
     }
 }
+

+ 1 - 1
PP_Ven_MosS/Pages/CreateEvent.xaml.cs

@@ -32,7 +32,7 @@ namespace PP_Ven_MosS.Pages
             PlaceEv.ItemsSource = Database.entities.Place.ToList();
             PlaceEv.DisplayMemberPath = "title_place";
             PlaceEv.SelectedValuePath = "id_place";
-            PlaceEv.SelectedIndex = 0;
+            PlaceEv.SelectedIndex = 0; 
         }
 
         private void CBPeople_Loaded(object sender, RoutedEventArgs e)

+ 1 - 0
PP_Ven_MosS/Pages/MenuAdmin.xaml

@@ -35,6 +35,7 @@
         </StackPanel>
         <StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
             <TextBlock Text="Мероприятия" FontWeight="Bold" FontSize="20"></TextBlock>
+            <Button Content="Отчет" Width="100" Margin="0,0,10,0" Style="{StaticResource BtnSt}" Name="rep" Click="rep_Click"></Button>
         </StackPanel>
         <StackPanel Grid.Row="2" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Top" Orientation="Vertical">
             <StackPanel Orientation="Horizontal" >

+ 5 - 0
PP_Ven_MosS/Pages/MenuAdmin.xaml.cs

@@ -104,6 +104,11 @@ namespace PP_Ven_MosS.Pages
             }
             EventList.ItemsSource = Database.entities.Event.ToList();
         }
+
+        private void rep_Click(object sender, RoutedEventArgs e)
+        {
+            FrameClass.MainFrame.Navigate(new CheckReport());
+        }
     }
     public partial class MenuAdmin : Page
     {