Bläddra i källkod

31.03.2021 -3

gr672_pgv 4 år sedan
förälder
incheckning
7dccd40144

+ 1 - 1
ViolationNOT/AdminPage.xaml.cs

@@ -28,7 +28,7 @@ namespace ViolationNOT
 
         private void BtnShowViolation_Click(object sender, RoutedEventArgs e)
         {
-            ManagerFrame.MainFrame.Navigate(new ViolationPage());
+            ManagerFrame.MainFrame.Navigate(new ViolationPage((sender as Button).DataContext as Violation);
         }
     }
 }

+ 6 - 6
ViolationNOT/ViolationPage.xaml

@@ -25,9 +25,9 @@
                 <RowDefinition/>
             </Grid.RowDefinitions>
             <TextBlock Margin="5">Адресс</TextBlock>
-            <TextBox Grid.Row="1" Text="{Binding Address}" Height="Auto" Margin="5" TextWrapping="Wrap"></TextBox>
+            <TextBlock Grid.Row="1" Text="{Binding Address}" Height="Auto" Margin="5" TextWrapping="Wrap"></TextBlock>
             <TextBlock Grid.Row="2" Margin="5">Описание</TextBlock>
-            <TextBox Grid.Row="3" Text="{Binding Description}" Height="Auto" Margin="5"></TextBox>
+            <TextBlock Grid.Row="3" Text="{Binding Description}" Height="Auto" Margin="5"></TextBlock>
         </Grid>
         <Grid>
             <Grid.RowDefinitions>
@@ -37,12 +37,12 @@
             </Grid.RowDefinitions>
             <TextBlock Text="Тип нарушения"></TextBlock>
             <StackPanel Grid.Row="1">
-                <TextBox Name="TxtCaType" Height="30" Margin="5" ></TextBox>
-                <TextBox x:Name="TxtCarNumber" Margin="5"></TextBox>
+                <TextBlock Text="{Binding ViolationType.TypeName}" Height="30" Margin="5" ></TextBlock>
+                <TextBlock x:Name="TxtCarNumber" Text="{Binding CarNumber}" Margin="5"></TextBlock>
             </StackPanel>
             <Image Grid.Row="3" Name="Photo" Margin="5"></Image>
         </Grid>
-        <Button x:Name="Yes" Grid.Row="1" Margin="5">Одобрить</Button>
-        <Button x:Name="No" Grid.Row="1" Margin="5">Отклонить</Button>
+        <Button x:Name="Yes" Grid.Row="1" Margin="5" Click="Yes_Click">Одобрить</Button>
+        <Button x:Name="No" Grid.Row="1" Grid.Column="1" Margin="5" Click="No_Click">Отклонить</Button>
     </Grid>
 </Page>

+ 18 - 1
ViolationNOT/ViolationPage.xaml.cs

@@ -20,9 +20,26 @@ namespace ViolationNOT
     /// </summary>
     public partial class ViolationPage : Page
     {
-        public ViolationPage()
+        public ViolationPage(Violation violation)
         {
             InitializeComponent();
+            DataContext = violation;
+        }
+
+        private void Yes_Click(object sender, RoutedEventArgs e)
+        {
+            var CurrentViolation = DataContext as Violation;
+            var FindViolation = DB.db.Violation.Find(CurrentViolation.ViolationID);
+            FindViolation.IsReviewed = true;
+            DB.TrySave();
+        }
+
+        private void No_Click(object sender, RoutedEventArgs e)
+        {
+            var CurrentViolation = DataContext as Violation;
+            var FindViolation = DB.db.Violation.Find(CurrentViolation.ViolationID);
+            FindViolation.IsReviewed = false;
+            DB.TrySave();
         }
     }
 }

+ 47 - 15
ViolationNOT/obj/Debug/ViolationPage.g.i.cs

@@ -1,5 +1,5 @@
-// Updated by XamlIntelliSenseFileGenerator 3/31/2021 12:29:59 PM
-#pragma checksum "..\..\ViolationPage.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "B2C5F7EEDA6A6A4F16A1E93BB2B8CB6055C6543173540F08E80E0667BC72D981"
+// Updated by XamlIntelliSenseFileGenerator 3/31/2021 12:36:05 PM
+#pragma checksum "..\..\ViolationPage.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "B1443489D4FBE181BB0D0382B25D639474092A42BA68436C4FEB255C2967AA95"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
@@ -46,6 +46,38 @@ namespace ViolationNOT
 #line default
 #line hidden
 
+
+#line 41 "..\..\ViolationPage.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.TextBlock TxtCarNumber;
+
+#line default
+#line hidden
+
+
+#line 43 "..\..\ViolationPage.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.Image Photo;
+
+#line default
+#line hidden
+
+
+#line 45 "..\..\ViolationPage.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.Button Yes;
+
+#line default
+#line hidden
+
+
+#line 46 "..\..\ViolationPage.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.Button No;
+
+#line default
+#line hidden
+
         private bool _contentLoaded;
 
         /// <summary>
@@ -80,23 +112,23 @@ namespace ViolationNOT
             switch (connectionId)
             {
                 case 1:
-                    this.BtnAddViolation = ((System.Windows.Controls.Button)(target));
-
-#line 28 "..\..\ViolationPage.xaml"
-                    this.BtnAddViolation.Click += new System.Windows.RoutedEventHandler(this.BtnAddViolation_Click);
-
-#line default
-#line hidden
+                    this.TxtCaType = ((System.Windows.Controls.TextBlock)(target));
+                    return;
+                case 2:
+                    this.TxtCarNumber = ((System.Windows.Controls.TextBlock)(target));
+                    return;
+                case 3:
+                    this.Photo = ((System.Windows.Controls.Image)(target));
+                    return;
+                case 4:
+                    this.Yes = ((System.Windows.Controls.Button)(target));
+                    return;
+                case 5:
+                    this.No = ((System.Windows.Controls.Button)(target));
                     return;
             }
             this._contentLoaded = true;
         }
-
-        internal System.Windows.Controls.TextBox TxtCaType;
-        internal System.Windows.Controls.TextBox TxtCarNumber;
-        internal System.Windows.Controls.Image Photo;
-        internal System.Windows.Controls.Button Yes;
-        internal System.Windows.Controls.Button No;
     }
 }