Эх сурвалжийг харах

Начало создания транспортных средств

user 6 сар өмнө
parent
commit
33ae5bd11e

+ 1 - 1
src/SASDesktop/Navigation.cs

@@ -74,7 +74,7 @@ namespace SASDesktop
         /// </summary>
         public static void ToTransportCreateExecuted()
         {
-            throw new NotImplementedException();
+            GetMainFrame().Navigate(new Views.Transport.Create());
         }
         
         /// <summary>

+ 12 - 1
src/SASDesktop/SASDesktop.csproj

@@ -187,6 +187,7 @@
     <Compile Include="ViewModels\Drivers\Create.cs" />
     <Compile Include="ViewModels\Drivers\ListOutput.cs" />
     <Compile Include="ViewModels\Portal.cs" />
+    <Compile Include="ViewModels\Transport\Create.cs" />
     <Compile Include="Views\Auth.xaml.cs">
       <DependentUpon>Auth.xaml</DependentUpon>
     </Compile>
@@ -197,6 +198,9 @@
       <DependentUpon>DriverListOutput.xaml</DependentUpon>
     </Compile>
     <Compile Include="Views\Portal.cs" />
+    <Compile Include="Views\Transport\Create.xaml.cs">
+      <DependentUpon>Create.xaml</DependentUpon>
+    </Compile>
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -237,6 +241,10 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="Views\Transport\Create.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Properties\AssemblyInfo.cs">
@@ -293,7 +301,10 @@
     <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
   </ItemGroup>
   <ItemGroup>
-    <Folder Include="Views\Transport\" />
+    <ProjectReference Include="..\ACTB\Aviad.WPF.Controls.csproj">
+      <Project>{952e558b-6e94-49a5-ba50-ec50c044709c}</Project>
+      <Name>Aviad.WPF.Controls</Name>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 50 - 0
src/SASDesktop/ViewModels/Transport/Create.cs

@@ -0,0 +1,50 @@
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SASDesktop.ViewModels.Transport
+{
+    class Create : BindableBase
+    {
+        private Models.Brand _selectedBrand;
+        private List<Models.Brand> _suggestedBrands;
+        private string _vin;
+        private string _brandSearch;
+
+        public List<Models.Brand> SuggestedBrands
+        {
+            get { return _suggestedBrands; }
+            set { _suggestedBrands = value; RaisePropertyChanged(nameof(SuggestedBrands)); }
+        }
+        public string VIN
+        {
+            get { return _vin; }
+            set { _vin = value; RaisePropertyChanged(nameof(VIN)); }
+        }
+        public string BrandSearch
+        {
+            get => _brandSearch;
+            set 
+            {
+                var db = new Models.SASEntities();
+                _brandSearch = value;
+
+                // Применить фильтр
+                _suggestedBrands.Clear();
+                _suggestedBrands = new List<Models.Brand>(db.Brands.Where(b => b.Name.ToLower().Contains(_brandSearch.ToLower())));
+
+                RaisePropertyChanged(nameof(SuggestedBrands));
+                RaisePropertyChanged(nameof(BrandSearch)); 
+            }
+        }
+
+        public Create() 
+        {
+            var db = new Models.SASEntities();
+            _suggestedBrands = new List<Models.Brand>(db.Brands);
+        }
+    }
+}

+ 1 - 0
src/SASDesktop/Views/Drivers/Create.xaml.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;

+ 98 - 0
src/SASDesktop/Views/Transport/Create.xaml

