浏览代码

Реализовано добавление пользователя

user20 7 月之前
父节点
当前提交
f9b65169a8

二进制
src/SASDesktop/Assets/BlackAvatar.png


+ 50 - 0
src/SASDesktop/Popups.cs

@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace SASDesktop
+{
+    /// <summary>
+    /// Класс показывает предупреждения и вопросы через MessageBox
+    /// </summary>
+    class Popups
+    {
+        public static void ShowErrors(List<string> errors)
+        {
+            StringBuilder errorMessage = new StringBuilder();
+
+            errorMessage.AppendLine("Возникли ошибки при выполнении действия");
+            errorMessage.Append(String.Join(";\n", errors));
+            errorMessage.Append(".");
+
+             MessageBox.Show(
+                 errorMessage.ToString(), 
+                 "Ошибки",
+                 MessageBoxButton.OK, 
+                 MessageBoxImage.Error
+             );
+        }
+
+        /// <summary>
+        /// Показывает MessageBox, описывая необходимость подтверждения действия
+        /// </summary>
+        /// <param name="message">
+        /// Действие, которое подтверждается. 
+        /// Должно быть в неопределённой форме, например "удалить Диму"
+        /// </param>
+        /// <returns></returns>
+        public static bool Confirm(string message)
+        {
+            var response = MessageBox.Show(
+                "Вы действительно хотите " + message + "?",
+                "Подтвердите действие",
+                MessageBoxButton.YesNo,
+                MessageBoxImage.Question
+            );
+            return response == MessageBoxResult.Yes;
+        }
+    }
+}

+ 2 - 0
src/SASDesktop/SASDesktop.csproj

@@ -181,6 +181,7 @@
       <DependentUpon>SAS.tt</DependentUpon>
     </Compile>
     <Compile Include="Navigation.cs" />
+    <Compile Include="Popups.cs" />
     <Compile Include="ViewModels\Auth.cs" />
     <Compile Include="ViewModels\Drivers\Create.cs" />
     <Compile Include="ViewModels\Portal.cs" />
@@ -266,6 +267,7 @@
     <Resource Include="Assets\logo.png" />
   </ItemGroup>
   <ItemGroup>
+    <Resource Include="Assets\BlackAvatar.png" />
     <Content Include="Models\SAS.Context.tt">
       <Generator>TextTemplatingFileGenerator</Generator>
       <LastGenOutput>SAS.Context.cs</LastGenOutput>

+ 3 - 0
src/SASDesktop/SASDesktop.csproj.user

@@ -3,4 +3,7 @@
   <PropertyGroup>
     <ProjectView>ProjectFiles</ProjectView>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
+    <StartArguments>--debug</StartArguments>
+  </PropertyGroup>
 </Project>

+ 1 - 0
src/SASDesktop/Styles/Forms.xaml

@@ -2,6 +2,7 @@
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
     <Style x:Key="FormContainer" TargetType="StackPanel">
         <Setter Property="Margin" Value="32,0"/>
+        <Setter Property="MaxWidth" Value="1024"/>
     </Style>
 
     <Style x:Key="FormBody" TargetType="Grid">

+ 255 - 23
src/SASDesktop/ViewModels/Drivers/Create.cs

