|
@@ -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());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|