123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- 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
- {
- /// <summary>
- /// Логика взаимодействия для CheckReport.xaml
- /// </summary>
- public partial class CheckReport : Page
- {
- 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());
- }
- }
- }
|