@@ -2,6 +2,7 @@
 using Prism.Mvvm;
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -11,18 +12,106 @@ namespace SASDesktop.ViewModels.Drivers
 {
     class Create : BindableBase
     {
+        private string _photoPath;
+        private string _name;
+        private string _surname;
+        private string _patron;
+        private string _passSeries;
+        private string _passNumber;
+        private string _addrRegistration;
+        private string _addrLiving;
+        private string _company;
+        private string _jobPosition;
+        private string _phone;
+        private string _mailIndex;
+        private string _emailAddr;
+        private string _comment;
+
+        /// <summary>
+        /// Выбрано ли фото или оно по умолчанию?
+        /// </summary>
+        private bool photoChosen;
+
         #region Свойства
-        public string Name { get; set; }
-        public string Surname { get; set; }
-        public string Patron { get; set; }
-        public string PassSeries { get; set; }
-        public string PassNumber { get; set; }
-        public string AddrRegistration { get; set; }
-        public string AddrLiving { get; set; }
-        public string Company { get; set; }
-        public string JobPosition { get; set; }
-        public string Phone { get; set; }
-        public string EmailAddr { get; set; }
+        public string Name 
+        {   
+            get { return _name; }
+            set { _name = value; RaisePropertyChanged(nameof(Name)); }
+        }
+        
+        public string Surname 
+        { 
+            get { return _surname; }
+            set { _surname = value; RaisePropertyChanged(nameof(Surname)); }
+        }
+
+        public string Patron
+        {
+            get { return _patron; }
+            set { _patron = value; RaisePropertyChanged(nameof(Patron)); }
+        }
+        public string PassSeries
+        {
+            get { return _passSeries; }
+            set { _passSeries = value; RaisePropertyChanged(nameof(PassSeries)); }
+        }
+        public string PassNumber
+        {
+            get { return _passNumber; }
+            set { _passNumber = value; RaisePropertyChanged(nameof(PassNumber)); }
+        }
+        public string AddrRegistration
+        {
+            get { return _addrRegistration; }
+            set { _addrRegistration = value; RaisePropertyChanged(nameof(AddrRegistration)); }
+        }
+        public string AddrLiving
+        {
+            get { return _addrLiving; }
+            set { _addrLiving = value; RaisePropertyChanged(nameof(AddrLiving)); }
+        }
+        public string Company
+        {
+            get { return _company; }
+            set { _company = value; RaisePropertyChanged(nameof(Company)); }
+        }
+        public string JobPosition
+        {
+            get { return _jobPosition; }
+            set { _jobPosition = value; RaisePropertyChanged(nameof(JobPosition)); }
+        }
+        public string Phone
+        {
+            get { return _phone; }
+            set { _phone = value; RaisePropertyChanged(nameof(Phone)); }
+        }
+        public string MailIndex
+        {
+            get { return _mailIndex; }
+            set { _mailIndex = value; RaisePropertyChanged(nameof(MailIndex)); }
+        }
+        public string EmailAddr
+        {
+            get { return _emailAddr; }
+            set { _emailAddr = value; RaisePropertyChanged(nameof(EmailAddr)); }
+        }
+        public string Comment
+        {
+            get { return _comment; }
+            set { _comment = value; RaisePropertyChanged(nameof(Comment)); }
+        }
+        public string PhotoPath 
+        { 
+            get
+            {
+                return _photoPath;
+            }
+            set
+            {
+                _photoPath = value;
+                RaisePropertyChanged(nameof(PhotoPath));
+            }
+        }
         public DelegateCommand ChoosePhotoCmd { get; set; }
         public DelegateCommand CancelCmd { get; set; }
         public DelegateCommand SubmitCmd { get; set; }
@@ -30,18 +119,35 @@ namespace SASDesktop.ViewModels.Drivers
 
         public Create()
         {
-            CancelCmd = new DelegateCommand(CancelExecuted);
+            string[] args = Environment.GetCommandLineArgs();
+            if (args[1] == "--debug")
+            {
+                var rng = new Random();
+                
+                Name = "Вадим";
+                Surname = "Королёв";
+                Patron = "Сергеевич";
+                PassSeries = rng.Next(1111,9999).ToString();
+                PassNumber = rng.Next(111111, 999999).ToString();
+                AddrRegistration = "ул. Школьная д. " + rng.Next(1,100).ToString();
+                AddrLiving = AddrRegistration;
+                Company = "Кока кола";
+                JobPosition = "Проверка качества";
+                Phone = rng.Next(111111, 999999).ToString();
+                EmailAddr = "pydim@mail.ru";
+                MailIndex = rng.Next(111111,999999).ToString();
+                Comment = "random comment " + rng.Next(111111, 999999).ToString();
+            }
+
+            PhotoPath = "/Assets/BlackAvatar.png";
+            CancelCmd = new DelegateCommand(Cancel);
+            ChoosePhotoCmd = new DelegateCommand(ChoosePhoto);
+            SubmitCmd = new DelegateCommand(Submit);
         }
 
-        private void CancelExecuted()
+        private void Cancel()
         {
-            var response = MessageBox.Show(
-                "Действительно отменить создание?", 
-                "Подтвердите действие", 
-                MessageBoxButton.YesNo,
-                MessageBoxImage.Question
-            );
-            if ( response == MessageBoxResult.Yes )
+            if (Popups.Confirm("отменить создание"))
             {
                 Navigation.ToPortal();
             }
@@ -50,13 +156,139 @@ namespace SASDesktop.ViewModels.Drivers
         private void ChoosePhoto()
         {
             // 1. Открыть диалог выбора файла
-            var ofd = new Microsoft.Win32.SaveFileDialog();
-            ofd.Filter = "CSV файлы (*.csv)|*.csv|Все файлы (*.*)|*.*";
+            var ofd = new Microsoft.Win32.OpenFileDialog
+            {
+                Filter = "Изображения (*.png;*.jpg;*.jpeg)|*.png;*.jpg;*.jpeg|Все файлы (*.*)|*.*"
+            };
             if (ofd.ShowDialog() == false)
             {
                 return;
             }
-            string fileName = ofd.FileName;
+
+            // 2. Установить источник изображения на выбранный пользователем
+            PhotoPath = ofd.FileName;
+            photoChosen = true;
+        }
+
+        private async void Submit()
+        {
+            List<string> errors = new List<string>();
+            if (!photoChosen)
+            {
+                errors.Add("Не выбрана фотография водителя");
+            }
+
+            // Проверка заполнения строковых переменных
+            Dictionary<string, string> errorMessages = new Dictionary<string, string>
+            {
+                { nameof(Name), "Имя водителя" },
+                { nameof(Surname), "Фамилия водителя" },
+                { nameof(PassSeries), "Серия паспорта" },
+                { nameof(PassNumber), "Номер паспорта" },
+                { nameof(AddrRegistration), "Адрес регистрации" },
+                { nameof(AddrLiving), "Адрес проживания" },
+                { nameof(MailIndex), "Почтовый индекс" }
+            };
+            foreach (var item in errorMessages)
+            {
+                string value = (string)this.GetType().GetProperty(item.Key).GetValue(this);
+                if (string.IsNullOrEmpty(value) || string.IsNullOrWhiteSpace(value))
+                {
+                    errors.Add("Поле \"" + item.Value + "\" не заполнено");
+                }
+            }
+
+            string photoExtension = Path.GetExtension(_photoPath);
+            string photoName = Path.GetFileNameWithoutExtension(_photoPath);
+
+            string[] allowedExtensions = new string[]
+            {
+                ".png",
+                ".jpg",
+                ".jpeg"
+            };
+            if (!allowedExtensions.Contains(photoExtension))
+            {
+                errors.Add("Фотография водителя - не изображение");
+            }
+
+            if (errors.Count > 0)
+            {
+                Popups.ShowErrors(errors);
+            } else
+            {
+                var db = new Models.SASEntities();
+                
+                // Создать или найти расширение для фото водителя
+                Models.Extension extension = db.Extensions.FirstOrDefault(x => x.Name == photoExtension);
+                if (extension == null)
+                {
+                    extension = new Models.Extension
+                    {
+                        Name = photoExtension
+                    };
+                    db.Extensions.Add(extension);
+                    await db.SaveChangesAsync();
+                }
+
+                // Создать файл фото водителя
+                Models.File driverPhoto = new Models.File
+                {
+                    Name = PhotoPath,
+                    Extension1 = extension,
+                    BinaryData = File.ReadAllBytes(_photoPath)
+                };
+                db.Files.Add(driverPhoto);
+                await db.SaveChangesAsync();
+
+                // Создать или найти компанию в которой водитель работает
+                Models.Company company = db.Companies.FirstOrDefault(x => x.Name == Company);
+                if (company == null)
+                {
+                    company = new Models.Company
+                    {
+                        Name = Company
+                    };
+                    db.Companies.Add(company);
+                    await db.SaveChangesAsync();
+                }
+
+                // Найти или создать позицию работы на которой работает водитель
+                Models.Job driverJob = db.Jobs.FirstOrDefault(j => j.Company == company.ID && j.Name == JobPosition);
+                if (driverJob == null)
+                {
+                    driverJob = new Models.Job
+                    {
+                        Name = JobPosition,
+                        Company = company.ID
+                    };
+                    db.Jobs.Add(driverJob);
+                    await db.SaveChangesAsync();
+                }
+
+                // Создать водителя
+                Models.Citizen driver = new Models.Citizen
+                {
+                    Photo = driverPhoto.ID,
+                    Surname = Surname,
+                    Name = Name,
+                    Patronymic = Patron,
+                    Job = driverJob.ID,
+                    Email = EmailAddr,
+                    Phone = Phone,
+                    PassSeries = PassSeries,
+                    PassNumber = PassNumber,
+                    MailIndex = MailIndex,
+                    RegistrationAddress = AddrRegistration,
+                    Discription = "", // не используем
+                    CurrentAddress = AddrLiving,
+                    Comment = Comment
+                };
+                db.Citizens.Add(driver);
+                await db.SaveChangesAsync();
+
+                Navigation.ToPortal();
+            }
         }
     }
 }

+ 256 - 219
src/SASDesktop/Views/Drivers/Create.xaml

@@ -5,257 +5,293 @@
       xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
       xmlns:local="clr-namespace:SASDesktop.Views.Drivers" xmlns:drivers="clr-namespace:SASDesktop.ViewModels.Drivers" d:DataContext="{d:DesignInstance Type=drivers:Create}"
       mc:Ignorable="d" 
-      d:DesignHeight="600" d:DesignWidth="800"
+      d:DesignHeight="800" d:DesignWidth="800"
       Title="Create">
     <!--Страница создания водителя-->
     <ScrollViewer>
-    <StackPanel
-        CanVerticallyScroll="True"
-        Style="{StaticResource FormContainer}">
-        <TextBlock 
-            HorizontalAlignment="Center"
-            Style="{StaticResource H2}"
-            Text="Создание водителя"/>
-        <StackPanel Orientation="Vertical">
-
-            <!--ФИО-->
-            <Grid>
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="*"/>
-                    <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
+            CanVerticallyScroll="True"
+            Style="{StaticResource FormContainer}">
+        
+            <TextBlock 
+                HorizontalAlignment="Center"
+                Style="{StaticResource H2}"
+                Text="Создание водителя"/>
+        
+            <StackPanel Orientation="Vertical">
+
+                <!--ФИО-->
+                <Grid>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="*"/>
+                        <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>
+
+                        <TextBox
+                            Margin="0,4"
+                            VerticalContentAlignment="Center"
+                            Text="{Binding Surname}"/>
                     </StackPanel>
 
-                    <TextBox
-                        Margin="0,4"
-                        VerticalContentAlignment="Center"
-                        Text="{Binding Surname}"/>
-                </StackPanel>
+                    <!--Имя-->
+                    <StackPanel 
+                        Grid.Column="1"
+                        Margin="4">
 
-                <!--Имя-->
-                <StackPanel 
-                    Grid.Column="1"
-                    Margin="4">
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Style="{StaticResource H5}" Text="Имя"/>
+                            <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                        </StackPanel>
 
-                    <StackPanel Orientation="Horizontal">
-                        <TextBlock Style="{StaticResource H5}" Text="Имя"/>
-                        <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                        <TextBox
+                            Margin="0,4"
+                            VerticalContentAlignment="Center"
+                            Text="{Binding Name}"/>
                     </StackPanel>
 
-                    <TextBox
-                        Margin="0,4"
-                        VerticalContentAlignment="Center"
-                        Text="{Binding Name}"/>
-                </StackPanel>
+                    <!--Отчество-->
+                    <StackPanel 
+                        Grid.Column="2"
+                        Margin="4">
 
-                <!--Отчество-->
-                <StackPanel 
-                    Grid.Column="2"
-                    Margin="4">
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Style="{StaticResource H5}" Text="Отчество"/>
+                        </StackPanel>
 
-                    <StackPanel Orientation="Horizontal">
-                        <TextBlock Style="{StaticResource H5}" Text="Отчество"/>
+                        <TextBox
+                            Margin="0,4"
+                            VerticalContentAlignment="Center"
+                            Text="{Binding Patron}"/>
                     </StackPanel>
+                </Grid>
 
-                    <TextBox
-                        Margin="0,4"
-                        VerticalContentAlignment="Center"
-                        Text="{Binding Patron}"/>
-                </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"/>
+                <!--Паспорт-->
+                <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>
+
+                        <TextBox
+                            Margin="0,4"
+                            VerticalContentAlignment="Center"
+                            Text="{Binding PassSeries}"/>
                     </StackPanel>
 
-                    <TextBox
-                        Margin="0,4"
-                        VerticalContentAlignment="Center"
-                        Text="{Binding PassSeries}"/>
-                </StackPanel>
+                    <!--Номер-->
+                    <StackPanel 
+                        Grid.Column="1"
+                        Margin="4">
 
-                <!--Номер-->
-                <StackPanel 
-                    Grid.Column="1"
-                    Margin="4">
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Style="{StaticResource H5}" Text="Номер паспорта"/>
+                            <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                        </StackPanel>
 
-                    <StackPanel Orientation="Horizontal">
-                        <TextBlock Style="{StaticResource H5}" Text="Номер паспорта"/>
-                        <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                        <TextBox
+                            Margin="0,4"
+                            VerticalContentAlignment="Center"
+                            Text="{Binding PassNumber}"/>
                     </StackPanel>
+                </Grid>
 
-                    <TextBox
-                        Margin="0,4"
-                        VerticalContentAlignment="Center"
-                        Text="{Binding PassNumber}"/>
-                </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"/>
+                <!--Адреса-->
+                <Grid>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="*"/>
+                        <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>
+
+                        <TextBox
+                            TextWrapping="Wrap"
+                            Height="64"
+                            AcceptsReturn="True"
+                            Margin="0,4"
+                            VerticalContentAlignment="Top"
+                            Text="{Binding AddrRegistration}"/>
                     </StackPanel>
 
-                    <TextBox
-                        Margin="0,4"
-                        VerticalContentAlignment="Center"
-                        Text="{Binding AddrRegistration}"/>
-                </StackPanel>
+                    <!--Адрес проживания-->
+                    <StackPanel 
+                        Grid.Column="1"
+                        Margin="4">
+
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Style="{StaticResource H5}" Text="Адрес проживания"/>
+                            <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                        </StackPanel>
+
+                        <TextBox
+                            Height="64"
+                            Margin="0,4"
+                            VerticalContentAlignment="Top"
+                            Text="{Binding AddrLiving}"/>
+                    </StackPanel>
 
-                <!--Адрес проживания-->
-                <StackPanel 
-                    Grid.Column="1"
-                    Margin="4">
+                    <!--Почтовый индекс-->
+                    <StackPanel 
+                        Grid.Column="2"
+                        Margin="4">
 
-                    <StackPanel Orientation="Horizontal">
-                        <TextBlock Style="{StaticResource H5}" Text="Адрес проживания"/>
-                        <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Style="{StaticResource H5}" Text="Почтовый индекс"/>
+                            <Label Style="{StaticResource RequiredMark}" Margin="4,0,0,0"/>
+                        </StackPanel>
+
+                        <TextBox
+                            Margin="0,4"
+                            VerticalContentAlignment="Center"
+                            Text="{Binding MailIndex}"/>
                     </StackPanel>
+                </Grid>
 
-                    <TextBox
-                        Margin="0,4"
-                        VerticalContentAlignment="Center"
-                        Text="{Binding AddrLiving}"/>
-                </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="Место работы"/>
+                <!--Работа-->
+                <Grid>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="*"/>
+                        <ColumnDefinition Width="*"/>
+                    </Grid.ColumnDefinitions>
+
+                    <!--Место работы-->
+                    <StackPanel 
+                        Grid.Column="0"
+                        Margin="4">
+
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Style="{StaticResource H5}" Text="Место работы"/>
+                        </StackPanel>
+
+                        <TextBox
+                            Margin="0,4"
+                            VerticalContentAlignment="Center"
+                            Text="{Binding Company}"/>
                     </StackPanel>
 
-                    <TextBox
-                        Margin="0,4"
-                        VerticalContentAlignment="Center"
-                        Text="{Binding Company}"/>
-                </StackPanel>
+                    <!--Должность-->
+                    <StackPanel 
+                        Grid.Column="1"
+                        Margin="4">
 
-                <!--Должность-->
-                <StackPanel 
-                    Grid.Column="1"
-                    Margin="4">
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Style="{StaticResource H5}" Text="Должность"/>
+                        </StackPanel>
 
-                    <StackPanel Orientation="Horizontal">
-                        <TextBlock Style="{StaticResource H5}" Text="Должность"/>
+                        <TextBox
+                            Margin="0,4"
+                            VerticalContentAlignment="Center"
+                            Text="{Binding JobPosition}"/>
                     </StackPanel>
+                </Grid>
 
-                    <TextBox
-                        Margin="0,4"
-                        VerticalContentAlignment="Center"
-                        Text="{Binding JobPosition}"/>
-                </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="Телефон"/>
+                <!--Контакты-->
+                <Grid>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="*"/>
+                        <ColumnDefinition Width="*"/>
+                    </Grid.ColumnDefinitions>
+
+                    <!--Телефон-->
+                    <StackPanel 
+                        Grid.Column="0"
+                        Margin="4">
+
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Style="{StaticResource H5}" Text="Телефон"/>
+                        </StackPanel>
+
+                        <TextBox
+                            Margin="0,4"
+                            VerticalContentAlignment="Center"
+                            Text="{Binding Phone}"/>
                     </StackPanel>
 
-                    <TextBox
-                        Margin="0,4"
-                        VerticalContentAlignment="Center"
-                        Text="{Binding Phone}"/>
-                </StackPanel>
+                    <!--Адрес email-->
+                    <StackPanel 
+                        Grid.Column="1"
+                        Margin="4">
 
-                <!--Адрес email-->
-                <StackPanel 
-                    Grid.Column="1"
-                    Margin="4">
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Style="{StaticResource H5}" Text="Адрес email"/>
+                        </StackPanel>
 
-                    <StackPanel Orientation="Horizontal">
-                        <TextBlock Style="{StaticResource H5}" Text="Адрес email"/>
+                        <TextBox
+                            Margin="0,4"
+                            VerticalContentAlignment="Center"
+                            Text="{Binding EmailAddr}"/>
                     </StackPanel>
+                </Grid>
 
-                    <TextBox
+                <!--Фотография & примечания-->
+                <Grid>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="200"/>
+                        <ColumnDefinition Width="*"/>
+                    </Grid.ColumnDefinitions>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="Auto"/>
+                        <RowDefinition Height="230"/>
+                        <RowDefinition Height="32"/>
+                    </Grid.RowDefinitions>
+
+                    <Border
+                        BorderBrush="Black"
+                        Grid.Column="0" 
+                        Grid.RowSpan="2"
+                        BorderThickness="1">
+                        <Image Source="{Binding PhotoPath}"/>
+                    </Border>
+                    <Button 
                         Margin="0,4"
-                        VerticalContentAlignment="Center"
-                        Text="{Binding EmailAddr}"/>
-                </StackPanel>
-            </Grid>
-
-            <!--Фотография-->
-            <Grid>
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="200"/>
-                    <ColumnDefinition Width="*"/>
-                </Grid.ColumnDefinitions>
-                <Grid.RowDefinitions>
-                    <RowDefinition Height="230"/>
-                    <RowDefinition Height="32"/>
-                </Grid.RowDefinitions>
-
-                <Border
-                    BorderBrush="Black"
-                    Grid.Column="0" 
-                    Margin="0,4"
-                    BorderThickness="1">
-                    <Image/>
-                </Border>
-                <Button 
-                    Content="Загрузить фото (3 на 4)" 
-                    Grid.Column="0" 
-                    Command="{Binding ChoosePhotoCmd}"
-                    Grid.Row="1"/>
-            </Grid>
+                        Content="Загрузить фото (3 на 4)" 
+                        Grid.Column="0" 
+                        Command="{Binding ChoosePhotoCmd}"
+                        Grid.Row="2"/>
+
+                    <TextBlock
+                        Text="Примечания"
+                        Grid.Column="1"
+                        HorizontalAlignment="Center"
+                        Style="{StaticResource H3}"/>
+                    <TextBox
+                        AcceptsReturn="True"
+                        Grid.Column="1"
+                        Margin="4,0,0,0"
+                        Text="{Binding Comment}"
+                        Grid.Row="1"/>
+                </Grid>
             
-            <!--Сохранить/отмена-->
+                <!--Сохранить/отмена-->
                 <Grid>
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width="*"/>
@@ -263,15 +299,16 @@
                         <ColumnDefinition Width="128"/>
                     </Grid.ColumnDefinitions>
                     <Button 
-                        Grid.Column="1"
-                        Command="{Binding CancelCmd}"
-                        Margin="4">Отмена</Button>
+                    Grid.Column="1"
+                    Command="{Binding CancelCmd}"
+                    Margin="4">Отмена</Button>
                     <Button 
-                        Grid.Column="2"
-                        Command="{Binding SubmitCmd}"
-                        Margin="4">Сохранить</Button>
+                    Grid.Column="2"
+                    Command="{Binding SubmitCmd}"
+                    Margin="4">Сохранить</Button>
                 </Grid>
+                
             </StackPanel>
-    </StackPanel>
+        </StackPanel>
     </ScrollViewer>
 </Page>