Артем Гавриленко hace 3 años
padre
commit
b3e497ce0d

+ 1 - 12
Kusach/AddTransportWindow.xaml.cs

@@ -1,16 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Linq;
 using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
 
 namespace Kusach
 {

+ 7 - 0
Kusach/Kusach.csproj

@@ -70,6 +70,9 @@
     <Compile Include="Pages\DriversListPage.xaml.cs">
       <DependentUpon>DriversListPage.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Pages\TransportListPage.xaml.cs">
+      <DependentUpon>TransportListPage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Windows\AddDriverWindow.xaml.cs">
       <DependentUpon>AddDriverWindow.xaml</DependentUpon>
     </Compile>
@@ -166,6 +169,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Pages\TransportListPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Windows\AddDriverWindow.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 1 - 13
Kusach/MainWindow.xaml.cs

@@ -1,16 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
+using System.Windows;
 
 namespace Kusach
 {

+ 1 - 11
Kusach/Pages/DriversListPage.xaml.cs

@@ -1,17 +1,7 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Linq;
 using System.Windows;
 using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
 using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
 
 namespace Kusach.Pages
 {

+ 1 - 11
Kusach/Pages/RoutesListPage.xaml.cs

@@ -1,17 +1,7 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Linq;
 using System.Windows;
 using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
 using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
 
 namespace Kusach.Pages
 {

+ 72 - 0
Kusach/Pages/TransportListPage.xaml

@@ -0,0 +1,72 @@
+<Page x:Class="Kusach.Pages.TransportListPage"
+      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+      xmlns:local="clr-namespace:Kusach.Pages"
+      mc:Ignorable="d" 
+      d:DesignHeight="419"
+      d:DesignWidth="692"
+      Title="TransportListPage">
+    <Grid 
+        Background="White" 
+        Margin="25">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="4*"/>
+            <RowDefinition Height="21*"/>
+        </Grid.RowDefinitions>
+        <StackPanel Orientation="Horizontal">
+            <TextBox
+                Name="SearchBox"
+                PreviewMouseLeftButtonUp="SearchBoxPreviewMouseLeftButtonUp"
+                LostFocus="SearchLostFocus"
+                TextChanged="SearchTextChanged"
+                FontSize="14"
+                TextWrapping="Wrap"
+                Text="Поиск..." 
+                Width="120"/>
+            <Button
+                Width="120"
+                Content="Создать"
+                Click="AddRouteButton_Click"/>
+            <Button
+                Width="120"
+                Content="Удалить"
+                Click="DeleteRouteButton_Click"/>
+            <Button
+                Width="120"
+                Content="Обновить"
+                Click="UpdateRoutesButton_Click"/>
+        </StackPanel>
+        <DataGrid
+            Name="TransportList" 
+            Grid.Row="1"
+            AutoGenerateColumns="False" 
+            VerticalAlignment="Top" 
+            HorizontalAlignment="Left" 
+            CanUserAddRows="false" Width="642">
+            <DataGrid.ItemContainerStyle>
+                <Style TargetType="DataGridRow">
+                    <EventSetter 
+                        Event="MouseDoubleClick" 
+                        Handler="DataGridRow_MouseDoubleClick"/>
+                </Style>
+            </DataGrid.ItemContainerStyle>
+            <DataGrid.Columns>
+                <DataGridTextColumn 
+                    Binding="{Binding IdTransport}" 
+                    Header="Номер"  
+                    Width="70"
+                    IsReadOnly="True"/>
+                <DataGridTextColumn 
+                    Binding="{Binding NameOfTransport}" 
+                    Header="Название TC"
+                    IsReadOnly="True"/>
+                <DataGridTextColumn 
+                    Binding="{Binding NumberPlate}" 
+                    Header="Номерной знак"
+                    IsReadOnly="True"/>
+            </DataGrid.Columns>
+        </DataGrid>
+    </Grid>
+</Page>

+ 59 - 0
Kusach/Pages/TransportListPage.xaml.cs

@@ -0,0 +1,59 @@
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+
+namespace Kusach.Pages
+{
+    /// <summary>
+    /// Логика взаимодействия для TransportListPage.xaml
+    /// </summary>
+    public partial class TransportListPage : Page
+    {
+        public TransportListPage()
+        {
+            InitializeComponent();
+            TransportList.ItemsSource = cnt.db.Transport.ToList();
+        }
+        private void DataGridRow_MouseDoubleClick(object sender, MouseButtonEventArgs e)
+        {
+            Windows.DriverEditWindow dew = new Windows.DriverEditWindow(((Transport)TransportList.SelectedItem).IdDriver);
+            dew.Show();
+        }
+
+        #region Поиск
+        private void SearchBoxPreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+        {
+            if (SearchBox.Text == "Поиск...")
+                SearchBox.Text = "";
+        }
+        private void SearchLostFocus(object sender, RoutedEventArgs e)
+        {
+            if (SearchBox.Text == "")
+                SearchBox.Text = "Поиск...";
+        }
+        private void SearchTextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (SearchBox.Text != "" && SearchBox.Text != "Поиск...")
+                TransportList.ItemsSource = cnt.db.Transport.Where(item => (item.IdDriver + " " + item.Transport.NameOfTransport + " " + item.Surname + " " + item.Name + " " + item.Patronymic).Contains(SearchBox.Text)).ToList();
+            else
+                cnt.db.Transport.ToList();
+        }
+        #endregion
+        private void AddDriverButton_Click(object sender, RoutedEventArgs e)
+        {
+            AddDriverWindow adw = new AddDriverWindow();
+            adw.Show();
+        }
+
+        private void DeleteTransportButton_Click(object sender, RoutedEventArgs e)
+        {
+
+        }
+
+        private void UpdateTransportButton_Click(object sender, RoutedEventArgs e)
+        {
+            TransportList.ItemsSource = cnt.db.Transport.ToList();
+        }
+    }
+}

+ 1 - 14
Kusach/TestPGPage.xaml.cs

@@ -1,17 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
+using System.Windows.Controls;
 
 namespace Kusach
 {

+ 1 - 11
Kusach/Windows/AddDriverToRouteWindow.xaml.cs

@@ -1,16 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Linq;
 using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
 using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
 
 namespace Kusach.Windows
 {

+ 0 - 10
Kusach/Windows/AddDriverWindow.xaml.cs

@@ -1,16 +1,6 @@
 using System;
-using System.Collections.Generic;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
 
 namespace Kusach
 {

+ 1 - 11
Kusach/Windows/AddPointToRouteWindow.xaml.cs

@@ -1,16 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Linq;
 using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
 using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
 
 namespace Kusach.Windows
 {

+ 1 - 12
Kusach/Windows/AddPointWindow.xaml.cs

@@ -1,16 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Linq;
 using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
 
 namespace Kusach
 {

+ 1 - 12
Kusach/Windows/AddRouteWindow.xaml.cs

@@ -1,16 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Linq;
 using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
 
 namespace Kusach
 {

+ 1 - 1
Kusach/Windows/DriverEditWindow.xaml

@@ -66,7 +66,7 @@
                 Width="190"/>
         </StackPanel>
         <Button 
-            Content="Создать &#xD;&#xA;водителя" 
+            Content="Сохранить" 
             HorizontalAlignment="Left"
             Margin="170,300,0,0" 
             VerticalAlignment="Top" 

+ 0 - 11
Kusach/Windows/DriverEditWindow.xaml.cs

@@ -1,17 +1,6 @@
 using System;
-using System.Collections.Generic;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-
 namespace Kusach.Windows
 {
     /// <summary>

+ 1 - 12
Kusach/Windows/PointEditWindow.xaml.cs

@@ -1,16 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Linq;
 using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
 
 namespace Kusach.Windows
 {

+ 1 - 11
Kusach/Windows/RouteEditWindow.xaml.cs

@@ -1,16 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Linq;
 using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
 using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
 
 namespace Kusach.Windows
 {