@@ -0,0 +1,98 @@
+<Page x:Class="SASDesktop.Views.Transport.Create"
+      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:SASDesktop.Views.Transport" xmlns:transport="clr-namespace:SASDesktop.ViewModels.Transport" d:DataContext="{d:DesignInstance Type=transport:Create}"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="Create">
+    <!--Страница создания водителя-->
+    <ScrollViewer>
+        <StackPanel
+            CanVerticallyScroll="True"
+            Style="{StaticResource FormContainer}">
+
+            <TextBlock 
+                HorizontalAlignment="Center"
+                Style="{StaticResource H2}"
+                Text="Создание транспортного средства"/>
+
+            <StackPanel Orientation="Vertical">
+
+                <!--VIN-->
+                <Grid>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="*"/>
+                    </Grid.ColumnDefinitions>
+
+                    <!--Фамилия-->
+                    <StackPanel 
+                        Grid.Column="0"
+                        Margin="4">
+
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Style="{StaticResource H5}" Text="VIN номер"/>
+                            <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                        </StackPanel>
+
+                        <TextBox
+                            Margin="0,4"
+                            VerticalContentAlignment="Center"
+                            Text="{Binding VIN}"/>
+                    </StackPanel>
+                </Grid>
+
+                <!--Марка и модель-->
+                <Grid>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="*"/>
+                        <ColumnDefinition Width="*"/>
+                    </Grid.ColumnDefinitions>
+
+                    <!--Марка (бренд)-->
+                    <StackPanel 
+                        Grid.Column="0"
+                        Margin="4">
+
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Style="{StaticResource H5}" Text="Производитель"/>
+                            <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                        </StackPanel>
+
+                        <StackPanel>
+                            <TextBox x:Name="tbBrand" Text="{Binding BrandSearch,UpdateSourceTrigger=PropertyChanged}"/>
+                            <Popup 
+                                Placement="Bottom"
+                                Width="{Binding RelativeSource={RelativeSource Self},Path=PlacementTarget.ActualWidth}"
+                                PlacementTarget="{Binding ElementName=tbBrand}">
+                                <Popup.Style>
+                                    <Style TargetType="{x:Type Popup}">
+                                        <Setter 
+                                            Property="IsOpen"
+                                            Value="False" />
+                                        <Style.Triggers>
+                                            <DataTrigger 
+                                                Binding="{Binding ElementName=tbBrand,Path=IsFocused}"
+                                                Value="True">
+                                                <Setter Property="IsOpen" Value="True" />
+                                            </DataTrigger>
+                                        </Style.Triggers>
+                                    </Style>
+                                </Popup.Style>
+                                <ListBox ItemsSource="{Binding SuggestedBrands}">
+                                    <ListBox.ItemTemplate>
+                                        <DataTemplate>
+                                            <TextBlock Text="{Binding Name}"/>
+                                        </DataTemplate>
+                                    </ListBox.ItemTemplate>
+                                </ListBox>
+                            </Popup>
+                        </StackPanel>
+                    </StackPanel>
+                </Grid>
+
+            </StackPanel>
+        </StackPanel>
+    </ScrollViewer>
+</Page>

+ 29 - 0
src/SASDesktop/Views/Transport/Create.xaml.cs

@@ -0,0 +1,29 @@
+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;
+
+namespace SASDesktop.Views.Transport
+{
+    /// <summary>
+    /// Логика взаимодействия для Create.xaml
+    /// </summary>
+    public partial class Create : Page
+    {
+        public Create()
+        {
+            InitializeComponent();
+            DataContext = new ViewModels.Transport.Create();
+        }
+    }
+}

+ 6 - 0
src/StateAutoSystem.sln

@@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SASDesktop", "SASDesktop\SA
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataImport", "dataimport\DataImport.csproj", "{B3D00FE0-8A2C-4E9C-97DF-42A634D90747}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aviad.WPF.Controls", "ACTB\Aviad.WPF.Controls.csproj", "{952E558B-6E94-49A5-BA50-EC50C044709C}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -21,6 +23,10 @@ Global
 		{B3D00FE0-8A2C-4E9C-97DF-42A634D90747}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{B3D00FE0-8A2C-4E9C-97DF-42A634D90747}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{B3D00FE0-8A2C-4E9C-97DF-42A634D90747}.Release|Any CPU.Build.0 = Release|Any CPU
+		{952E558B-6E94-49A5-BA50-EC50C044709C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{952E558B-6E94-49A5-BA50-EC50C044709C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{952E558B-6E94-49A5-BA50-EC50C044709C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{952E558B-6E94-49A5-BA50-EC50C044709C}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE