Selaa lähdekoodia

Merge branch 'Output-Drivers-List' of 21IS12/SAS into master

Королёв Вадим Сергеевич 6 kuukautta sitten
vanhempi
commit
85887f0721

+ 1 - 1
src/SASDesktop/MainWindow.xaml

@@ -7,7 +7,7 @@
         xmlns:root="clr-namespace:SASDesktop" 
         mc:Ignorable="d"
         Icon="Assets/logo.png"
-        Title="ГАС | ГосАвтоСистема" Height="600" Width="800">
+        Title="ГАС | ГосАвтоСистема" Height="600" Width="800" WindowStartupLocation="CenterScreen">
     <Window.Resources>
         <local:Navigation x:Key="Navigator"/>
     </Window.Resources>

+ 21 - 0
src/SASDesktop/Models/SASExt.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http.Headers;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SASDesktop.Models
+{
+    partial class Citizen
+    {
+        public string GetHumanName
+        {
+            get
+            {
+                return $"{Surname} {Name[0]}. {Patronymic[0]}.";
+            }
+
+        }
+    }
+}

+ 1 - 1
src/SASDesktop/Navigation.cs

@@ -66,7 +66,7 @@ namespace SASDesktop
         /// </summary>
         public static void ToDriverListExecuted()
         {
-            throw new NotImplementedException();
+            GetMainFrame().Navigate(new Views.Drivers.DriverListOutput());
         }
         
         /// <summary>

+ 1 - 1
src/SASDesktop/Popups.cs

@@ -35,7 +35,7 @@ namespace SASDesktop
         /// Действие, которое подтверждается. 
         /// Должно быть в неопределённой форме, например "удалить Диму"
         /// </param>
-        /// <returns></returns>
+        /// <returns></returns>        
         public static bool Confirm(string message)
         {
             var response = MessageBox.Show(

+ 9 - 0
src/SASDesktop/SASDesktop.csproj

@@ -168,6 +168,7 @@
       <DesignTime>True</DesignTime>
       <DependentUpon>SAS.edmx</DependentUpon>
     </Compile>
+    <Compile Include="Models\SASExt.cs" />
     <Compile Include="Models\sysdiagram.cs">
       <DependentUpon>SAS.tt</DependentUpon>
     </Compile>
@@ -184,6 +185,7 @@
     <Compile Include="Popups.cs" />
     <Compile Include="ViewModels\Auth.cs" />
     <Compile Include="ViewModels\Drivers\Create.cs" />
+    <Compile Include="ViewModels\Drivers\ListOutput.cs" />
     <Compile Include="ViewModels\Portal.cs" />
     <Compile Include="Views\Auth.xaml.cs">
       <DependentUpon>Auth.xaml</DependentUpon>
@@ -191,6 +193,9 @@
     <Compile Include="Views\Drivers\Create.xaml.cs">
       <DependentUpon>Create.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\Drivers\DriverListOutput.xaml.cs">
+      <DependentUpon>DriverListOutput.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\Portal.cs" />
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
@@ -224,6 +229,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\Drivers\DriverListOutput.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\Portal.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>

+ 28 - 0
src/SASDesktop/ViewModels/Drivers/ListOutput.cs

@@ -0,0 +1,28 @@
+using Prism.Mvvm;
+using SASDesktop.Models;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace SASDesktop.ViewModels.Drivers
+{
+    internal class ListOutput : BindableBase
+    {
+        public ObservableCollection<Citizen> lvOutPutCitizen { get; set; }
+
+        public ListOutput()
+        {
+            UpdateCitizenData();
+        }
+
+        public void UpdateCitizenData()
+        {
+            lvOutPutCitizen = new ObservableCollection<Citizen>(new SASEntities().Citizens.ToList());
+        }
+
+    }
+}

+ 61 - 0
src/SASDesktop/Views/Drivers/DriverListOutput.xaml

@@ -0,0 +1,61 @@
+<Page x:Class="SASDesktop.Views.Drivers.DriverListOutput"
+      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.Drivers"
+      mc:Ignorable="d" 
+      d:DesignHeight="800" d:DesignWidth="800"
+      Title="DriverListOutput">
+    <ScrollViewer>
+        <StackPanel
+            CanVerticallyScroll="True"
+            Style="{StaticResource FormContainer}">
+
+            <TextBlock HorizontalAlignment="Center"
+                       Style="{StaticResource H2}"
+                       Text="Список водителей"/>
+
+            <Grid>
+                <StackPanel 
+                    Height="200">
+                    <ListView ItemsSource="{Binding lvOutPutCitizen}">
+                        <ListView.ItemsPanel>
+                            <ItemsPanelTemplate>
+                                <WrapPanel Orientation="Horizontal"/>
+                            </ItemsPanelTemplate>
+                        </ListView.ItemsPanel>
+                        <ListView.ItemTemplate>
+                            <DataTemplate>
+                                <Border>
+                                    <Grid>
+                                        <Grid.ColumnDefinitions>
+                                            <ColumnDefinition Width="*"/>
+                                            <ColumnDefinition Width="*"/>
+                                            <ColumnDefinition Width="*"/>
+                                        </Grid.ColumnDefinitions>
+                                        <StackPanel>
+                                            <StackPanel Orientation="Horizontal">
+                                                <TextBlock Text="{Binding GetHumanName}" 
+                                                           Style="{StaticResource H4}"/>
+                                            </StackPanel>
+                                            
+                                            <TextBlock Text="{Binding Path=Job1.Name}"/>
+                                            <TextBlock Text="{Binding Path=Job1.Company1.Name}"/>
+                                            <Image Source="{Binding Path=Photo1.BinaryData}"/>
+
+                                        </StackPanel>
+                                        
+
+                                    </Grid>
+                                </Border>
+                            </DataTemplate>
+                        </ListView.ItemTemplate>
+                    </ListView>
+                </StackPanel>
+                
+            </Grid>
+
+        </StackPanel>
+    </ScrollViewer>
+</Page>

+ 30 - 0
src/SASDesktop/Views/Drivers/DriverListOutput.xaml.cs

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