Explorar o código

normal working diagramms for report for event

Alexey hai 6 meses
pai
achega
21de6bb50d

+ 1 - 1
PP_Ven_MosS/App.config

@@ -9,7 +9,7 @@
   </startup>
   <connectionStrings>
 
-  <add name="PP_MininEntities" connectionString="metadata=res://*/ModelBase.Model1.csdl|res://*/ModelBase.Model1.ssdl|res://*/ModelBase.Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=ngknn.ru;initial catalog=PP_Minin;user id=43П;password=444444;multipleactiveresultsets=True;encrypt=True;trustservercertificate=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>
+  <add name="PP_MininEntities" connectionString="metadata=res://*/ModelBase.Model1.csdl|res://*/ModelBase.Model1.ssdl|res://*/ModelBase.Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=sql;initial catalog=PP_Minin;user id=43П;password=444444;multipleactiveresultsets=True;encrypt=True;trustservercertificate=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>
   <entityFramework>
     <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
       <parameters>

+ 4 - 1
PP_Ven_MosS/Pages/ApplicationsListAdmin.xaml.cs

@@ -42,7 +42,7 @@ namespace PP_Ven_MosS.Pages
         {
             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);
+            Event ev = Classes.Database.entities.Event.FirstOrDefault();
             if (ev.score != null)
             {
                 comboBox.SelectedValue = Convert.ToInt32(ev.score);
@@ -93,6 +93,9 @@ namespace PP_Ven_MosS.Pages
             CB_Sort_event.ItemsSource = new List<string>() { "Фильтр по дате", "Не сегодня", "Сегодня" };
             CB_Sort_event.SelectedIndex = 0;
             CB_Filter_event.SelectedIndex = 0;
+
+
+            //надо доделать биндинг, чтобы текст комбобокса был равен значению из базы
         }
         public ApplicationsListAdmin(int id)
         {

+ 69 - 26
PP_Ven_MosS/Pages/CheckReport.xaml.cs

@@ -1,5 +1,6 @@
 using PP_Ven_MosS.Classes;
 using PP_Ven_MosS.ModelBase;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Windows;
@@ -26,22 +27,33 @@ namespace PP_Ven_MosS.Pages
             List<Rectangle> rectangles = new List<Rectangle>();
             List<Place> place = Database.entities.Place.ToList();
             List<Place_event> plevs = Database.entities.Place_event.ToList();
+
+
+            List<Place> p = Database.entities.Place.Distinct().ToList();
+
             int[] mass = new int[plevs.Count];
 
-            foreach (var pl in plevs)
+            foreach (Place pid in p)
             {
-                
-                Rectangle newRectangle = new Rectangle();
-                newRectangle.Width = 100;
-                for (int i = 0; i < mass.Length; i++)
+                TextBlock textBlock = new TextBlock();
+                textBlock.Text = pid.title_place;
+                diagr.Children.Add(textBlock);
+            }
+
+            foreach (Place pid in p)
+            {
+                k = 0;
+                foreach (Place_event pe in plevs)
                 {
-                   
-                        if (pl.id_place == plev.id_place)
-                        {
-                            k++;
-                        }
+                    if (pid.id_place == pe.id_place)
+                    {
+                        k++;
+                    }
                 }
-                
+                Rectangle newRectangle = new Rectangle();
+                newRectangle.Width = 100;
+
+
                 newRectangle.Height = k * 30;
 
                 if (k > 5)
@@ -61,24 +73,55 @@ namespace PP_Ven_MosS.Pages
                 diag.Children.Add(newRectangle);
                 rectangles.Add(newRectangle);
             }
+
+            //foreach (var pl in plevs)
+            //{
+                
+
+
+
+                
+            //    Rectangle newRectangle = new Rectangle();
+            //    newRectangle.Width = 100;
+
+                
+            //    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);
-                }
+            //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)