CoreLine.Wpf.CatalogInterfaces 1.0.5

dotnet add package CoreLine.Wpf.CatalogInterfaces --version 1.0.5
                    
NuGet\Install-Package CoreLine.Wpf.CatalogInterfaces -Version 1.0.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CoreLine.Wpf.CatalogInterfaces" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CoreLine.Wpf.CatalogInterfaces" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="CoreLine.Wpf.CatalogInterfaces" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CoreLine.Wpf.CatalogInterfaces --version 1.0.5
                    
#r "nuget: CoreLine.Wpf.CatalogInterfaces, 1.0.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CoreLine.Wpf.CatalogInterfaces@1.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CoreLine.Wpf.CatalogInterfaces&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=CoreLine.Wpf.CatalogInterfaces&version=1.0.5
                    
Install as a Cake Tool

CoreLine.Wpf.CatalogInterfaces

About

CoreLine.Wpf.CatalogInterfaces provides reusable WPF interface components and application patterns for building product catalog, order management, and role-based desktop applications. The package includes examples of catalog presentation, user authentication flow, product filtering, sorting, editing, and order administration for .NET WPF projects.

The library is designed for desktop applications that require structured product management screens, Entity Framework data integration, user role separation, and visual catalog state handling.

Key Features

  • Provides WPF catalog interface examples for product management
  • Supports role-based UI behavior for guests, clients, managers, and administrators
  • Includes product search, filtering, and sorting logic
  • Demonstrates product adding, editing, and deleting workflows
  • Includes order management page examples
  • Supports visual highlighting for discounts and stock availability
  • Provides fallback image handling for missing product photos

How to Use

Install the package into a WPF project and use the included examples as a foundation for building catalog and order management interfaces. The provided source sections demonstrate how to connect WPF pages with an Entity Framework data context, configure role-based visibility, display product information, and navigate between login, catalog, product editing, and order pages.

Source Code

The following sections contain separated source code examples for each project file.

KomarovExam WPF Project

Ниже код проекта из архива KomarovExam.zip, разделённый по файлам. Папки bin, obj, .vs и бинарные ресурсы не вставлялись, потому что это не исходный код.

KomarovExam.csproj

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{9E757A7B-D0DC-44D6-A72B-44B18A7EB3D2}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <RootNamespace>KomarovExam</RootNamespace>
    <AssemblyName>KomarovExam</AssemblyName>
    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <WarningLevel>4</WarningLevel>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <Deterministic>true</Deterministic>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup>
    <ApplicationIcon>icon.ico</ApplicationIcon>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
      <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
    </Reference>
    <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
      <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.ComponentModel.DataAnnotations" />
    <Reference Include="System.Data" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="System.Security" />
    <Reference Include="System.Xml" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xaml">
      <RequiredTargetFramework>4.0</RequiredTargetFramework>
    </Reference>
    <Reference Include="WindowsBase" />
    <Reference Include="PresentationCore" />
    <Reference Include="PresentationFramework" />
  </ItemGroup>
  <ItemGroup>
    <ApplicationDefinition Include="App.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </ApplicationDefinition>
    <Page Include="AddEditWindow.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </Page>
    <Page Include="MainWindow.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Compile Include="AddEditWindow.xaml.cs">
      <DependentUpon>AddEditWindow.xaml</DependentUpon>
    </Compile>
    <Compile Include="App.xaml.cs">
      <DependentUpon>App.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="BD\BazaDan.Context.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>BazaDan.Context.tt</DependentUpon>
    </Compile>
    <Compile Include="BD\BazaDan.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>BazaDan.tt</DependentUpon>
    </Compile>
    <Compile Include="BD\BazaDan.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>BazaDan.edmx</DependentUpon>
    </Compile>
    <Compile Include="BD\City.cs">
      <DependentUpon>BazaDan.tt</DependentUpon>
    </Compile>
    <Compile Include="BD\EdIzmer.cs">
      <DependentUpon>BazaDan.tt</DependentUpon>
    </Compile>
    <Compile Include="BD\Postavshik.cs">
      <DependentUpon>BazaDan.tt</DependentUpon>
    </Compile>
    <Compile Include="BD\Proizvoditeli.cs">
      <DependentUpon>BazaDan.tt</DependentUpon>
    </Compile>
    <Compile Include="BD\PunktVidachi.cs">
      <DependentUpon>BazaDan.tt</DependentUpon>
    </Compile>
    <Compile Include="BD\Role.cs">
      <DependentUpon>BazaDan.tt</DependentUpon>
    </Compile>
    <Compile Include="BD\StatusZakaza.cs">
      <DependentUpon>BazaDan.tt</DependentUpon>
    </Compile>
    <Compile Include="BD\sysdiagrams.cs">
      <DependentUpon>BazaDan.tt</DependentUpon>
    </Compile>
    <Compile Include="BD\Tovar.cs">
      <DependentUpon>BazaDan.tt</DependentUpon>
    </Compile>
    <Compile Include="BD\TovarCategory.cs">
      <DependentUpon>BazaDan.tt</DependentUpon>
    </Compile>
    <Compile Include="BD\User.cs">
      <DependentUpon>BazaDan.tt</DependentUpon>
    </Compile>
    <Compile Include="BD\Zakaz.cs">
      <DependentUpon>BazaDan.tt</DependentUpon>
    </Compile>
    <Compile Include="MainWindow.xaml.cs">
      <DependentUpon>MainWindow.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Compile>
    <Page Include="OrderEditWindow.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </Page>
    <Page Include="OrdersWindow.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </Page>
    <Page Include="ProductsRedactor.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="OrderEditWindow.xaml.cs">
      <DependentUpon>OrderEditWindow.xaml</DependentUpon>
    </Compile>
    <Compile Include="OrdersWindow.xaml.cs">
      <DependentUpon>OrdersWindow.xaml</DependentUpon>
    </Compile>
    <Compile Include="ProductsRedactor.xaml.cs">
      <DependentUpon>ProductsRedactor.xaml</DependentUpon>
    </Compile>
    <Compile Include="Properties\AssemblyInfo.cs">
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <EntityDeploy Include="BD\BazaDan.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>BazaDan.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <None Include="BD\BazaDan.edmx.diagram">
      <DependentUpon>BazaDan.edmx</DependentUpon>
    </None>
    <None Include="packages.config" />
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <None Include="Script\блок схема.drawio" />
    <None Include="Script\блок схема.pdf" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <ItemGroup />
  <ItemGroup>
    <Content Include="BD\BazaDan.Context.tt">
      <Generator>TextTemplatingFileGenerator</Generator>
      <DependentUpon>BazaDan.edmx</DependentUpon>
      <LastGenOutput>BazaDan.Context.cs</LastGenOutput>
    </Content>
    <Content Include="BD\BazaDan.tt">
      <Generator>TextTemplatingFileGenerator</Generator>
      <DependentUpon>BazaDan.edmx</DependentUpon>
      <LastGenOutput>BazaDan.cs</LastGenOutput>
    </Content>
    <Resource Include="icon.ico" />
    <Content Include="Script\KomarovExam.sql" />
    <Resource Include="Script\блок схема.drawio.png" />
    <Resource Include="Resources\1.JPG" />
    <Resource Include="Resources\10.JPG" />
    <Resource Include="Resources\2.JPG" />
    <Resource Include="Resources\3.JPG" />
    <Resource Include="Resources\4.JPG" />
    <Resource Include="Resources\5.JPG" />
    <Resource Include="Resources\6.JPG" />
    <Resource Include="Resources\7.JPG" />
    <Resource Include="Resources\8.JPG" />
    <Resource Include="Resources\9.JPG" />
    <Resource Include="Resources\icon.jpg" />
    <Resource Include="Resources\icon.png" />
    <Resource Include="Resources\picture.png" />
    <Resource Include="Resources\icon.ico" />
  </ItemGroup>
  <ItemGroup>
    <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="EntityFramework" version="6.1.3" targetFramework="net472" />
  <package id="EntityFramework.ru" version="6.1.3" targetFramework="net472" />
</packages>

App.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
  </startup>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>
	<connectionStrings><add name="BazaDan" connectionString="metadata=res://*/BazaDan.BazaDan.csdl|res://*/BazaDan.BazaDan.ssdl|res://*/BazaDan.BazaDan.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=DESKTOP-9BG0DR7\SQLEXPRESS;initial catalog=KomarovExam;integrated security=True;trustservercertificate=True; MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /><add name="KomarovExamEntities" connectionString="metadata=res://*/BD.BazaDan.csdl|res://*/BD.BazaDan.ssdl|res://*/BD.BazaDan.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=DESKTOP-9BG0DR7\SQLEXPRESS;initial catalog=KomarovExam;integrated security=True;trustservercertificate=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>
</configuration>

App.xaml

<Application x:Class="KomarovExam.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:KomarovExam"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
         
    </Application.Resources>
</Application>

App.xaml.cs

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace KomarovExam
{
    /// <summary>
    /// Логика взаимодействия для App.xaml
    /// </summary>
    public partial class App : Application
    {
    }
}

MainWindow.xaml

<Window x:Class="KomarovExam.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:KomarovExam"
        mc:Ignorable="d" Background="#F5DEB3"
        Title="Авторизация" Height="350" Width="500">
    <Grid>
        <StackPanel Width="250"
                HorizontalAlignment="Center"
                VerticalAlignment="Center">
            <TextBlock Text="Авторизация"
                   FontFamily="Arial" FontSize="24" Foreground="White" 
                   HorizontalAlignment="Center"
                   Margin="0 0 0 20"/>
            <TextBlock Text="Логин" FontFamily="Arial" FontSize="14" Foreground="White"  />
            <TextBox x:Name="tbLogin"
                 Height="30" FontFamily="Arial" FontSize="14"  
                 Margin="0 5 0 10"/>
            <TextBlock Text="Пароль" FontFamily="Arial" FontSize="14" Foreground="White"  />
            <PasswordBox x:Name="pbPassword"
                     Height="30" FontFamily="Arial" FontSize="14"  
                     Margin="0 5 0 10"/>
            <Button Content="Войти"
                Height="35" FontFamily="Arial" FontSize="14"  
                Click="BtnLogin_Click" Background="#DEB887" Foreground="White"/>
            <Button Content="Войти как гость"
                Height="35" FontFamily="Arial" FontSize="14"  
                Margin="0 10 0 0"
                Click="BtnGuest_Click" Background="#DEB887" Foreground="White"/>
        </StackPanel>
    </Grid>
</Window>

MainWindow.xaml.cs

using System.Linq;
using System.Windows;
using KomarovExam.BD;
namespace KomarovExam
{
    public partial class MainWindow : Window
    {
        private KomarovExamEntities context;

        public MainWindow()
        {
            InitializeComponent();
            context = new KomarovExamEntities();
        }
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            string enteredLogin = tbLogin.Text.Trim();
            string enteredPassword = pbPassword.Password;
            User current = FindUser(enteredLogin, enteredPassword);
            if (current == null)
            {
                ShowError();
                return;
            }

            OpenProductsPage(current);
        }
        private User FindUser(string login, string password)
        {
            User result = context.User
                .FirstOrDefault(u =>
                    u.Login == login &&
                    u.Password == password);

            return result;
        }
        private void ShowError()
        {
            MessageBox.Show(
                "Неверный логин или пароль",
                "Ошибка входа",
                MessageBoxButton.OK,
                MessageBoxImage.Error);
        }
        private void OpenProductsPage(User user)
        {
            ProductsRedactor window =
                new ProductsRedactor(user);

            window.Show();

            Close();
        }
        private void BtnGuest_Click(object sender, RoutedEventArgs e)
        {
            OpenProductsPage(null);
        }
    }
}

AddEditWindow.xaml

<Window x:Class="KomarovExam.AddEditWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:KomarovExam"
        Title="Добавление / редактирование товара"
        Height="700"
        Width="550"
        Background="#F5DEB3">

    <Grid Margin="10">
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="60"/>
        </Grid.RowDefinitions>

        <ScrollViewer VerticalScrollBarVisibility="Auto">
            <Grid>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="160"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="80"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="140"/>
                    <RowDefinition Height="60"/>
                </Grid.RowDefinitions>

                <TextBlock Text="ID" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center"/>
                <TextBox x:Name="tbId" Grid.Row="0" Grid.Column="1" IsReadOnly="True"/>

                <TextBlock Text="Название" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center"/>
                <TextBox x:Name="tbName" Grid.Row="1" Grid.Column="1"/>

                <TextBlock Text="Категория" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center"/>
                <ComboBox x:Name="cbCategory" Grid.Row="2" Grid.Column="1"/>

                <TextBlock Text="Описание" Grid.Row="3" Grid.Column="0" VerticalAlignment="Top"/>
                <TextBox x:Name="tbDescription" Grid.Row="3" Grid.Column="1"
                         TextWrapping="Wrap"
                         AcceptsReturn="True"/>

                <TextBlock Text="Производитель" Grid.Row="4" Grid.Column="0" VerticalAlignment="Center"/>
                <ComboBox x:Name="cbManufacturer" Grid.Row="4" Grid.Column="1"/>

                <TextBlock Text="Поставщик" Grid.Row="5" Grid.Column="0" VerticalAlignment="Center"/>
                <ComboBox x:Name="cbSupplier" Grid.Row="5" Grid.Column="1"/>

                <TextBlock Text="Цена" Grid.Row="6" Grid.Column="0" VerticalAlignment="Center"/>
                <TextBox x:Name="tbCost" Grid.Row="6" Grid.Column="1"/>

                <TextBlock Text="Ед. изм" Grid.Row="7" Grid.Column="0" VerticalAlignment="Center"/>
                <ComboBox x:Name="cbUnit" Grid.Row="7" Grid.Column="1"/>

                <TextBlock Text="Артикул" Grid.Row="8" Grid.Column="0" VerticalAlignment="Center"/>
                <TextBox x:Name="tbArticle" Grid.Row="8" Grid.Column="1"/>

                <TextBlock Text="Склад" Grid.Row="9" Grid.Column="0" VerticalAlignment="Center"/>
                <TextBox x:Name="tbStock" Grid.Row="9" Grid.Column="1"/>

                <TextBlock Text="Скидка %" Grid.Row="10" Grid.Column="0" VerticalAlignment="Center"/>
                <TextBox x:Name="tbDiscount" Grid.Row="10" Grid.Column="1"/>

                <TextBlock Text="Фото" Grid.Row="11" Grid.Column="0" VerticalAlignment="Top"/>
                <StackPanel Grid.Row="11" Grid.Column="1">
                    <Image x:Name="imgPhoto"
                           Width="137"
                           Height="93"
                           Stretch="Uniform"
                           Margin="0,5"/>
                    <Button Content="Выбрать фото"
                            Click="BtnChooseImage_Click"
                            Background="#DEB887"
                            Foreground="White"/>
                </StackPanel>

            </Grid>
        </ScrollViewer>

        <Button Grid.Row="1"
                Content="Сохранить"
                Height="40"
                Click="Save_Click"
                Background="#DEB887"
                Foreground="White"
                FontSize="14"/>
    </Grid>
</Window>

AddEditWindow.xaml.cs

using System;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Media.Imaging;
using Microsoft.Win32;
using KomarovExam.BD;
namespace KomarovExam
{
    public partial class AddEditWindow : Window
    {
        private KomarovExamEntities _database;
        private Tovar _product;
        private string _photo;
        public AddEditWindow(Tovar product)
        {
            InitializeComponent();
            _database = new KomarovExamEntities();
            _product = product;
            PrepareLists();
            FillFields();
        }
        private void PrepareLists()
        {
            cbCategory.ItemsSource = _database.TovarCategory.ToList();
            cbCategory.DisplayMemberPath = "TovarCategoryName";
            cbCategory.SelectedValuePath = "IDTovarCategory";
            cbManufacturer.ItemsSource = _database.Proizvoditeli.ToList();
            cbManufacturer.DisplayMemberPath = "NameProizvoditelia";
            cbManufacturer.SelectedValuePath = "IDProizvoditelia";
            cbSupplier.ItemsSource = _database.Postavshik.ToList();
            cbSupplier.DisplayMemberPath = "PostavshikName";
            cbSupplier.SelectedValuePath = "IDPostavshik";
            cbUnit.ItemsSource = _database.EdIzmer.ToList();
            cbUnit.DisplayMemberPath = "Edzm";
            cbUnit.SelectedValuePath = "IDEdIzm";
        }
        private void FillFields()
        {
            tbId.Text = _product.IDTovar.ToString();
            tbName.Text = _product.TovarName;
            tbArticle.Text = _product.Article;
            tbDescription.Text = _product.Description;
            tbCost.Text = _product.Cost.ToString();
            tbStock.Text = _product.KolvoNaSklade.ToString();
            tbDiscount.Text = _product.Discount.ToString();
            cbCategory.SelectedValue = _product.IDTovarCategory;
            cbManufacturer.SelectedValue = _product.IDProizvoditelia;
            cbSupplier.SelectedValue = _product.IDPostavshik;
            cbUnit.SelectedValue = _product.IDEdIzm;
            _photo = _product.Image;
            ShowImage();
        }
        private void ShowImage()
        {
            string path;

            if (string.IsNullOrEmpty(_photo))
            {
                path = "/Resources/picture.png";
            }
            else
            {
                path = "/Resources/" + _photo;
            }

            imgPhoto.Source =
                new BitmapImage(new Uri(path, UriKind.Relative));
        }
        private void BtnChooseImage_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter = "Изображения|*.png;*.jpg;*.jpeg";
            if (dialog.ShowDialog() != true)
                return;
            string name = Path.GetFileName(dialog.FileName);
            string folder = Path.Combine(
                AppDomain.CurrentDomain.BaseDirectory,
                "Resources");
                if (!Directory.Exists(folder))
                Directory.CreateDirectory(folder);
            string newFile = Path.Combine(folder, name);
            File.Copy(dialog.FileName, newFile, true);
            _photo = name;
            ShowImage();
        }
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckInput())
                return;
            UpdateProduct();
            try
            {
                _database.SaveChanges();

                DialogResult = true;
                Close();
            }
            catch (System.Data.Entity.Infrastructure.DbUpdateException error)
            {
                MessageBox.Show(
                    error.InnerException?.InnerException?.Message
                    ?? error.Message);
            }
        }
        private bool CheckInput()
        {
            decimal price;
            int count;
            int discount;
            if (!decimal.TryParse(tbCost.Text, out price) ||
                !int.TryParse(tbStock.Text, out count) ||
                !int.TryParse(tbDiscount.Text, out discount))
            {
                MessageBox.Show("Введите корректные числа");
                return false;
            }
            if (price < 0 || count < 0 || discount < 0)
            {
                MessageBox.Show("Значения не могут быть отрицательными");
                return false;
            }
            if (cbCategory.SelectedValue == null ||
                cbManufacturer.SelectedValue == null ||
                cbSupplier.SelectedValue == null ||
                cbUnit.SelectedValue == null)
            {
                MessageBox.Show("Заполните списки");
                return false;
            }


            if (tbArticle.Text.Length != 6)
            {
                MessageBox.Show("Артикул должен содержать 6 символов");
                return false;
            }


            return true;
        }
        private void UpdateProduct()
        {
            if (_product.IDTovar == 0)
            {
                _product.IDTovar =
                    _database.Tovar.Any()
                    ? _database.Tovar.Max(x => x.IDTovar) + 1
                    : 1;
                _database.Tovar.Add(_product);
            }
            _product.TovarName = tbName.Text;
            _product.Description = tbDescription.Text;
            _product.Article = tbArticle.Text;
            _product.Cost = decimal.Parse(tbCost.Text);
            _product.KolvoNaSklade = int.Parse(tbStock.Text);
            _product.Discount = int.Parse(tbDiscount.Text);
            _product.IDTovarCategory =
                (int)cbCategory.SelectedValue;
            _product.IDProizvoditelia =
                (int)cbManufacturer.SelectedValue;
            _product.IDPostavshik =
                (int)cbSupplier.SelectedValue;
            _product.IDEdIzm =
                (int)cbUnit.SelectedValue;
            _product.Image = _photo;
        }
    }
}

ProductsRedactor.xaml

<Window x:Class="KomarovExam.ProductsRedactor"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:KomarovExam"
        Title="Список товаров"
        Height="670"
        Width="1300"
        Background="#F5DEB3">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="120"/>
        </Grid.RowDefinitions>
        <ListView x:Name="lvProducts"
                  Grid.Row="0"
                  FontFamily="Arial"
                  FontSize="14"
                  Margin="10"
                  MouseDoubleClick="lvProducts_MouseDoubleClick">
            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                </Style>
            </ListView.ItemContainerStyle>
            <ListView.ItemTemplate>
                <DataTemplate>
                    <Border BorderBrush="Black"
                            BorderThickness="1"
                            Margin="5"
                            Padding="8"
                            Background="{Binding RowBrush}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="140"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="120"/>
                            </Grid.ColumnDefinitions>
                            <Border Width="120"
                                    Height="120"
                                    BorderBrush="Black"
                                    BorderThickness="1"
                                    HorizontalAlignment="Center">
                                <Image Source="{Binding ImagePath}"
                                       Stretch="Uniform"/>
                            </Border>
                            <StackPanel Grid.Column="1" Margin="10,0">
                                <TextBlock FontWeight="Bold">
                                    <Run Text="{Binding CategoryName}"/>
                                    <Run Text=" | "/>
                                    <Run Text="{Binding TovarName}"/>
                                </TextBlock>
                                <TextBlock TextWrapping="Wrap" Margin="0,3,0,0">
                                    <Run Text="Описание товара: "/>
                                    <Run Text="{Binding Description}"/>
                                </TextBlock>
                                <TextBlock Margin="0,2,0,0">
                                    <Run Text="Производитель: "/>
                                    <Run Text="{Binding Manufacturer}"/>
                                </TextBlock>
                                <TextBlock Margin="0,2,0,0">
                                    <Run Text="Поставщик: "/>
                                    <Run Text="{Binding Supplier}"/>
                                </TextBlock>
                                <TextBlock Margin="0,2,0,0">
                                    <Run Text="Цена: "/>
                                    <Run Text="{Binding Cost}" TextDecorations="Strikethrough"/>
                                    <Run Text=" руб." TextDecorations="Strikethrough"/>
                                </TextBlock>
                                <TextBlock Margin="0,2,0,0">
                                    <Run Text="Ед. изм: "/>
                                    <Run Text="{Binding Unit}"/>
                                </TextBlock>
                                <TextBlock Margin="0,2,0,0">
                                    <Run Text="Склад: "/>
                                    <Run Text="{Binding Stock}"/>
                                </TextBlock>
                                <TextBlock FontWeight="Bold" Margin="0,3,0,0">
                                    <Run Text="Итого: "/>
                                    <Run Text="{Binding FinalPrice}"/>
                                    <Run Text=" руб."/>
                                </TextBlock>
                            </StackPanel>
                            <Border Grid.Column="2"
                                    BorderBrush="#CCC"
                                    BorderThickness="1"
                                    Padding="5"
                                    VerticalAlignment="Center">
                                <StackPanel HorizontalAlignment="Center">
                                    <TextBlock Text="Скидка"
                                               FontWeight="Bold"
                                               TextAlignment="Center"/>
                                    <TextBlock Text="{Binding Discount, StringFormat={}{0}%}"
                                               FontSize="22"
                                               FontWeight="Bold"
                                               Foreground="Red"
                                               HorizontalAlignment="Center"/>
                                </StackPanel>
                            </Border>
                        </Grid>
                    </Border>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
        <Border Grid.Row="1"
        Background="#F5DEB3"
        Padding="10">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <StackPanel Orientation="Horizontal"
                    VerticalAlignment="Center">
                    <TextBox x:Name="tbSearch"
                     Width="224"
                     Height="32"
                     Margin="0,0,10,0"
                     TextChanged="tbSearch_TextChanged"/>
                    <ComboBox x:Name="cbSort"
                      Width="144"
                      Height="32"
                      Margin="0,0,10,0"
                      SelectionChanged="cbSort_SelectionChanged">
                        <ComboBoxItem Content="Цена по возрастанию"/>
                        <ComboBoxItem Content="Цена по убыванию"/>
                        <ComboBoxItem Content="Склад по возрастанию"/>
                        <ComboBoxItem Content="Склад по убыванию"/>
                        <ComboBoxItem Content="Товар по возрастанию"/>
                        <ComboBoxItem Content="Товар по убыванию"/>
                    </ComboBox>
                    <ComboBox x:Name="cbSupplierFilter"
                      Width="149"
                      Height="32"
                      Margin="0,0,10,0"
                      SelectionChanged="cbSupplierFilter_SelectionChanged"/>
                    <Button x:Name="btnAdd"
                    Content="Добавить"
                    Width="120"
                    Background="#DEB887"
                     Foreground="White"
                    Margin="0,0,10,0"
                    Click="Add_Click"/>
                    <Button x:Name="btnDelete"
                    Content="Удалить"
                    Width="120"
                    Margin="0,0,10,0"
                    Background="#DEB887"
                    Foreground="White"
                    Click="Delete_Click"/>
                    <Button x:Name="btnOrders"
                    Content="Заказы"
                    Width="120"
                    Margin="10,0"
                    Click="Orders_Click"
                    Background="#DEB887"
                    Foreground="White"/>
                    <Button Content="Выход"
                    Width="120"
                    Background="#DEB887"
                    Foreground="White"
                    Click="BtnExit_Click"/>
                </StackPanel>
                <StackPanel Grid.Column="1"
                    VerticalAlignment="Center" Margin="0,70,0,0"
                    HorizontalAlignment="Right">
                    <TextBlock x:Name="tbUser"
                       Foreground="White"
                       FontWeight="Bold"
                       FontFamily="Arial"
                       FontSize="14"
                       HorizontalAlignment="Right"/>
                    <TextBlock x:Name="tbRole"
                       Foreground="White"
                       FontFamily="Arial"
                       FontSize="14"
                       HorizontalAlignment="Right"/>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</Window>

ProductsRedactor.xaml.cs

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using KomarovExam.BD;

namespace KomarovExam
{
    public partial class ProductsRedactor : Window
    {
        private KomarovExamEntities _db = new KomarovExamEntities();
        private ObservableCollection<ProductItem> _data = new ObservableCollection<ProductItem>();
        private ICollectionView _view;
        private User _user;
        private AddEditWindow _opened;
        private string _search = "";
        private string _supplier = "Все поставщики";
        private bool _isGuest;
        private bool _isClient;
        private bool _isAdmin;
        private bool _isManager;

        public ProductsRedactor(User user)
        {
            InitializeComponent();

            _user = user;

            DetectRole();
            SetUserInfo();
            SetPermissions();

            LoadData();

            _view = CollectionViewSource.GetDefaultView(_data);
            lvProducts.ItemsSource = _view;
        }

        private void DetectRole()
        {
            _isGuest = (_user == null);

            if (_user != null && _user.Role != null)
            {
                _isClient = (_user.Role.RoleName == "Авторизированный клиент");
                _isAdmin = (_user.Role.RoleName == "Администратор");
                _isManager = (_user.Role.RoleName == "Менеджер");
            }
        }

        private void SetUserInfo()
        {
            if (_user == null)
            {
                tbUser.Text = "Гость";
                tbRole.Text = "Неавторизованный пользователь";
                return;
            }

            tbUser.Text = _user.Familia + " " + _user.Imya + " " + _user.Otchestvo;
            tbRole.Text = _user.Role.RoleName;
        }

        private void SetPermissions()
        {
            if (_isGuest || _isClient)
            {
                tbSearch.Visibility = Visibility.Collapsed;
                cbSupplierFilter.Visibility = Visibility.Collapsed;
                cbSort.Visibility = Visibility.Collapsed;
                btnOrders.Visibility = Visibility.Collapsed;
                btnAdd.Visibility = Visibility.Collapsed;
                btnDelete.Visibility = Visibility.Collapsed;
            }
            else if (_isManager)
            {
                tbSearch.Visibility = Visibility.Visible;
                cbSupplierFilter.Visibility = Visibility.Visible;
                cbSort.Visibility = Visibility.Visible;
                btnOrders.Visibility = Visibility.Visible;
                btnAdd.Visibility = Visibility.Collapsed;
                btnDelete.Visibility = Visibility.Collapsed;
            }
            else if (_isAdmin)
            {
                tbSearch.Visibility = Visibility.Visible;
                cbSupplierFilter.Visibility = Visibility.Visible;
                cbSort.Visibility = Visibility.Visible;
                btnOrders.Visibility = Visibility.Visible;
                btnAdd.Visibility = Visibility.Visible;
                btnDelete.Visibility = Visibility.Visible;
            }
        }

        private void LoadData()
        {
            _data.Clear();

            List<ProductItem> list = new List<ProductItem>();

            foreach (var p in _db.Tovar.ToList())
            {
                decimal cost = p.Cost;
                int discount = p.Discount.HasValue ? p.Discount.Value : 0;
                int stock = p.KolvoNaSklade.HasValue ? p.KolvoNaSklade.Value : 0;

                decimal final = cost - (cost * discount / 100);

                Brush row = Brushes.Transparent;

                if (stock == 0)
                {
                    row = Brushes.LightBlue;
                }
                else
                {
                    if (discount > 17)
                    {
                        row = (Brush)new BrushConverter().ConvertFrom("#FFDEAD");
                    }
                }

                ProductItem item = new ProductItem();
                item.Id = p.IDTovar;
                item.TovarName = p.TovarName;
                item.Description = p.Description;
                item.CategoryName = p.TovarCategory != null ? p.TovarCategory.TovarCategoryName : "";
                item.Manufacturer = p.Proizvoditeli != null ? p.Proizvoditeli.NameProizvoditelia : "";
                item.Supplier = p.Postavshik != null ? p.Postavshik.PostavshikName : "";

                item.Cost = cost;
                item.FinalPrice = final;
                item.Discount = discount;
                item.Unit = p.EdIzmer != null ? p.EdIzmer.Edzm : "";
                item.Stock = stock;
                item.ImagePath = "/Resources/" + (p.Image != null ? p.Image : "picture.png");

                item.RowBrush = row;

                list.Add(item);
            }

            foreach (var x in list)
            {
                _data.Add(x);
            }

            List<string> suppliers = new List<string>();

            foreach (var x in list)
            {
                if (x.Supplier != null && x.Supplier != "")
                {
                    if (!suppliers.Contains(x.Supplier))
                    {
                        suppliers.Add(x.Supplier);
                    }
                }
            }

            suppliers.Sort();
            suppliers.Insert(0, "Все поставщики");

            cbSupplierFilter.ItemsSource = suppliers;
            cbSupplierFilter.SelectedIndex = 0;
            _supplier = "Все поставщики";
        }

        private void ApplyFilter()
        {
            if (_view == null) return;

            _view.Filter = delegate (object obj)
            {
                ProductItem p = obj as ProductItem;
                if (p == null) return false;

                bool searchOk = false;

                if (_search == "")
                {
                    searchOk = true;
                }
                else
                {
                    if ((p.TovarName != null && p.TovarName.ToLower().Contains(_search)) ||
                        (p.Description != null && p.Description.ToLower().Contains(_search)) ||
                        (p.Manufacturer != null && p.Manufacturer.ToLower().Contains(_search)) ||
                        (p.Supplier != null && p.Supplier.ToLower().Contains(_search)))
                    {
                        searchOk = true;
                    }
                }

                bool supplierOk = false;

                if (_supplier == "Все поставщики")
                {
                    supplierOk = true;
                }
                else
                {
                    supplierOk = (p.Supplier == _supplier);
                }

                return searchOk && supplierOk;
            };
        }

        private void tbSearch_TextChanged(object sender, TextChangedEventArgs e)
        {
            _search = tbSearch.Text.ToLower().Trim();
            ApplyFilter();
        }

        private void cbSupplierFilter_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (cbSupplierFilter.SelectedItem == null) return;

            _supplier = cbSupplierFilter.SelectedItem.ToString();
            ApplyFilter();
        }

        private void cbSort_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (_view == null) return;

            _view.SortDescriptions.Clear();

            int i = cbSort.SelectedIndex;

            if (i == 0)
                _view.SortDescriptions.Add(new SortDescription("Cost", ListSortDirection.Ascending));
            else if (i == 1)
                _view.SortDescriptions.Add(new SortDescription("Cost", ListSortDirection.Descending));
            else if (i == 2)
                _view.SortDescriptions.Add(new SortDescription("Stock", ListSortDirection.Ascending));
            else if (i == 3)
                _view.SortDescriptions.Add(new SortDescription("Stock", ListSortDirection.Descending));
            else if (i == 4)
                _view.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
            else if (i == 5)
                _view.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Descending));
        }

        private void lvProducts_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            ProductItem selected = lvProducts.SelectedItem as ProductItem;
            if (selected == null) return;

            if (_isAdmin == false)
            {
                MessageBox.Show("Только администратор может редактировать");
                return;
            }

            var entity = _db.Tovar
                .Include("TovarCategory")
                .Include("Proizvoditeli")
                .Include("Postavshik")
                .Include("EdIzmer")
                .FirstOrDefault(x => x.IDTovar == selected.Id);

            if (entity == null)
            {
                MessageBox.Show("Не найден товар");
                return;
            }

            AddEditWindow win = new AddEditWindow(entity);

            if (win.ShowDialog() == true)
            {
                _db.SaveChanges();
                LoadData();
            }
        }

        private void Add_Click(object sender, RoutedEventArgs e)
        {
            if (_opened != null) return;

            Tovar t = new Tovar();
            _opened = new AddEditWindow(t);

            if (_opened.ShowDialog() == true)
            {
                LoadData();
            }

            _opened = null;
        }

        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            ProductItem selected = lvProducts.SelectedItem as ProductItem;
            if (selected == null) return;

            var entity = _db.Tovar.FirstOrDefault(x => x.IDTovar == selected.Id);
            if (entity == null) return;

            bool used = _db.Zakaz.Any(x => x.IDTovar == entity.IDTovar);
            if (used)
            {
                MessageBox.Show("Нельзя удалить — есть в заказах");
                return;
            }

            if (MessageBox.Show("Удалить товар?", "Внимание",
                MessageBoxButton.YesNo, MessageBoxImage.Warning) != MessageBoxResult.Yes)
                return;

            _db.Tovar.Remove(entity);
            _db.SaveChanges();

            LoadData();
        }

        private void BtnExit_Click(object sender, RoutedEventArgs e)
        {
            MainWindow w = new MainWindow();
            w.Show();
            this.Close();
        }

        public class ProductItem
        {
            public int Id { get; set; }

            public string CategoryName { get; set; }
            public string TovarName { get; set; }
            public string Description { get; set; }

            public string Manufacturer { get; set; }
            public string Supplier { get; set; }

            public decimal Cost { get; set; }

            public decimal FinalPrice { get; set; }

            public int Discount { get; set; }

            public string Unit { get; set; }
            public int Stock { get; set; }

            public string ImagePath { get; set; }

            public Brush RowBrush { get; set; }
        }

        private void Orders_Click(object sender, RoutedEventArgs e)
        {
            OrdersWindow window = new OrdersWindow(_user);
            window.Show();
            this.Close();
        }
    }
}

OrdersWindow.xaml

<Window x:Class="KomarovExam.OrdersWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Заказы"
        Height="600"
        Width="900"
        Background="#F5DEB3">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="60"/>
        </Grid.RowDefinitions>
        <ListView x:Name="lvOrders"
                  MouseDoubleClick="lvOrders_MouseDoubleClick"
                  Margin="10">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <Border BorderBrush="Black"
                BorderThickness="1"
                Margin="5"
                Padding="10">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="180" />
                            </Grid.ColumnDefinitions>
                            <StackPanel Grid.Column="0">
                                <TextBlock Text="{Binding Article}"
                               FontWeight="Bold"
                               FontSize="14"/>
                                <TextBlock>
                        <Run Text="Статус: "/>
                        <Run Text="{Binding Status}"/>
                                </TextBlock>
                                <TextBlock TextWrapping="Wrap">
                        <Run Text="Адрес пункта выдачи: "/>
                        <Run Text="{Binding Address}"/>
                                </TextBlock>
                                <TextBlock>
                        <Run Text="Дата заказа: "/>
                        <Run Text="{Binding OrderDate}"/>
                                </TextBlock>
                            </StackPanel>
                            <Border Grid.Column="1"
                        BorderBrush="Black"
                        BorderThickness="1"
                        Margin="10,0,0,0"
                        Padding="10"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch">
                                <StackPanel HorizontalAlignment="Center"
                                VerticalAlignment="Center">
                                    <TextBlock Text="Дата доставки"
                                   FontWeight="Bold"
                                   HorizontalAlignment="Center"/>
                                    <TextBlock Text="{Binding DeliveryDate}"
                                   FontSize="14"
                                   HorizontalAlignment="Center"/>
                                </StackPanel>
                            </Border>
                        </Grid>
                    </Border>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
        <StackPanel Grid.Row="1"
                    Orientation="Horizontal"
                    HorizontalAlignment="Center">
            <Button x:Name="btnAdd"
                    Content="Добавить заказ"
                    Width="140"
                    Margin="10"
                    Background="#DEB887"
                    Foreground="White"
                    Click="Add_Click"/>
            <Button x:Name="btnDelete"
                    Content="Удалить"
                    Width="120"
                    Margin="10"
                    Background="#DEB887"
                    Foreground="White"
                    Click="Delete_Click"/>
            <Button Content="Назад"
                    Width="120"
                    Height="39"
                    Background="#DEB887"
                    Foreground="White"
                    Click="Back_Click"/>
        </StackPanel>
    </Grid>
</Window>

OrdersWindow.xaml.cs

using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using KomarovExam.BD;

namespace KomarovExam
{
    public partial class OrdersWindow : Window
    {
        private KomarovExamEntities db = new KomarovExamEntities();
        private ObservableCollection<OrderItem> list;

        private User currentUser;

        public OrdersWindow(User user)
        {
            InitializeComponent();

            currentUser = user;

            LoadOrders();

            if (currentUser == null || currentUser.Role.RoleName != "Администратор")
            {
                btnAdd.Visibility = Visibility.Collapsed;
                btnDelete.Visibility = Visibility.Collapsed;
            }
        }

        private void ReloadDb()
        {
            db.Dispose();
            db = new KomarovExamEntities();
        }

        private void LoadOrders()
        {
            list = new ObservableCollection<OrderItem>();

            foreach (var item in db.Zakaz.AsNoTracking().ToList())
            {
                string address = "";

                if (item.PunktVidachi != null)
                {
                    address =
                        item.PunktVidachi.AdressIndex + ", " +
                        item.PunktVidachi.Street + " " +
                        (item.PunktVidachi.StreetNumber.HasValue
                            ? item.PunktVidachi.StreetNumber.ToString()
                            : "");
                }

                list.Add(new OrderItem
                {
                    Id = item.IDZakaza,
                    Number = item.NomerZakaza.ToString(),
                    Article = item.Tovar != null ? item.Tovar.Article : "",
                    Status = item.StatusZakaza != null ? item.StatusZakaza.StatusZakazaName : "",
                    Address = address,
                    OrderDate = item.DateZakaza,
                    DeliveryDate = item.DateDelivery,
                    Count = item.Kolvo ?? 0
                });
            }

            lvOrders.ItemsSource = null;
            lvOrders.ItemsSource = list;
        }

        private void Add_Click(object sender, RoutedEventArgs e)
        {
            if (currentUser == null)
            {
                MessageBox.Show("Нет пользователя");
                return;
            }

            var window = new OrderEditWindow(db, null, currentUser);

            if (window.ShowDialog() == true)
            {
                LoadOrders(); 
            }
        }
        private void lvOrders_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (currentUser.Role.RoleName != "Администратор")
                return;

            OrderItem selected = lvOrders.SelectedItem as OrderItem;
            if (selected == null) return;

            var order = db.Zakaz.First(x => x.IDZakaza == selected.Id);

            var window = new OrderEditWindow(db, order, currentUser);

            if (window.ShowDialog() == true)
            {
                LoadOrders();
            }
        }
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            OrderItem selected = lvOrders.SelectedItem as OrderItem;
            if (selected == null) return;

            Zakaz order = db.Zakaz.First(x => x.IDZakaza == selected.Id);

            if (MessageBox.Show("Удалить заказ?", "Подтверждение",
                MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                db.Zakaz.Remove(order);
                db.SaveChanges();

                ReloadDb();   
                LoadOrders(); 
            }
        }

        private void Back_Click(object sender, RoutedEventArgs e)
        {
            ProductsRedactor p = new ProductsRedactor(currentUser);
            p.Show();
            Close();
        }

        public class OrderItem
        {
            public int Id { get; set; }
            public string Number { get; set; }
            public string Article { get; set; }
            public string Status { get; set; }
            public string Address { get; set; }
            public DateTime? OrderDate { get; set; }
            public DateTime? DeliveryDate { get; set; }
            public int Count { get; set; }
        }
    }
}

OrderEditWindow.xaml

<Window x:Class="KomarovExam.OrderEditWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Заказ"
        Height="500"
        Width="450"
        Background="#F5DEB3">
    <Grid Margin="10">
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="60"/>
        </Grid.RowDefinitions>
        <ScrollViewer>
            <StackPanel>
                <TextBlock Text="Номер заказа"/>
                <TextBox x:Name="tbNumber"
         IsReadOnly="True"
         Background="#EEE"/>
                <TextBlock Text="Клиент"/>
                <ComboBox x:Name="cbUser"
          DisplayMemberPath="Login"
          SelectedValuePath="IDUser"/>
                <TextBlock Text="Товар"/>
                <ComboBox x:Name="cbTovar"/>
                <TextBlock Text="Количество"/>
                <TextBox x:Name="tbCount"/>
                <TextBlock Text="Статус"/>
                <ComboBox x:Name="cbStatus"/>
                <TextBlock Text="Пункт выдачи"/>
                <ComboBox x:Name="cbPunkt"/>
                <TextBlock Text="Дата заказа"/>
                <DatePicker x:Name="dpOrder"/>
                <TextBlock Text="Дата выдачи"/>
                <DatePicker x:Name="dpDelivery"/>
                <TextBlock Text="Код получения"/>
                <TextBox x:Name="tbCode"/>
            </StackPanel>
        </ScrollViewer>
        <Button Grid.Row="1"
                Content="Сохранить"
                Height="40"
                Click="Save_Click"
                Background="#DEB887"
                Foreground="White"/>
    </Grid>
</Window>

OrderEditWindow.xaml.cs

using System;
using System.Linq;
using System.Windows;
using KomarovExam.BD;
namespace KomarovExam
{
    public partial class OrderEditWindow : Window
    {
        private KomarovExamEntities _db;
        private Zakaz _order;
        private User _currentUser;
        public OrderEditWindow(KomarovExamEntities db, Zakaz order, User currentUser)
        {
            InitializeComponent();
            _db = db;
            _currentUser = currentUser;
            _order = order ?? new Zakaz();
            LoadCombos();
            LoadData();
        }
        private void LoadCombos()
        {
            cbTovar.ItemsSource = _db.Tovar.ToList();
            cbTovar.DisplayMemberPath = "TovarName";
            cbTovar.SelectedValuePath = "IDTovar";
            cbStatus.ItemsSource = _db.StatusZakaza.ToList();
            cbStatus.DisplayMemberPath = "StatusZakazaName";
            cbStatus.SelectedValuePath = "IDStatusZakaza";
            cbPunkt.ItemsSource = _db.PunktVidachi
                .ToList()
                .Select(x => new
                {
                    x.IDPunktVidashi,
                    Full = x.AdressIndex + ", " + x.Street + " " +
                           (x.StreetNumber.HasValue ? x.StreetNumber.ToString() : "")
                })
                .ToList();
            cbPunkt.DisplayMemberPath = "Full";
            cbPunkt.SelectedValuePath = "IDPunktVidashi";
            cbUser.ItemsSource = _db.User.ToList();
            cbUser.DisplayMemberPath = "Login";
            cbUser.SelectedValuePath = "IDUser";
        }

        private int GenerateOrderNumber()
        {
            return _db.Zakaz.Any()
                ? _db.Zakaz.Max(x => x.NomerZakaza) + 1
                : 1;
        }
        private void LoadData()
        {
            if (_order.IDZakaza == 0)
            {
                tbNumber.Text = GenerateOrderNumber().ToString();
                cbUser.SelectedValue = _currentUser.IDUser;
                return;
            }
            tbNumber.Text = _order.NomerZakaza.ToString();
            tbCount.Text = _order.Kolvo?.ToString() ?? "";
            tbCode.Text = _order.CodePolushenia?.ToString() ?? "";
            dpOrder.SelectedDate = _order.DateZakaza;
            dpDelivery.SelectedDate = _order.DateDelivery;
            cbTovar.SelectedValue = _order.IDTovar;
            cbStatus.SelectedValue = _order.IDStatusZakaza;
            cbPunkt.SelectedValue = _order.IDPunktVidashi;
            cbUser.SelectedValue = _order.IDUser;
        }
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (cbUser.SelectedValue == null)
                {
                    MessageBox.Show("Выберите пользователя");
                    return;
                }
                if (_order.IDZakaza == 0)
                {
                    _order.NomerZakaza = GenerateOrderNumber();
                    _db.Zakaz.Add(_order);
                }
                _order.Kolvo = string.IsNullOrWhiteSpace(tbCount.Text)
                    ? (int?)null
                    : int.Parse(tbCount.Text);

                _order.CodePolushenia = string.IsNullOrWhiteSpace(tbCode.Text)
                    ? (int?)null
                    : int.Parse(tbCode.Text);
                _order.DateZakaza = dpOrder.SelectedDate;
                _order.DateDelivery = dpDelivery.SelectedDate;
                _order.IDTovar = (int)cbTovar.SelectedValue;
                _order.IDStatusZakaza = (int)cbStatus.SelectedValue;
                _order.IDPunktVidashi = (int)cbPunkt.SelectedValue;
                _order.IDUser = (int)cbUser.SelectedValue;
                _db.SaveChanges();
                DialogResult = true;
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.InnerException?.Message ?? ex.Message);
            }
        }
    }
}

BD/BazaDan.Context.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     Этот код создан по шаблону.
//
//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace KomarovExam.BD
{
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Infrastructure;
    
    public partial class KomarovExamEntities : DbContext
    {
        public KomarovExamEntities()
            : base("name=KomarovExamEntities")
        {
        }
    
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            throw new UnintentionalCodeFirstException();
        }
    
        public virtual DbSet<City> City { get; set; }
        public virtual DbSet<EdIzmer> EdIzmer { get; set; }
        public virtual DbSet<Postavshik> Postavshik { get; set; }
        public virtual DbSet<Proizvoditeli> Proizvoditeli { get; set; }
        public virtual DbSet<PunktVidachi> PunktVidachi { get; set; }
        public virtual DbSet<Role> Role { get; set; }
        public virtual DbSet<StatusZakaza> StatusZakaza { get; set; }
        public virtual DbSet<sysdiagrams> sysdiagrams { get; set; }
        public virtual DbSet<Tovar> Tovar { get; set; }
        public virtual DbSet<TovarCategory> TovarCategory { get; set; }
        public virtual DbSet<User> User { get; set; }
        public virtual DbSet<Zakaz> Zakaz { get; set; }
    }
}

BD/BazaDan.Context.tt

<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
 output extension=".cs"#><#

const string inputFile = @"BazaDan.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors);
var itemCollection = loader.CreateEdmItemCollection(inputFile);
var modelNamespace = loader.GetModelNamespace(inputFile);
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);

var container = itemCollection.OfType<EntityContainer>().FirstOrDefault();
if (container == null)
{
    return string.Empty;
}
#>
//------------------------------------------------------------------------------
// <auto-generated>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
//
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
// </auto-generated>
//------------------------------------------------------------------------------

<#

var codeNamespace = code.VsNamespaceSuggestion();
if (!String.IsNullOrEmpty(codeNamespace))
{
#>
namespace <#=code.EscapeNamespace(codeNamespace)#>
{
<#
    PushIndent("    ");
}

#>
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
<#
if (container.FunctionImports.Any())
{
#>
using System.Data.Entity.Core.Objects;
using System.Linq;
<#
}
#>

<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : DbContext
{
    public <#=code.Escape(container)#>()
        : base("name=<#=container.Name#>")
    {
<#
if (!loader.IsLazyLoadingEnabled(container))
{
#>
        this.Configuration.LazyLoadingEnabled = false;
<#
}

foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
{
    // Note: the DbSet members are defined below such that the getter and
    // setter always have the same accessibility as the DbSet definition
    if (Accessibility.ForReadOnlyProperty(entitySet) != "public")
    {
#>
        <#=codeStringGenerator.DbSetInitializer(entitySet)#>
<#
    }
}
#>
    }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        throw new UnintentionalCodeFirstException();
    }

<#
    foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
    {
#>
    <#=codeStringGenerator.DbSet(entitySet)#>
<#
    }

    foreach (var edmFunction in container.FunctionImports)
    {
        WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: false);
    }
#>
}
<#

if (!String.IsNullOrEmpty(codeNamespace))
{
    PopIndent();
#>
}
<#
}
#>
<#+

private void WriteFunctionImport(TypeMapper typeMapper, CodeStringGenerator codeStringGenerator, EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
    if (typeMapper.IsComposable(edmFunction))
    {
#>

    [DbFunction("<#=edmFunction.NamespaceName#>", "<#=edmFunction.Name#>")]
    <#=codeStringGenerator.ComposableFunctionMethod(edmFunction, modelNamespace)#>
    {
<#+
        codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
#>
        <#=codeStringGenerator.ComposableCreateQuery(edmFunction, modelNamespace)#>
    }
<#+
    }
    else
    {
#>

    <#=codeStringGenerator.FunctionMethod(edmFunction, modelNamespace, includeMergeOption)#>
    {
<#+
        codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
#>
        <#=codeStringGenerator.ExecuteFunction(edmFunction, modelNamespace, includeMergeOption)#>
    }
<#+
        if (typeMapper.GenerateMergeOptionFunction(edmFunction, includeMergeOption))
        {
            WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: true);
        }
    }
}

public void WriteFunctionParameter(string name, string isNotNull, string notNullInit, string nullInit)
{
#>
        var <#=name#> = <#=isNotNull#> ?
            <#=notNullInit#> :
            <#=nullInit#>;

<#+
}

public const string TemplateId = "CSharp_DbContext_Context_EF6";

public class CodeStringGenerator
{
    private readonly CodeGenerationTools _code;
    private readonly TypeMapper _typeMapper;
    private readonly MetadataTools _ef;

    public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
    {
        ArgumentNotNull(code, "code");
        ArgumentNotNull(typeMapper, "typeMapper");
        ArgumentNotNull(ef, "ef");

        _code = code;
        _typeMapper = typeMapper;
        _ef = ef;
    }

    public string Property(EdmProperty edmProperty)
    {
        return string.Format(
            CultureInfo.InvariantCulture,
            "{0} {1} {2} {{ {3}get; {4}set; }}",
            Accessibility.ForProperty(edmProperty),
            _typeMapper.GetTypeName(edmProperty.TypeUsage),
            _code.Escape(edmProperty),
            _code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
            _code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
    }

    public string NavigationProperty(NavigationProperty navProp)
    {
        var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
        return string.Format(
            CultureInfo.InvariantCulture,
            "{0} {1} {2} {{ {3}get; {4}set; }}",
            AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
            navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
            _code.Escape(navProp),
            _code.SpaceAfter(Accessibility.ForGetter(navProp)),
            _code.SpaceAfter(Accessibility.ForSetter(navProp)));
    }
    
    public string AccessibilityAndVirtual(string accessibility)
    {
        return accessibility + (accessibility != "private" ? " virtual" : "");
    }
    
    public string EntityClassOpening(EntityType entity)
    {
        return string.Format(
            CultureInfo.InvariantCulture,
            "{0} {1}partial class {2}{3}",
            Accessibility.ForType(entity),
            _code.SpaceAfter(_code.AbstractOption(entity)),
            _code.Escape(entity),
            _code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
    }
    
    public string EnumOpening(SimpleType enumType)
    {
        return string.Format(
            CultureInfo.InvariantCulture,
            "{0} enum {1} : {2}",
            Accessibility.ForType(enumType),
            _code.Escape(enumType),
            _code.Escape(_typeMapper.UnderlyingClrType(enumType)));
        }
    
    public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
    {
        var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
        foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
        {
            var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
            var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
            var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
            writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
        }
    }
    
    public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
    {
        var parameters = _typeMapper.GetParameters(edmFunction);
        
        return string.Format(
            CultureInfo.InvariantCulture,
            "{0} IQueryable<{1}> {2}({3})",
            AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
            _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
            _code.Escape(edmFunction),
            string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
    }
    
    public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
    {
        var parameters = _typeMapper.GetParameters(edmFunction);
        
        return string.Format(
            CultureInfo.InvariantCulture,
            "return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
            _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
            edmFunction.NamespaceName,
            edmFunction.Name,
            string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
            _code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
    }
    
    public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
    {
        var parameters = _typeMapper.GetParameters(edmFunction);
        var returnType = _typeMapper.GetReturnType(edmFunction);

        var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
        if (includeMergeOption)
        {
            paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
        }

        return string.Format(
            CultureInfo.InvariantCulture,
            "{0} {1} {2}({3})",
            AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
            returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
            _code.Escape(edmFunction),
            paramList);
    }
    
    public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
    {
        var parameters = _typeMapper.GetParameters(edmFunction);
        var returnType = _typeMapper.GetReturnType(edmFunction);

        var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
        if (includeMergeOption)
        {
            callParams = ", mergeOption" + callParams;
        }
        
        return string.Format(
            CultureInfo.InvariantCulture,
            "return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
            returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
            edmFunction.Name,
            callParams);
    }
    
    public string DbSet(EntitySet entitySet)
    {
        return string.Format(
            CultureInfo.InvariantCulture,
            "{0} virtual DbSet<{1}> {2} {{ get; set; }}",
            Accessibility.ForReadOnlyProperty(entitySet),
            _typeMapper.GetTypeName(entitySet.ElementType),
            _code.Escape(entitySet));
    }

    public string DbSetInitializer(EntitySet entitySet)
    {
        return string.Format(
            CultureInfo.InvariantCulture,
            "{0} = Set<{1}>();",
            _code.Escape(entitySet),
            _typeMapper.GetTypeName(entitySet.ElementType));
    }

    public string UsingDirectives(bool inHeader, bool includeCollections = true)
    {
        return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
            ? string.Format(
                CultureInfo.InvariantCulture,
                "{0}using System;{1}" +
                "{2}",
                inHeader ? Environment.NewLine : "",
                includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
                inHeader ? "" : Environment.NewLine)
            : "";
    }
}

public class TypeMapper
{
    private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";

    private readonly System.Collections.IList _errors;
    private readonly CodeGenerationTools _code;
    private readonly MetadataTools _ef;

    public static string FixNamespaces(string typeName)
    {
        return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
    }

    public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
    {
        ArgumentNotNull(code, "code");
        ArgumentNotNull(ef, "ef");
        ArgumentNotNull(errors, "errors");

        _code = code;
        _ef = ef;
        _errors = errors;
    }

    public string GetTypeName(TypeUsage typeUsage)
    {
        return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
    }

    public string GetTypeName(EdmType edmType)
    {
        return GetTypeName(edmType, isNullable: null, modelNamespace: null);
    }

    public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
    {
        return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
    }

    public string GetTypeName(EdmType edmType, string modelNamespace)
    {
        return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
    }

    public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
    {
        if (edmType == null)
        {
            return null;
        }

        var collectionType = edmType as CollectionType;
        if (collectionType != null)
        {
            return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
        }

        var typeName = _code.Escape(edmType.MetadataProperties
                                .Where(p => p.Name == ExternalTypeNameAttributeName)
                                .Select(p => (string)p.Value)
                                .FirstOrDefault())
            ?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
                _code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
                _code.Escape(edmType));

        if (edmType is StructuralType)
        {
            return typeName;
        }

        if (edmType is SimpleType)
        {
            var clrType = UnderlyingClrType(edmType);
            if (!IsEnumType(edmType))
            {
                typeName = _code.Escape(clrType);
            }

            typeName = FixNamespaces(typeName);

            return clrType.IsValueType && isNullable == true ?
                String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
                typeName;
        }

        throw new ArgumentException("edmType");
    }
    
    public Type UnderlyingClrType(EdmType edmType)
    {
        ArgumentNotNull(edmType, "edmType");

        var primitiveType = edmType as PrimitiveType;
        if (primitiveType != null)
        {
            return primitiveType.ClrEquivalentType;
        }

        if (IsEnumType(edmType))
        {
            return GetEnumUnderlyingType(edmType).ClrEquivalentType;
        }

        return typeof(object);
    }
    
    public object GetEnumMemberValue(MetadataItem enumMember)
    {
        ArgumentNotNull(enumMember, "enumMember");
        
        var valueProperty = enumMember.GetType().GetProperty("Value");
        return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
    }
    
    public string GetEnumMemberName(MetadataItem enumMember)
    {
        ArgumentNotNull(enumMember, "enumMember");
        
        var nameProperty = enumMember.GetType().GetProperty("Name");
        return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
    }

    public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
    {
        ArgumentNotNull(enumType, "enumType");

        var membersProperty = enumType.GetType().GetProperty("Members");
        return membersProperty != null 
            ? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
            : Enumerable.Empty<MetadataItem>();
    }
    
    public bool EnumIsFlags(EdmType enumType)
    {
        ArgumentNotNull(enumType, "enumType");
        
        var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
        return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
    }

    public bool IsEnumType(GlobalItem edmType)
    {
        ArgumentNotNull(edmType, "edmType");

        return edmType.GetType().Name == "EnumType";
    }

    public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
    {
        ArgumentNotNull(enumType, "enumType");

        return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
    }

    public string CreateLiteral(object value)
    {
        if (value == null || value.GetType() != typeof(TimeSpan))
        {
            return _code.CreateLiteral(value);
        }

        return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
    }
    
    public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
    {
        ArgumentNotNull(types, "types");
        ArgumentNotNull(sourceFile, "sourceFile");
        
        var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
        if (types.Any(item => !hash.Add(item)))
        {
            _errors.Add(
                new CompilerError(sourceFile, -1, -1, "6023",
                    String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
            return false;
        }
        return true;
    }
    
    public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
    {
        return GetItemsToGenerate<SimpleType>(itemCollection)
            .Where(e => IsEnumType(e));
    }
    
    public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
    {
        return itemCollection
            .OfType<T>()
            .Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
            .OrderBy(i => i.Name);
    }

    public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
    {
        return itemCollection
            .Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
            .Select(g => GetGlobalItemName(g));
    }

    public string GetGlobalItemName(GlobalItem item)
    {
        if (item is EdmType)
        {
            return ((EdmType)item).Name;
        }
        else
        {
            return ((EntityContainer)item).Name;
        }
    }

    public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
    {
        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
    }
    
    public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
    {
        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
    }
    
    public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
    {
        return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
    }
    
    public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
    {
        return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
    }

    public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
    {
        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
    }
    
    public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
    {
        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
    }

    public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
    {
        return type.NavigationProperties.Where(np => np.DeclaringType == type);
    }
    
    public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
    {
        return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
    }
    
    public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
    {
        ArgumentNotNull(edmFunction, "edmFunction");

        var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
        return returnParamsProperty == null
            ? edmFunction.ReturnParameter
            : ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
    }

    public bool IsComposable(EdmFunction edmFunction)
    {
        ArgumentNotNull(edmFunction, "edmFunction");

        var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
        return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
    }

    public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
    {
        return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
    }

    public TypeUsage GetReturnType(EdmFunction edmFunction)
    {
        var returnParam = GetReturnParameter(edmFunction);
        return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
    }
    
    public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
    {
        var returnType = GetReturnType(edmFunction);
        return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
    }
}

public static void ArgumentNotNull<T>(T arg, string name) where T : class
{
    if (arg == null)
    {
        throw new ArgumentNullException(name);
    }
}
#>

BD/BazaDan.Designer.cs

// Создание кода T4 для модели "C:\Users\Vlad\OneDrive\Desktop\KomarovExam\KomarovExam\BD\BazaDan.edmx" включено. 
// Чтобы включить формирование кода прежних версий, измените значение свойства "Стратегия создания кода" конструктора
// на "Legacy ObjectContext". Это свойство доступно в окне "Свойства", если модель
// открыта в конструкторе.

// Если не сформированы контекст и классы сущности, возможная причина в том, что вы создали пустую модель, но
// еще не выбрали версию Entity Framework для использования. Чтобы сформировать класс контекста и классы сущностей
// для своей модели, откройте модель в конструкторе, щелкните правой кнопкой область конструктора и
// выберите "Обновить модель из базы данных", "Сформировать базу данных из модели" или "Добавить элемент формирования
// кода...".

BD/BazaDan.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     Этот код создан по шаблону.
//
//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
// </auto-generated>
//------------------------------------------------------------------------------


BD/BazaDan.edmx

<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
  
  <edmx:Runtime>
    
    <edmx:StorageModels>
      <Schema Namespace="Хранилище KomarovExamModel" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
        <EntityType Name="City">
          <Key>
            <PropertyRef Name="IDCity" />
          </Key>
          <Property Name="IDCity" Type="int" Nullable="false" />
          <Property Name="CityName" Type="nvarchar" MaxLength="50" Nullable="false" />
        </EntityType>
        <EntityType Name="EdIzmer">
          <Key>
            <PropertyRef Name="IDEdIzm" />
          </Key>
          <Property Name="IDEdIzm" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="Edzm" Type="nvarchar" MaxLength="50" Nullable="false" />
        </EntityType>
        <EntityType Name="Postavshik">
          <Key>
            <PropertyRef Name="IDPostavshik" />
          </Key>
          <Property Name="IDPostavshik" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="PostavshikName" Type="nvarchar" MaxLength="50" Nullable="false" />
        </EntityType>
        <EntityType Name="Proizvoditeli">
          <Key>
            <PropertyRef Name="IDProizvoditelia" />
          </Key>
          <Property Name="IDProizvoditelia" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="NameProizvoditelia" Type="nvarchar" MaxLength="50" Nullable="false" />
        </EntityType>
        <EntityType Name="PunktVidachi">
          <Key>
            <PropertyRef Name="IDPunktVidashi" />
          </Key>
          <Property Name="IDPunktVidashi" Type="int" Nullable="false" />
          <Property Name="IDCity" Type="int" Nullable="false" />
          <Property Name="AdressIndex" Type="int" Nullable="false" />
          <Property Name="Street" Type="nvarchar" MaxLength="50" Nullable="false" />
          <Property Name="StreetNumber" Type="int" />
        </EntityType>
        <EntityType Name="Role">
          <Key>
            <PropertyRef Name="IDRole" />
          </Key>
          <Property Name="IDRole" Type="int" Nullable="false" />
          <Property Name="RoleName" Type="nvarchar" MaxLength="50" Nullable="false" />
        </EntityType>
        <EntityType Name="StatusZakaza">
          <Key>
            <PropertyRef Name="IDStatusZakaza" />
          </Key>
          <Property Name="IDStatusZakaza" Type="int" Nullable="false" />
          <Property Name="StatusZakazaName" Type="nvarchar" MaxLength="50" Nullable="false" />
        </EntityType>
        <EntityType Name="sysdiagrams">
          <Key>
            <PropertyRef Name="diagram_id" />
          </Key>
          <Property Name="name" Type="nvarchar" MaxLength="128" Nullable="false" />
          <Property Name="principal_id" Type="int" Nullable="false" />
          <Property Name="diagram_id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="version" Type="int" />
          <Property Name="definition" Type="varbinary(max)" />
        </EntityType>
        <EntityType Name="Tovar">
          <Key>
            <PropertyRef Name="IDTovar" />
          </Key>
          <Property Name="IDTovar" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="IDPostavshik" Type="int" Nullable="false" />
          <Property Name="IDProizvoditelia" Type="int" Nullable="false" />
          <Property Name="IDTovarCategory" Type="int" Nullable="false" />
          <Property Name="IDEdIzm" Type="int" Nullable="false" />
          <Property Name="Article" Type="nvarchar" MaxLength="6" Nullable="false" />
          <Property Name="TovarName" Type="nvarchar" MaxLength="150" Nullable="false" />
          <Property Name="Cost" Type="money" Nullable="false" />
          <Property Name="Discount" Type="int" />
          <Property Name="KolvoNaSklade" Type="int" />
          <Property Name="Description" Type="text" Nullable="false" />
          <Property Name="Image" Type="nvarchar" MaxLength="50" />
        </EntityType>
        <EntityType Name="TovarCategory">
          <Key>
            <PropertyRef Name="IDTovarCategory" />
          </Key>
          <Property Name="IDTovarCategory" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="TovarCategoryName" Type="nvarchar" MaxLength="50" />
        </EntityType>
        <EntityType Name="User">
          <Key>
            <PropertyRef Name="IDUser" />
          </Key>
          <Property Name="IDUser" Type="int" Nullable="false" />
          <Property Name="IDRole" Type="int" Nullable="false" />
          <Property Name="Familia" Type="nvarchar" MaxLength="50" Nullable="false" />
          <Property Name="Imya" Type="nvarchar" MaxLength="50" Nullable="false" />
          <Property Name="Otchestvo" Type="nvarchar" MaxLength="50" />
          <Property Name="Login" Type="nvarchar" MaxLength="50" Nullable="false" />
          <Property Name="Password" Type="nvarchar" MaxLength="30" Nullable="false" />
        </EntityType>
        <EntityType Name="Zakaz">
          <Key>
            <PropertyRef Name="IDZakaza" />
          </Key>
          <Property Name="IDZakaza" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="IDTovar" Type="int" Nullable="false" />
          <Property Name="IDPunktVidashi" Type="int" />
          <Property Name="IDUser" Type="int" Nullable="false" />
          <Property Name="IDStatusZakaza" Type="int" />
          <Property Name="NomerZakaza" Type="int" Nullable="false" />
          <Property Name="Kolvo" Type="int" />
          <Property Name="DateZakaza" Type="date" />
          <Property Name="DateDelivery" Type="date" />
          <Property Name="CodePolushenia" Type="int" />
        </EntityType>
        <Association Name="FK_PunktVidachi_City">
          <End Role="City" Type="Self.City" Multiplicity="1" />
          <End Role="PunktVidachi" Type="Self.PunktVidachi" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="City">
              <PropertyRef Name="IDCity" />
            </Principal>
            <Dependent Role="PunktVidachi">
              <PropertyRef Name="IDCity" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Tovar_EdIzmer">
          <End Role="EdIzmer" Type="Self.EdIzmer" Multiplicity="1" />
          <End Role="Tovar" Type="Self.Tovar" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="EdIzmer">
              <PropertyRef Name="IDEdIzm" />
            </Principal>
            <Dependent Role="Tovar">
              <PropertyRef Name="IDEdIzm" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Tovar_Postavshik">
          <End Role="Postavshik" Type="Self.Postavshik" Multiplicity="1" />
          <End Role="Tovar" Type="Self.Tovar" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Postavshik">
              <PropertyRef Name="IDPostavshik" />
            </Principal>
            <Dependent Role="Tovar">
              <PropertyRef Name="IDPostavshik" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Tovar_Proizvoditeli">
          <End Role="Proizvoditeli" Type="Self.Proizvoditeli" Multiplicity="1" />
          <End Role="Tovar" Type="Self.Tovar" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Proizvoditeli">
              <PropertyRef Name="IDProizvoditelia" />
            </Principal>
            <Dependent Role="Tovar">
              <PropertyRef Name="IDProizvoditelia" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Tovar_TovarCategory">
          <End Role="TovarCategory" Type="Self.TovarCategory" Multiplicity="1" />
          <End Role="Tovar" Type="Self.Tovar" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="TovarCategory">
              <PropertyRef Name="IDTovarCategory" />
            </Principal>
            <Dependent Role="Tovar">
              <PropertyRef Name="IDTovarCategory" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_User_Role">
          <End Role="Role" Type="Self.Role" Multiplicity="1" />
          <End Role="User" Type="Self.User" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Role">
              <PropertyRef Name="IDRole" />
            </Principal>
            <Dependent Role="User">
              <PropertyRef Name="IDRole" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Zakaz_PunktVidachi">
          <End Role="PunktVidachi" Type="Self.PunktVidachi" Multiplicity="0..1" />
          <End Role="Zakaz" Type="Self.Zakaz" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="PunktVidachi">
              <PropertyRef Name="IDPunktVidashi" />
            </Principal>
            <Dependent Role="Zakaz">
              <PropertyRef Name="IDPunktVidashi" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Zakaz_StatusZakaza">
          <End Role="StatusZakaza" Type="Self.StatusZakaza" Multiplicity="0..1" />
          <End Role="Zakaz" Type="Self.Zakaz" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="StatusZakaza">
              <PropertyRef Name="IDStatusZakaza" />
            </Principal>
            <Dependent Role="Zakaz">
              <PropertyRef Name="IDStatusZakaza" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Zakaz_Tovar">
          <End Role="Tovar" Type="Self.Tovar" Multiplicity="1" />
          <End Role="Zakaz" Type="Self.Zakaz" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Tovar">
              <PropertyRef Name="IDTovar" />
            </Principal>
            <Dependent Role="Zakaz">
              <PropertyRef Name="IDTovar" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Zakaz_User">
          <End Role="User" Type="Self.User" Multiplicity="1" />
          <End Role="Zakaz" Type="Self.Zakaz" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="User">
              <PropertyRef Name="IDUser" />
            </Principal>
            <Dependent Role="Zakaz">
              <PropertyRef Name="IDUser" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <EntityContainer Name="Хранилище KomarovExamModelContainer">
          <EntitySet Name="City" EntityType="Self.City" Schema="dbo" store:Type="Tables" />
          <EntitySet Name="EdIzmer" EntityType="Self.EdIzmer" Schema="dbo" store:Type="Tables" />
          <EntitySet Name="Postavshik" EntityType="Self.Postavshik" Schema="dbo" store:Type="Tables" />
          <EntitySet Name="Proizvoditeli" EntityType="Self.Proizvoditeli" Schema="dbo" store:Type="Tables" />
          <EntitySet Name="PunktVidachi" EntityType="Self.PunktVidachi" Schema="dbo" store:Type="Tables" />
          <EntitySet Name="Role" EntityType="Self.Role" Schema="dbo" store:Type="Tables" />
          <EntitySet Name="StatusZakaza" EntityType="Self.StatusZakaza" Schema="dbo" store:Type="Tables" />
          <EntitySet Name="sysdiagrams" EntityType="Self.sysdiagrams" Schema="dbo" store:Type="Tables" />
          <EntitySet Name="Tovar" EntityType="Self.Tovar" Schema="dbo" store:Type="Tables" />
          <EntitySet Name="TovarCategory" EntityType="Self.TovarCategory" Schema="dbo" store:Type="Tables" />
          <EntitySet Name="User" EntityType="Self.User" Schema="dbo" store:Type="Tables" />
          <EntitySet Name="Zakaz" EntityType="Self.Zakaz" Schema="dbo" store:Type="Tables" />
          <AssociationSet Name="FK_PunktVidachi_City" Association="Self.FK_PunktVidachi_City">
            <End Role="City" EntitySet="City" />
            <End Role="PunktVidachi" EntitySet="PunktVidachi" />
          </AssociationSet>
          <AssociationSet Name="FK_Tovar_EdIzmer" Association="Self.FK_Tovar_EdIzmer">
            <End Role="EdIzmer" EntitySet="EdIzmer" />
            <End Role="Tovar" EntitySet="Tovar" />
          </AssociationSet>
          <AssociationSet Name="FK_Tovar_Postavshik" Association="Self.FK_Tovar_Postavshik">
            <End Role="Postavshik" EntitySet="Postavshik" />
            <End Role="Tovar" EntitySet="Tovar" />
          </AssociationSet>
          <AssociationSet Name="FK_Tovar_Proizvoditeli" Association="Self.FK_Tovar_Proizvoditeli">
            <End Role="Proizvoditeli" EntitySet="Proizvoditeli" />
            <End Role="Tovar" EntitySet="Tovar" />
          </AssociationSet>
          <AssociationSet Name="FK_Tovar_TovarCategory" Association="Self.FK_Tovar_TovarCategory">
            <End Role="TovarCategory" EntitySet="TovarCategory" />
            <End Role="Tovar" EntitySet="Tovar" />
          </AssociationSet>
          <AssociationSet Name="FK_User_Role" Association="Self.FK_User_Role">
            <End Role="Role" EntitySet="Role" />
            <End Role="User" EntitySet="User" />
          </AssociationSet>
          <AssociationSet Name="FK_Zakaz_PunktVidachi" Association="Self.FK_Zakaz_PunktVidachi">
            <End Role="PunktVidachi" EntitySet="PunktVidachi" />
            <End Role="Zakaz" EntitySet="Zakaz" />
          </AssociationSet>
          <AssociationSet Name="FK_Zakaz_StatusZakaza" Association="Self.FK_Zakaz_StatusZakaza">
            <End Role="StatusZakaza" EntitySet="StatusZakaza" />
            <End Role="Zakaz" EntitySet="Zakaz" />
          </AssociationSet>
          <AssociationSet Name="FK_Zakaz_Tovar" Association="Self.FK_Zakaz_Tovar">
            <End Role="Tovar" EntitySet="Tovar" />
            <End Role="Zakaz" EntitySet="Zakaz" />
          </AssociationSet>
          <AssociationSet Name="FK_Zakaz_User" Association="Self.FK_Zakaz_User">
            <End Role="User" EntitySet="User" />
            <End Role="Zakaz" EntitySet="Zakaz" />
          </AssociationSet>
        </EntityContainer>
      </Schema>
    </edmx:StorageModels>
    
    <edmx:ConceptualModels>
      <Schema Namespace="KomarovExamModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
        <EntityType Name="City">
          <Key>
            <PropertyRef Name="IDCity" />
          </Key>
          <Property Name="IDCity" Type="Int32" Nullable="false" />
          <Property Name="CityName" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
          <NavigationProperty Name="PunktVidachi" Relationship="Self.FK_PunktVidachi_City" FromRole="City" ToRole="PunktVidachi" />
        </EntityType>
        <EntityType Name="EdIzmer">
          <Key>
            <PropertyRef Name="IDEdIzm" />
          </Key>
          <Property Name="IDEdIzm" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="Edzm" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
          <NavigationProperty Name="Tovar" Relationship="Self.FK_Tovar_EdIzmer" FromRole="EdIzmer" ToRole="Tovar" />
        </EntityType>
        <EntityType Name="Postavshik">
          <Key>
            <PropertyRef Name="IDPostavshik" />
          </Key>
          <Property Name="IDPostavshik" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="PostavshikName" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
          <NavigationProperty Name="Tovar" Relationship="Self.FK_Tovar_Postavshik" FromRole="Postavshik" ToRole="Tovar" />
        </EntityType>
        <EntityType Name="Proizvoditeli">
          <Key>
            <PropertyRef Name="IDProizvoditelia" />
          </Key>
          <Property Name="IDProizvoditelia" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="NameProizvoditelia" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
          <NavigationProperty Name="Tovar" Relationship="Self.FK_Tovar_Proizvoditeli" FromRole="Proizvoditeli" ToRole="Tovar" />
        </EntityType>
        <EntityType Name="PunktVidachi">
          <Key>
            <PropertyRef Name="IDPunktVidashi" />
          </Key>
          <Property Name="IDPunktVidashi" Type="Int32" Nullable="false" />
          <Property Name="IDCity" Type="Int32" Nullable="false" />
          <Property Name="AdressIndex" Type="Int32" Nullable="false" />
          <Property Name="Street" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
          <Property Name="StreetNumber" Type="Int32" />
          <NavigationProperty Name="City" Relationship="Self.FK_PunktVidachi_City" FromRole="PunktVidachi" ToRole="City" />
          <NavigationProperty Name="Zakaz" Relationship="Self.FK_Zakaz_PunktVidachi" FromRole="PunktVidachi" ToRole="Zakaz" />
        </EntityType>
        <EntityType Name="Role">
          <Key>
            <PropertyRef Name="IDRole" />
          </Key>
          <Property Name="IDRole" Type="Int32" Nullable="false" />
          <Property Name="RoleName" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
          <NavigationProperty Name="User" Relationship="Self.FK_User_Role" FromRole="Role" ToRole="User" />
        </EntityType>
        <EntityType Name="StatusZakaza">
          <Key>
            <PropertyRef Name="IDStatusZakaza" />
          </Key>
          <Property Name="IDStatusZakaza" Type="Int32" Nullable="false" />
          <Property Name="StatusZakazaName" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
          <NavigationProperty Name="Zakaz" Relationship="Self.FK_Zakaz_StatusZakaza" FromRole="StatusZakaza" ToRole="Zakaz" />
        </EntityType>
        <EntityType Name="sysdiagrams">
          <Key>
            <PropertyRef Name="diagram_id" />
          </Key>
          <Property Name="name" Type="String" MaxLength="128" FixedLength="false" Unicode="true" Nullable="false" />
          <Property Name="principal_id" Type="Int32" Nullable="false" />
          <Property Name="diagram_id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="version" Type="Int32" />
          <Property Name="definition" Type="Binary" MaxLength="Max" FixedLength="false" />
        </EntityType>
        <EntityType Name="Tovar">
          <Key>
            <PropertyRef Name="IDTovar" />
          </Key>
          <Property Name="IDTovar" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="IDPostavshik" Type="Int32" Nullable="false" />
          <Property Name="IDProizvoditelia" Type="Int32" Nullable="false" />
          <Property Name="IDTovarCategory" Type="Int32" Nullable="false" />
          <Property Name="IDEdIzm" Type="Int32" Nullable="false" />
          <Property Name="Article" Type="String" MaxLength="6" FixedLength="false" Unicode="true" Nullable="false" />
          <Property Name="TovarName" Type="String" MaxLength="150" FixedLength="false" Unicode="true" Nullable="false" />
          <Property Name="Cost" Type="Decimal" Precision="19" Scale="4" Nullable="false" />
          <Property Name="Discount" Type="Int32" />
          <Property Name="KolvoNaSklade" Type="Int32" />
          <Property Name="Description" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" Nullable="false" />
          <Property Name="Image" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
          <NavigationProperty Name="EdIzmer" Relationship="Self.FK_Tovar_EdIzmer" FromRole="Tovar" ToRole="EdIzmer" />
          <NavigationProperty Name="Postavshik" Relationship="Self.FK_Tovar_Postavshik" FromRole="Tovar" ToRole="Postavshik" />
          <NavigationProperty Name="Proizvoditeli" Relationship="Self.FK_Tovar_Proizvoditeli" FromRole="Tovar" ToRole="Proizvoditeli" />
          <NavigationProperty Name="TovarCategory" Relationship="Self.FK_Tovar_TovarCategory" FromRole="Tovar" ToRole="TovarCategory" />
          <NavigationProperty Name="Zakaz" Relationship="Self.FK_Zakaz_Tovar" FromRole="Tovar" ToRole="Zakaz" />
        </EntityType>
        <EntityType Name="TovarCategory">
          <Key>
            <PropertyRef Name="IDTovarCategory" />
          </Key>
          <Property Name="IDTovarCategory" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="TovarCategoryName" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
          <NavigationProperty Name="Tovar" Relationship="Self.FK_Tovar_TovarCategory" FromRole="TovarCategory" ToRole="Tovar" />
        </EntityType>
        <EntityType Name="User">
          <Key>
            <PropertyRef Name="IDUser" />
          </Key>
          <Property Name="IDUser" Type="Int32" Nullable="false" />
          <Property Name="IDRole" Type="Int32" Nullable="false" />
          <Property Name="Familia" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
          <Property Name="Imya" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
          <Property Name="Otchestvo" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
          <Property Name="Login" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
          <Property Name="Password" Type="String" MaxLength="30" FixedLength="false" Unicode="true" Nullable="false" />
          <NavigationProperty Name="Role" Relationship="Self.FK_User_Role" FromRole="User" ToRole="Role" />
          <NavigationProperty Name="Zakaz" Relationship="Self.FK_Zakaz_User" FromRole="User" ToRole="Zakaz" />
        </EntityType>
        <EntityType Name="Zakaz">
          <Key>
            <PropertyRef Name="IDZakaza" />
          </Key>
          <Property Name="IDZakaza" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="IDTovar" Type="Int32" Nullable="false" />
          <Property Name="IDPunktVidashi" Type="Int32" />
          <Property Name="IDUser" Type="Int32" Nullable="false" />
          <Property Name="IDStatusZakaza" Type="Int32" />
          <Property Name="NomerZakaza" Type="Int32" Nullable="false" />
          <Property Name="Kolvo" Type="Int32" />
          <Property Name="DateZakaza" Type="DateTime" Precision="0" />
          <Property Name="DateDelivery" Type="DateTime" Precision="0" />
          <Property Name="CodePolushenia" Type="Int32" />
          <NavigationProperty Name="PunktVidachi" Relationship="Self.FK_Zakaz_PunktVidachi" FromRole="Zakaz" ToRole="PunktVidachi" />
          <NavigationProperty Name="StatusZakaza" Relationship="Self.FK_Zakaz_StatusZakaza" FromRole="Zakaz" ToRole="StatusZakaza" />
          <NavigationProperty Name="Tovar" Relationship="Self.FK_Zakaz_Tovar" FromRole="Zakaz" ToRole="Tovar" />
          <NavigationProperty Name="User" Relationship="Self.FK_Zakaz_User" FromRole="Zakaz" ToRole="User" />
        </EntityType>
        <Association Name="FK_PunktVidachi_City">
          <End Role="City" Type="Self.City" Multiplicity="1" />
          <End Role="PunktVidachi" Type="Self.PunktVidachi" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="City">
              <PropertyRef Name="IDCity" />
            </Principal>
            <Dependent Role="PunktVidachi">
              <PropertyRef Name="IDCity" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Tovar_EdIzmer">
          <End Role="EdIzmer" Type="Self.EdIzmer" Multiplicity="1" />
          <End Role="Tovar" Type="Self.Tovar" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="EdIzmer">
              <PropertyRef Name="IDEdIzm" />
            </Principal>
            <Dependent Role="Tovar">
              <PropertyRef Name="IDEdIzm" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Tovar_Postavshik">
          <End Role="Postavshik" Type="Self.Postavshik" Multiplicity="1" />
          <End Role="Tovar" Type="Self.Tovar" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Postavshik">
              <PropertyRef Name="IDPostavshik" />
            </Principal>
            <Dependent Role="Tovar">
              <PropertyRef Name="IDPostavshik" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Tovar_Proizvoditeli">
          <End Role="Proizvoditeli" Type="Self.Proizvoditeli" Multiplicity="1" />
          <End Role="Tovar" Type="Self.Tovar" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Proizvoditeli">
              <PropertyRef Name="IDProizvoditelia" />
            </Principal>
            <Dependent Role="Tovar">
              <PropertyRef Name="IDProizvoditelia" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Zakaz_PunktVidachi">
          <End Role="PunktVidachi" Type="Self.PunktVidachi" Multiplicity="0..1" />
          <End Role="Zakaz" Type="Self.Zakaz" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="PunktVidachi">
              <PropertyRef Name="IDPunktVidashi" />
            </Principal>
            <Dependent Role="Zakaz">
              <PropertyRef Name="IDPunktVidashi" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_User_Role">
          <End Role="Role" Type="Self.Role" Multiplicity="1" />
          <End Role="User" Type="Self.User" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Role">
              <PropertyRef Name="IDRole" />
            </Principal>
            <Dependent Role="User">
              <PropertyRef Name="IDRole" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Zakaz_StatusZakaza">
          <End Role="StatusZakaza" Type="Self.StatusZakaza" Multiplicity="0..1" />
          <End Role="Zakaz" Type="Self.Zakaz" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="StatusZakaza">
              <PropertyRef Name="IDStatusZakaza" />
            </Principal>
            <Dependent Role="Zakaz">
              <PropertyRef Name="IDStatusZakaza" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Tovar_TovarCategory">
          <End Role="TovarCategory" Type="Self.TovarCategory" Multiplicity="1" />
          <End Role="Tovar" Type="Self.Tovar" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="TovarCategory">
              <PropertyRef Name="IDTovarCategory" />
            </Principal>
            <Dependent Role="Tovar">
              <PropertyRef Name="IDTovarCategory" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Zakaz_Tovar">
          <End Role="Tovar" Type="Self.Tovar" Multiplicity="1" />
          <End Role="Zakaz" Type="Self.Zakaz" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Tovar">
              <PropertyRef Name="IDTovar" />
            </Principal>
            <Dependent Role="Zakaz">
              <PropertyRef Name="IDTovar" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Zakaz_User">
          <End Role="User" Type="Self.User" Multiplicity="1" />
          <End Role="Zakaz" Type="Self.Zakaz" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="User">
              <PropertyRef Name="IDUser" />
            </Principal>
            <Dependent Role="Zakaz">
              <PropertyRef Name="IDUser" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <EntityContainer Name="KomarovExamEntities" annotation:LazyLoadingEnabled="true">
          <EntitySet Name="City" EntityType="Self.City" />
          <EntitySet Name="EdIzmer" EntityType="Self.EdIzmer" />
          <EntitySet Name="Postavshik" EntityType="Self.Postavshik" />
          <EntitySet Name="Proizvoditeli" EntityType="Self.Proizvoditeli" />
          <EntitySet Name="PunktVidachi" EntityType="Self.PunktVidachi" />
          <EntitySet Name="Role" EntityType="Self.Role" />
          <EntitySet Name="StatusZakaza" EntityType="Self.StatusZakaza" />
          <EntitySet Name="sysdiagrams" EntityType="Self.sysdiagrams" />
          <EntitySet Name="Tovar" EntityType="Self.Tovar" />
          <EntitySet Name="TovarCategory" EntityType="Self.TovarCategory" />
          <EntitySet Name="User" EntityType="Self.User" />
          <EntitySet Name="Zakaz" EntityType="Self.Zakaz" />
          <AssociationSet Name="FK_PunktVidachi_City" Association="Self.FK_PunktVidachi_City">
            <End Role="City" EntitySet="City" />
            <End Role="PunktVidachi" EntitySet="PunktVidachi" />
          </AssociationSet>
          <AssociationSet Name="FK_Tovar_EdIzmer" Association="Self.FK_Tovar_EdIzmer">
            <End Role="EdIzmer" EntitySet="EdIzmer" />
            <End Role="Tovar" EntitySet="Tovar" />
          </AssociationSet>
          <AssociationSet Name="FK_Tovar_Postavshik" Association="Self.FK_Tovar_Postavshik">
            <End Role="Postavshik" EntitySet="Postavshik" />
            <End Role="Tovar" EntitySet="Tovar" />
          </AssociationSet>
          <AssociationSet Name="FK_Tovar_Proizvoditeli" Association="Self.FK_Tovar_Proizvoditeli">
            <End Role="Proizvoditeli" EntitySet="Proizvoditeli" />
            <End Role="Tovar" EntitySet="Tovar" />
          </AssociationSet>
          <AssociationSet Name="FK_Zakaz_PunktVidachi" Association="Self.FK_Zakaz_PunktVidachi">
            <End Role="PunktVidachi" EntitySet="PunktVidachi" />
            <End Role="Zakaz" EntitySet="Zakaz" />
          </AssociationSet>
          <AssociationSet Name="FK_User_Role" Association="Self.FK_User_Role">
            <End Role="Role" EntitySet="Role" />
            <End Role="User" EntitySet="User" />
          </AssociationSet>
          <AssociationSet Name="FK_Zakaz_StatusZakaza" Association="Self.FK_Zakaz_StatusZakaza">
            <End Role="StatusZakaza" EntitySet="StatusZakaza" />
            <End Role="Zakaz" EntitySet="Zakaz" />
          </AssociationSet>
          <AssociationSet Name="FK_Tovar_TovarCategory" Association="Self.FK_Tovar_TovarCategory">
            <End Role="TovarCategory" EntitySet="TovarCategory" />
            <End Role="Tovar" EntitySet="Tovar" />
          </AssociationSet>
          <AssociationSet Name="FK_Zakaz_Tovar" Association="Self.FK_Zakaz_Tovar">
            <End Role="Tovar" EntitySet="Tovar" />
            <End Role="Zakaz" EntitySet="Zakaz" />
          </AssociationSet>
          <AssociationSet Name="FK_Zakaz_User" Association="Self.FK_Zakaz_User">
            <End Role="User" EntitySet="User" />
            <End Role="Zakaz" EntitySet="Zakaz" />
          </AssociationSet>
        </EntityContainer>
      </Schema>
    </edmx:ConceptualModels>
    
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
        <EntityContainerMapping StorageEntityContainer="Хранилище KomarovExamModelContainer" CdmEntityContainer="KomarovExamEntities">
          <EntitySetMapping Name="City">
            <EntityTypeMapping TypeName="KomarovExamModel.City">
              <MappingFragment StoreEntitySet="City">
                <ScalarProperty Name="IDCity" ColumnName="IDCity" />
                <ScalarProperty Name="CityName" ColumnName="CityName" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="EdIzmer">
            <EntityTypeMapping TypeName="KomarovExamModel.EdIzmer">
              <MappingFragment StoreEntitySet="EdIzmer">
                <ScalarProperty Name="IDEdIzm" ColumnName="IDEdIzm" />
                <ScalarProperty Name="Edzm" ColumnName="Edzm" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Postavshik">
            <EntityTypeMapping TypeName="KomarovExamModel.Postavshik">
              <MappingFragment StoreEntitySet="Postavshik">
                <ScalarProperty Name="IDPostavshik" ColumnName="IDPostavshik" />
                <ScalarProperty Name="PostavshikName" ColumnName="PostavshikName" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Proizvoditeli">
            <EntityTypeMapping TypeName="KomarovExamModel.Proizvoditeli">
              <MappingFragment StoreEntitySet="Proizvoditeli">
                <ScalarProperty Name="IDProizvoditelia" ColumnName="IDProizvoditelia" />
                <ScalarProperty Name="NameProizvoditelia" ColumnName="NameProizvoditelia" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="PunktVidachi">
            <EntityTypeMapping TypeName="KomarovExamModel.PunktVidachi">
              <MappingFragment StoreEntitySet="PunktVidachi">
                <ScalarProperty Name="IDPunktVidashi" ColumnName="IDPunktVidashi" />
                <ScalarProperty Name="IDCity" ColumnName="IDCity" />
                <ScalarProperty Name="AdressIndex" ColumnName="AdressIndex" />
                <ScalarProperty Name="Street" ColumnName="Street" />
                <ScalarProperty Name="StreetNumber" ColumnName="StreetNumber" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Role">
            <EntityTypeMapping TypeName="KomarovExamModel.Role">
              <MappingFragment StoreEntitySet="Role">
                <ScalarProperty Name="IDRole" ColumnName="IDRole" />
                <ScalarProperty Name="RoleName" ColumnName="RoleName" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="StatusZakaza">
            <EntityTypeMapping TypeName="KomarovExamModel.StatusZakaza">
              <MappingFragment StoreEntitySet="StatusZakaza">
                <ScalarProperty Name="IDStatusZakaza" ColumnName="IDStatusZakaza" />
                <ScalarProperty Name="StatusZakazaName" ColumnName="StatusZakazaName" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="sysdiagrams">
            <EntityTypeMapping TypeName="KomarovExamModel.sysdiagrams">
              <MappingFragment StoreEntitySet="sysdiagrams">
                <ScalarProperty Name="name" ColumnName="name" />
                <ScalarProperty Name="principal_id" ColumnName="principal_id" />
                <ScalarProperty Name="diagram_id" ColumnName="diagram_id" />
                <ScalarProperty Name="version" ColumnName="version" />
                <ScalarProperty Name="definition" ColumnName="definition" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Tovar">
            <EntityTypeMapping TypeName="KomarovExamModel.Tovar">
              <MappingFragment StoreEntitySet="Tovar">
                <ScalarProperty Name="IDTovar" ColumnName="IDTovar" />
                <ScalarProperty Name="IDPostavshik" ColumnName="IDPostavshik" />
                <ScalarProperty Name="IDProizvoditelia" ColumnName="IDProizvoditelia" />
                <ScalarProperty Name="IDTovarCategory" ColumnName="IDTovarCategory" />
                <ScalarProperty Name="IDEdIzm" ColumnName="IDEdIzm" />
                <ScalarProperty Name="Article" ColumnName="Article" />
                <ScalarProperty Name="TovarName" ColumnName="TovarName" />
                <ScalarProperty Name="Cost" ColumnName="Cost" />
                <ScalarProperty Name="Discount" ColumnName="Discount" />
                <ScalarProperty Name="KolvoNaSklade" ColumnName="KolvoNaSklade" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="Image" ColumnName="Image" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="TovarCategory">
            <EntityTypeMapping TypeName="KomarovExamModel.TovarCategory">
              <MappingFragment StoreEntitySet="TovarCategory">
                <ScalarProperty Name="IDTovarCategory" ColumnName="IDTovarCategory" />
                <ScalarProperty Name="TovarCategoryName" ColumnName="TovarCategoryName" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="User">
            <EntityTypeMapping TypeName="KomarovExamModel.User">
              <MappingFragment StoreEntitySet="User">
                <ScalarProperty Name="IDUser" ColumnName="IDUser" />
                <ScalarProperty Name="IDRole" ColumnName="IDRole" />
                <ScalarProperty Name="Familia" ColumnName="Familia" />
                <ScalarProperty Name="Imya" ColumnName="Imya" />
                <ScalarProperty Name="Otchestvo" ColumnName="Otchestvo" />
                <ScalarProperty Name="Login" ColumnName="Login" />
                <ScalarProperty Name="Password" ColumnName="Password" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Zakaz">
            <EntityTypeMapping TypeName="KomarovExamModel.Zakaz">
              <MappingFragment StoreEntitySet="Zakaz">
                <ScalarProperty Name="IDZakaza" ColumnName="IDZakaza" />
                <ScalarProperty Name="IDTovar" ColumnName="IDTovar" />
                <ScalarProperty Name="IDPunktVidashi" ColumnName="IDPunktVidashi" />
                <ScalarProperty Name="IDUser" ColumnName="IDUser" />
                <ScalarProperty Name="IDStatusZakaza" ColumnName="IDStatusZakaza" />
                <ScalarProperty Name="NomerZakaza" ColumnName="NomerZakaza" />
                <ScalarProperty Name="Kolvo" ColumnName="Kolvo" />
                <ScalarProperty Name="DateZakaza" ColumnName="DateZakaza" />
                <ScalarProperty Name="DateDelivery" ColumnName="DateDelivery" />
                <ScalarProperty Name="CodePolushenia" ColumnName="CodePolushenia" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
        </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  
  <Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
    <Connection>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </Connection>
    <Options>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
        <DesignerProperty Name="EnablePluralization" Value="false" />
        <DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
        <DesignerProperty Name="UseLegacyProvider" Value="false" />
        <DesignerProperty Name="CodeGenerationStrategy" Value="Нет" />
      </DesignerInfoPropertySet>
    </Options>
    
    <Diagrams></Diagrams>
  </Designer>
</edmx:Edmx>

BD/BazaDan.edmx.diagram

<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
 
  <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
    
    <edmx:Diagrams>
      <Diagram DiagramId="2de3fdae69f94d21abae25baed527339" Name="Diagram1">
        <EntityTypeShape EntityType="KomarovExamModel.City" Width="1.5" PointX="0.75" PointY="13.625" IsExpanded="true" />
        <EntityTypeShape EntityType="KomarovExamModel.EdIzmer" Width="1.5" PointX="0.75" PointY="2.375" IsExpanded="true" />
        <EntityTypeShape EntityType="KomarovExamModel.Postavshik" Width="1.5" PointX="0.75" PointY="5.5" IsExpanded="true" />
        <EntityTypeShape EntityType="KomarovExamModel.Proizvoditeli" Width="1.5" PointX="0.75" PointY="7.875" IsExpanded="true" />
        <EntityTypeShape EntityType="KomarovExamModel.PunktVidachi" Width="1.5" PointX="3" PointY="13.25" IsExpanded="true" />
        <EntityTypeShape EntityType="KomarovExamModel.Role" Width="1.5" PointX="0.75" PointY="17.375" IsExpanded="true" />
        <EntityTypeShape EntityType="KomarovExamModel.StatusZakaza" Width="1.5" PointX="3" PointY="9.375" IsExpanded="true" />
        <EntityTypeShape EntityType="KomarovExamModel.sysdiagrams" Width="1.5" PointX="5.75" PointY="6.75" IsExpanded="true" />
        <EntityTypeShape EntityType="KomarovExamModel.Tovar" Width="1.5" PointX="3" PointY="1" IsExpanded="true" />
        <EntityTypeShape EntityType="KomarovExamModel.TovarCategory" Width="1.5" PointX="0.75" PointY="10.25" IsExpanded="true" />
        <EntityTypeShape EntityType="KomarovExamModel.User" Width="1.5" PointX="3" PointY="16.75" IsExpanded="true" />
        <EntityTypeShape EntityType="KomarovExamModel.Zakaz" Width="1.5" PointX="5.25" PointY="1.375" IsExpanded="true" />
        <AssociationConnector Association="KomarovExamModel.FK_PunktVidachi_City" ManuallyRouted="false" />
        <AssociationConnector Association="KomarovExamModel.FK_Tovar_EdIzmer" ManuallyRouted="false" />
        <AssociationConnector Association="KomarovExamModel.FK_Tovar_Postavshik" ManuallyRouted="false" />
        <AssociationConnector Association="KomarovExamModel.FK_Tovar_Proizvoditeli" ManuallyRouted="false" />
        <AssociationConnector Association="KomarovExamModel.FK_Zakaz_PunktVidachi" ManuallyRouted="false" />
        <AssociationConnector Association="KomarovExamModel.FK_User_Role" ManuallyRouted="false" />
        <AssociationConnector Association="KomarovExamModel.FK_Zakaz_StatusZakaza" ManuallyRouted="false" />
        <AssociationConnector Association="KomarovExamModel.FK_Tovar_TovarCategory" ManuallyRouted="false" />
        <AssociationConnector Association="KomarovExamModel.FK_Zakaz_Tovar" ManuallyRouted="false" />
        <AssociationConnector Association="KomarovExamModel.FK_Zakaz_User" ManuallyRouted="false" />
      </Diagram>
    </edmx:Diagrams>
  </edmx:Designer>
</edmx:Edmx>

BD/BazaDan.tt

<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@ 
 output extension=".cs"#><#

const string inputFile = @"BazaDan.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var	fileManager = EntityFrameworkTemplateFileManager.Create(this);
var itemCollection = new EdmMetadataLoader(textTransform.Host, textTransform.Errors).CreateEdmItemCollection(inputFile);
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);

if (!typeMapper.VerifyCaseInsensitiveTypeUniqueness(typeMapper.GetAllGlobalItems(itemCollection), inputFile))
{
    return string.Empty;
}

WriteHeader(codeStringGenerator, fileManager);

foreach (var entity in typeMapper.GetItemsToGenerate<EntityType>(itemCollection))
{
    fileManager.StartNewFile(entity.Name + ".cs");
    BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false)#>
<#=codeStringGenerator.EntityClassOpening(entity)#>
{
<#
    var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(entity);
    var collectionNavigationProperties = typeMapper.GetCollectionNavigationProperties(entity);
    var complexProperties = typeMapper.GetComplexProperties(entity);

    if (propertiesWithDefaultValues.Any() || collectionNavigationProperties.Any() || complexProperties.Any())
    {
#>
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
    public <#=code.Escape(entity)#>()
    {
<#
        foreach (var edmProperty in propertiesWithDefaultValues)
        {
#>
        this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
<#
        }

        foreach (var navigationProperty in collectionNavigationProperties)
        {
#>
        this.<#=code.Escape(navigationProperty)#> = new HashSet<<#=typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType())#>>();
<#
        }

        foreach (var complexProperty in complexProperties)
        {
#>
        this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
<#
        }
#>
    }

<#
    }

    var simpleProperties = typeMapper.GetSimpleProperties(entity);
    if (simpleProperties.Any())
    {
        foreach (var edmProperty in simpleProperties)
        {
#>
    <#=codeStringGenerator.Property(edmProperty)#>
<#
        }
    }

    if (complexProperties.Any())
    {
#>

<#
        foreach(var complexProperty in complexProperties)
        {
#>
    <#=codeStringGenerator.Property(complexProperty)#>
<#
        }
    }

    var navigationProperties = typeMapper.GetNavigationProperties(entity);
    if (navigationProperties.Any())
    {
#>

<#
        foreach (var navigationProperty in navigationProperties)
        {
            if (navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
            {
#>
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
<#
            }
#>
    <#=codeStringGenerator.NavigationProperty(navigationProperty)#>
<#
        }
    }
#>
}
<#
    EndNamespace(code);
}

foreach (var complex in typeMapper.GetItemsToGenerate<ComplexType>(itemCollection))
{
    fileManager.StartNewFile(complex.Name + ".cs");
    BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>
{
<#
    var complexProperties = typeMapper.GetComplexProperties(complex);
    var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(complex);

    if (propertiesWithDefaultValues.Any() || complexProperties.Any())
    {
#>
    public <#=code.Escape(complex)#>()
    {
<#
        foreach (var edmProperty in propertiesWithDefaultValues)
        {
#>
        this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
<#
        }

        foreach (var complexProperty in complexProperties)
        {
#>
        this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
<#
        }
#>
    }

<#
    }

    var simpleProperties = typeMapper.GetSimpleProperties(complex);
    if (simpleProperties.Any())
    {
        foreach(var edmProperty in simpleProperties)
        {
#>
    <#=codeStringGenerator.Property(edmProperty)#>
<#
        }
    }

    if (complexProperties.Any())
    {
#>

<#
        foreach(var edmProperty in complexProperties)
        {
#>
    <#=codeStringGenerator.Property(edmProperty)#>
<#
        }
    }
#>
}
<#
    EndNamespace(code);
}

foreach (var enumType in typeMapper.GetEnumItemsToGenerate(itemCollection))
{
    fileManager.StartNewFile(enumType.Name + ".cs");
    BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
<#
    if (typeMapper.EnumIsFlags(enumType))
    {
#>
[Flags]
<#
    }
#>
<#=codeStringGenerator.EnumOpening(enumType)#>
{
<#
    var foundOne = false;
    
    foreach (MetadataItem member in typeMapper.GetEnumMembers(enumType))
    {
        foundOne = true;
#>
    <#=code.Escape(typeMapper.GetEnumMemberName(member))#> = <#=typeMapper.GetEnumMemberValue(member)#>,
<#
    }

    if (foundOne)
    {
        this.GenerationEnvironment.Remove(this.GenerationEnvironment.Length - 3, 1);
    }
#>
}
<#
    EndNamespace(code);
}

fileManager.Process();

#>
<#+

public void WriteHeader(CodeStringGenerator codeStringGenerator, EntityFrameworkTemplateFileManager fileManager)
{
    fileManager.StartHeader();
#>
//------------------------------------------------------------------------------
// <auto-generated>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
//
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
// </auto-generated>
//------------------------------------------------------------------------------
<#=codeStringGenerator.UsingDirectives(inHeader: true)#>
<#+
    fileManager.EndBlock();
}

public void BeginNamespace(CodeGenerationTools code)
{
    var codeNamespace = code.VsNamespaceSuggestion();
    if (!String.IsNullOrEmpty(codeNamespace))
    {
#>
namespace <#=code.EscapeNamespace(codeNamespace)#>
{
<#+
        PushIndent("    ");
    }
}

public void EndNamespace(CodeGenerationTools code)
{
    if (!String.IsNullOrEmpty(code.VsNamespaceSuggestion()))
    {
        PopIndent();
#>
}
<#+
    }
}

public const string TemplateId = "CSharp_DbContext_Types_EF6";

public class CodeStringGenerator
{
    private readonly CodeGenerationTools _code;
    private readonly TypeMapper _typeMapper;
    private readonly MetadataTools _ef;

    public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
    {
        ArgumentNotNull(code, "code");
        ArgumentNotNull(typeMapper, "typeMapper");
        ArgumentNotNull(ef, "ef");

        _code = code;
        _typeMapper = typeMapper;
        _ef = ef;
    }

    public string Property(EdmProperty edmProperty)
    {
        return string.Format(
            CultureInfo.InvariantCulture,
            "{0} {1} {2} {{ {3}get; {4}set; }}",
            Accessibility.ForProperty(edmProperty),
            _typeMapper.GetTypeName(edmProperty.TypeUsage),
            _code.Escape(edmProperty),
            _code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
            _code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
    }

    public string NavigationProperty(NavigationProperty navProp)
    {
        var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
        return string.Format(
            CultureInfo.InvariantCulture,
            "{0} {1} {2} {{ {3}get; {4}set; }}",
            AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
            navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
            _code.Escape(navProp),
            _code.SpaceAfter(Accessibility.ForGetter(navProp)),
            _code.SpaceAfter(Accessibility.ForSetter(navProp)));
    }
    
    public string AccessibilityAndVirtual(string accessibility)
    {
        return accessibility + (accessibility != "private" ? " virtual" : "");
    }
    
    public string EntityClassOpening(EntityType entity)
    {
        return string.Format(
            CultureInfo.InvariantCulture,
            "{0} {1}partial class {2}{3}",
            Accessibility.ForType(entity),
            _code.SpaceAfter(_code.AbstractOption(entity)),
            _code.Escape(entity),
            _code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
    }
    
    public string EnumOpening(SimpleType enumType)
    {
        return string.Format(
            CultureInfo.InvariantCulture,
            "{0} enum {1} : {2}",
            Accessibility.ForType(enumType),
            _code.Escape(enumType),
            _code.Escape(_typeMapper.UnderlyingClrType(enumType)));
        }
    
    public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
    {
        var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
        foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
        {
            var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
            var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
            var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
            writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
        }
    }
    
    public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
    {
        var parameters = _typeMapper.GetParameters(edmFunction);
        
        return string.Format(
            CultureInfo.InvariantCulture,
            "{0} IQueryable<{1}> {2}({3})",
            AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
            _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
            _code.Escape(edmFunction),
            string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
    }
    
    public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
    {
        var parameters = _typeMapper.GetParameters(edmFunction);
        
        return string.Format(
            CultureInfo.InvariantCulture,
            "return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
            _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
            edmFunction.NamespaceName,
            edmFunction.Name,
            string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
            _code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
    }
    
    public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
    {
        var parameters = _typeMapper.GetParameters(edmFunction);
        var returnType = _typeMapper.GetReturnType(edmFunction);

        var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
        if (includeMergeOption)
        {
            paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
        }

        return string.Format(
            CultureInfo.InvariantCulture,
            "{0} {1} {2}({3})",
            AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
            returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
            _code.Escape(edmFunction),
            paramList);
    }
    
    public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
    {
        var parameters = _typeMapper.GetParameters(edmFunction);
        var returnType = _typeMapper.GetReturnType(edmFunction);

        var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
        if (includeMergeOption)
        {
            callParams = ", mergeOption" + callParams;
        }
        
        return string.Format(
            CultureInfo.InvariantCulture,
            "return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
            returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
            edmFunction.Name,
            callParams);
    }
    
    public string DbSet(EntitySet entitySet)
    {
        return string.Format(
            CultureInfo.InvariantCulture,
            "{0} virtual DbSet<{1}> {2} {{ get; set; }}",
            Accessibility.ForReadOnlyProperty(entitySet),
            _typeMapper.GetTypeName(entitySet.ElementType),
            _code.Escape(entitySet));
    }

    public string UsingDirectives(bool inHeader, bool includeCollections = true)
    {
        return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
            ? string.Format(
                CultureInfo.InvariantCulture,
                "{0}using System;{1}" +
                "{2}",
                inHeader ? Environment.NewLine : "",
                includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
                inHeader ? "" : Environment.NewLine)
            : "";
    }
}

public class TypeMapper
{
    private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";

    private readonly System.Collections.IList _errors;
    private readonly CodeGenerationTools _code;
    private readonly MetadataTools _ef;

    public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
    {
        ArgumentNotNull(code, "code");
        ArgumentNotNull(ef, "ef");
        ArgumentNotNull(errors, "errors");

        _code = code;
        _ef = ef;
        _errors = errors;
    }

    public static string FixNamespaces(string typeName)
    {
        return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
    }

    public string GetTypeName(TypeUsage typeUsage)
    {
        return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
    }

    public string GetTypeName(EdmType edmType)
    {
        return GetTypeName(edmType, isNullable: null, modelNamespace: null);
    }

    public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
    {
        return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
    }

    public string GetTypeName(EdmType edmType, string modelNamespace)
    {
        return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
    }

    public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
    {
        if (edmType == null)
        {
            return null;
        }

        var collectionType = edmType as CollectionType;
        if (collectionType != null)
        {
            return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
        }

        var typeName = _code.Escape(edmType.MetadataProperties
                                .Where(p => p.Name == ExternalTypeNameAttributeName)
                                .Select(p => (string)p.Value)
                                .FirstOrDefault())
            ?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
                _code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
                _code.Escape(edmType));

        if (edmType is StructuralType)
        {
            return typeName;
        }

        if (edmType is SimpleType)
        {
            var clrType = UnderlyingClrType(edmType);
            if (!IsEnumType(edmType))
            {
                typeName = _code.Escape(clrType);
            }

            typeName = FixNamespaces(typeName);

            return clrType.IsValueType && isNullable == true ?
                String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
                typeName;
        }

        throw new ArgumentException("edmType");
    }
    
    public Type UnderlyingClrType(EdmType edmType)
    {
        ArgumentNotNull(edmType, "edmType");

        var primitiveType = edmType as PrimitiveType;
        if (primitiveType != null)
        {
            return primitiveType.ClrEquivalentType;
        }

        if (IsEnumType(edmType))
        {
            return GetEnumUnderlyingType(edmType).ClrEquivalentType;
        }

        return typeof(object);
    }
    
    public object GetEnumMemberValue(MetadataItem enumMember)
    {
        ArgumentNotNull(enumMember, "enumMember");
        
        var valueProperty = enumMember.GetType().GetProperty("Value");
        return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
    }
    
    public string GetEnumMemberName(MetadataItem enumMember)
    {
        ArgumentNotNull(enumMember, "enumMember");
        
        var nameProperty = enumMember.GetType().GetProperty("Name");
        return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
    }

    public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
    {
        ArgumentNotNull(enumType, "enumType");

        var membersProperty = enumType.GetType().GetProperty("Members");
        return membersProperty != null 
            ? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
            : Enumerable.Empty<MetadataItem>();
    }
    
    public bool EnumIsFlags(EdmType enumType)
    {
        ArgumentNotNull(enumType, "enumType");
        
        var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
        return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
    }

    public bool IsEnumType(GlobalItem edmType)
    {
        ArgumentNotNull(edmType, "edmType");

        return edmType.GetType().Name == "EnumType";
    }

    public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
    {
        ArgumentNotNull(enumType, "enumType");

        return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
    }

    public string CreateLiteral(object value)
    {
        if (value == null || value.GetType() != typeof(TimeSpan))
        {
            return _code.CreateLiteral(value);
        }

        return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
    }
    
    public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
    {
        ArgumentNotNull(types, "types");
        ArgumentNotNull(sourceFile, "sourceFile");
        
        var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
        if (types.Any(item => !hash.Add(item)))
        {
            _errors.Add(
                new CompilerError(sourceFile, -1, -1, "6023",
                    String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
            return false;
        }
        return true;
    }
    
    public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
    {
        return GetItemsToGenerate<SimpleType>(itemCollection)
            .Where(e => IsEnumType(e));
    }
    
    public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
    {
        return itemCollection
            .OfType<T>()
            .Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
            .OrderBy(i => i.Name);
    }

    public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
    {
        return itemCollection
            .Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
            .Select(g => GetGlobalItemName(g));
    }

    public string GetGlobalItemName(GlobalItem item)
    {
        if (item is EdmType)
        {
            return ((EdmType)item).Name;
        }
        else
        {
            return ((EntityContainer)item).Name;
        }
    }

    public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
    {
        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
    }
    
    public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
    {
        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
    }
    
    public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
    {
        return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
    }
    
    public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
    {
        return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
    }

    public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
    {
        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
    }
    
    public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
    {
        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
    }

    public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
    {
        return type.NavigationProperties.Where(np => np.DeclaringType == type);
    }
    
    public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
    {
        return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
    }
    
    public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
    {
        ArgumentNotNull(edmFunction, "edmFunction");

        var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
        return returnParamsProperty == null
            ? edmFunction.ReturnParameter
            : ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
    }

    public bool IsComposable(EdmFunction edmFunction)
    {
        ArgumentNotNull(edmFunction, "edmFunction");

        var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
        return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
    }

    public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
    {
        return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
    }

    public TypeUsage GetReturnType(EdmFunction edmFunction)
    {
        var returnParam = GetReturnParameter(edmFunction);
        return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
    }
    
    public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
    {
        var returnType = GetReturnType(edmFunction);
        return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
    }
}

public static void ArgumentNotNull<T>(T arg, string name) where T : class
{
    if (arg == null)
    {
        throw new ArgumentNullException(name);
    }
}
#>

BD/City.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     Этот код создан по шаблону.
//
//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace KomarovExam.BD
{
    using System;
    using System.Collections.Generic;
    
    public partial class City
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public City()
        {
            this.PunktVidachi = new HashSet<PunktVidachi>();
        }
    
        public int IDCity { get; set; }
        public string CityName { get; set; }
    
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<PunktVidachi> PunktVidachi { get; set; }
    }
}

BD/EdIzmer.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     Этот код создан по шаблону.
//
//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace KomarovExam.BD
{
    using System;
    using System.Collections.Generic;
    
    public partial class EdIzmer
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public EdIzmer()
        {
            this.Tovar = new HashSet<Tovar>();
        }
    
        public int IDEdIzm { get; set; }
        public string Edzm { get; set; }
    
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<Tovar> Tovar { get; set; }
    }
}

BD/Postavshik.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     Этот код создан по шаблону.
//
//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace KomarovExam.BD
{
    using System;
    using System.Collections.Generic;
    
    public partial class Postavshik
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public Postavshik()
        {
            this.Tovar = new HashSet<Tovar>();
        }
    
        public int IDPostavshik { get; set; }
        public string PostavshikName { get; set; }
    
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<Tovar> Tovar { get; set; }
    }
}

BD/Proizvoditeli.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     Этот код создан по шаблону.
//
//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace KomarovExam.BD
{
    using System;
    using System.Collections.Generic;
    
    public partial class Proizvoditeli
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public Proizvoditeli()
        {
            this.Tovar = new HashSet<Tovar>();
        }
    
        public int IDProizvoditelia { get; set; }
        public string NameProizvoditelia { get; set; }
    
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<Tovar> Tovar { get; set; }
    }
}

BD/PunktVidachi.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     Этот код создан по шаблону.
//
//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace KomarovExam.BD
{
    using System;
    using System.Collections.Generic;
    
    public partial class PunktVidachi
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public PunktVidachi()
        {
            this.Zakaz = new HashSet<Zakaz>();
        }
    
        public int IDPunktVidashi { get; set; }
        public int IDCity { get; set; }
        public int AdressIndex { get; set; }
        public string Street { get; set; }
        public Nullable<int> StreetNumber { get; set; }
    
        public virtual City City { get; set; }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<Zakaz> Zakaz { get; set; }
    }
}

BD/Role.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     Этот код создан по шаблону.
//
//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace KomarovExam.BD
{
    using System;
    using System.Collections.Generic;
    
    public partial class Role
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public Role()
        {
            this.User = new HashSet<User>();
        }
    
        public int IDRole { get; set; }
        public string RoleName { get; set; }
    
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<User> User { get; set; }
    }
}

BD/StatusZakaza.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     Этот код создан по шаблону.
//
//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace KomarovExam.BD
{
    using System;
    using System.Collections.Generic;
    
    public partial class StatusZakaza
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public StatusZakaza()
        {
            this.Zakaz = new HashSet<Zakaz>();
        }
    
        public int IDStatusZakaza { get; set; }
        public string StatusZakazaName { get; set; }
    
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<Zakaz> Zakaz { get; set; }
    }
}

BD/Tovar.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     Этот код создан по шаблону.
//
//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace KomarovExam.BD
{
    using System;
    using System.Collections.Generic;
    
    public partial class Tovar
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public Tovar()
        {
            this.Zakaz = new HashSet<Zakaz>();
        }
    
        public int IDTovar { get; set; }
        public int IDPostavshik { get; set; }
        public int IDProizvoditelia { get; set; }
        public int IDTovarCategory { get; set; }
        public int IDEdIzm { get; set; }
        public string Article { get; set; }
        public string TovarName { get; set; }
        public decimal Cost { get; set; }
        public Nullable<int> Discount { get; set; }
        public Nullable<int> KolvoNaSklade { get; set; }
        public string Description { get; set; }
        public string Image { get; set; }
    
        public virtual EdIzmer EdIzmer { get; set; }
        public virtual Postavshik Postavshik { get; set; }
        public virtual Proizvoditeli Proizvoditeli { get; set; }
        public virtual TovarCategory TovarCategory { get; set; }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<Zakaz> Zakaz { get; set; }
    }
}

BD/TovarCategory.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     Этот код создан по шаблону.
//
//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace KomarovExam.BD
{
    using System;
    using System.Collections.Generic;
    
    public partial class TovarCategory
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public TovarCategory()
        {
            this.Tovar = new HashSet<Tovar>();
        }
    
        public int IDTovarCategory { get; set; }
        public string TovarCategoryName { get; set; }
    
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<Tovar> Tovar { get; set; }
    }
}

BD/User.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     Этот код создан по шаблону.
//
//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace KomarovExam.BD
{
    using System;
    using System.Collections.Generic;
    
    public partial class User
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public User()
        {
            this.Zakaz = new HashSet<Zakaz>();
        }
    
        public int IDUser { get; set; }
        public int IDRole { get; set; }
        public string Familia { get; set; }
        public string Imya { get; set; }
        public string Otchestvo { get; set; }
        public string Login { get; set; }
        public string Password { get; set; }
    
        public virtual Role Role { get; set; }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<Zakaz> Zakaz { get; set; }
    }
}

BD/Zakaz.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     Этот код создан по шаблону.
//
//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace KomarovExam.BD
{
    using System;
    using System.Collections.Generic;
    
    public partial class Zakaz
    {
        public int IDZakaza { get; set; }
        public int IDTovar { get; set; }
        public Nullable<int> IDPunktVidashi { get; set; }
        public int IDUser { get; set; }
        public Nullable<int> IDStatusZakaza { get; set; }
        public int NomerZakaza { get; set; }
        public Nullable<int> Kolvo { get; set; }
        public Nullable<System.DateTime> DateZakaza { get; set; }
        public Nullable<System.DateTime> DateDelivery { get; set; }
        public Nullable<int> CodePolushenia { get; set; }
    
        public virtual PunktVidachi PunktVidachi { get; set; }
        public virtual StatusZakaza StatusZakaza { get; set; }
        public virtual Tovar Tovar { get; set; }
        public virtual User User { get; set; }
    }
}

BD/sysdiagrams.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     Этот код создан по шаблону.
//
//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace KomarovExam.BD
{
    using System;
    using System.Collections.Generic;
    
    public partial class sysdiagrams
    {
        public string name { get; set; }
        public int principal_id { get; set; }
        public int diagram_id { get; set; }
        public Nullable<int> version { get; set; }
        public byte[] definition { get; set; }
    }
}

Properties/AssemblyInfo.cs

using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;

// Общие сведения об этой сборке предоставляются следующим набором
// набор атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой.
[assembly: AssemblyTitle("KomarovExam")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KomarovExam")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
// из модели COM, установите атрибут ComVisible для этого типа в значение true.
[assembly: ComVisible(false)]

//Чтобы начать создание локализуемых приложений, задайте
//<UICulture>CultureYouAreCodingWith</UICulture> в файле .csproj
//в <PropertyGroup>. Например, при использовании английского (США)
//в своих исходных файлах установите <UICulture> в en-US.  Затем отмените преобразование в комментарий
//атрибута NeutralResourceLanguage ниже.  Обновите "en-US" в
//строка внизу для обеспечения соответствия настройки UICulture в файле проекта.

//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]


[assembly: ThemeInfo(
    ResourceDictionaryLocation.None, //где расположены словари ресурсов по конкретным тематикам
                                     //(используется, если ресурс не найден на странице,
                                     // или в словарях ресурсов приложения)
    ResourceDictionaryLocation.SourceAssembly //где расположен словарь универсальных ресурсов
                                              //(используется, если ресурс не найден на странице,
                                              // в приложении или в каких-либо словарях ресурсов для конкретной темы)
)]


// Сведения о версии для сборки включают четыре следующих значения:
//
//      Основной номер версии
//      Дополнительный номер версии
//      Номер сборки
//      Номер редакции
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Properties/Resources.Designer.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     Этот код был создан программным средством.
//     Версия среды выполнения: 4.0.30319.42000
//
//     Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если
//     код создан повторно.
// </auto-generated>
//------------------------------------------------------------------------------

namespace KomarovExam.Properties
{


    /// <summary>
    ///   Класс ресурсов со строгим типом для поиска локализованных строк и пр.
    /// </summary>
    // Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder
    // класс с помощью таких средств, как ResGen или Visual Studio.
    // Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen
    // с параметром /str или заново постройте свой VS-проект.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Resources
    {

        private static global::System.Resources.ResourceManager resourceMan;

        private static global::System.Globalization.CultureInfo resourceCulture;

        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources()
        {
        }

        /// <summary>
        ///   Возврат кэшированного экземпляра ResourceManager, используемого этим классом.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager
        {
            get
            {
                if ((resourceMan == null))
                {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("KomarovExam.Properties.Resources", typeof(Resources).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }

        /// <summary>
        ///   Переопределяет свойство CurrentUICulture текущего потока для всех
        ///   подстановки ресурсов с помощью этого класса ресурсов со строгим типом.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture
        {
            get
            {
                return resourceCulture;
            }
            set
            {
                resourceCulture = value;
            }
        }
    }
}

Properties/Resources.resx

<?xml version="1.0" encoding="utf-8"?>
<root>
  
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
</root>

Properties/Settings.Designer.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace KomarovExam.Properties
{


    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
    {

        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

        public static Settings Default
        {
            get
            {
                return defaultInstance;
            }
        }
    }
}

Properties/Settings.settings

<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
  <Profiles>
    <Profile Name="(Default)" />
  </Profiles>
  <Settings />
</SettingsFile>

Script/KomarovExam.sql

USE [master]
GO
CREATE DATABASE [KomarovExam]
GO
USE [KomarovExam]
GO
CREATE TABLE [dbo].[City](
	[IDCity] [int] NOT NULL,
	[CityName] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_City] PRIMARY KEY CLUSTERED 
(
	[IDCity] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EdIzmer](
	[IDEdIzm] [int] IDENTITY(1,1) NOT NULL,
	[Edzm] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_EdIzmer] PRIMARY KEY CLUSTERED 
(
	[IDEdIzm] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Postavshik](
	[IDPostavshik] [int] IDENTITY(1,1) NOT NULL,
	[PostavshikName] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Postavshik] PRIMARY KEY CLUSTERED 
(
	[IDPostavshik] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Proizvoditeli](
	[IDProizvoditelia] [int] IDENTITY(1,1) NOT NULL,
	[NameProizvoditelia] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Proizvoditeli] PRIMARY KEY CLUSTERED 
(
	[IDProizvoditelia] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PunktVidachi](
	[IDPunktVidashi] [int] NOT NULL,
	[IDCity] [int] NOT NULL,
	[AdressIndex] [int] NOT NULL,
	[Street] [nvarchar](50) NOT NULL,
	[StreetNumber] [int] NULL,
 CONSTRAINT [PK_PunktVidachi] PRIMARY KEY CLUSTERED 
(
	[IDPunktVidashi] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Role](
	[IDRole] [int] NOT NULL,
	[RoleName] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Role] PRIMARY KEY CLUSTERED 
(
	[IDRole] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatusZakaza](
	[IDStatusZakaza] [int] NOT NULL,
	[StatusZakazaName] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_StatusZakaza] PRIMARY KEY CLUSTERED 
(
	[IDStatusZakaza] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tovar](
	[IDTovar] [int] IDENTITY(1,1) NOT NULL,
	[IDPostavshik] [int] NOT NULL,
	[IDProizvoditelia] [int] NOT NULL,
	[IDTovarCategory] [int] NOT NULL,
	[IDEdIzm] [int] NOT NULL,
	[Article] [nvarchar](6) NOT NULL,
	[TovarName] [nvarchar](150) NOT NULL,
	[Cost] [money] NOT NULL,
	[Discount] [int] NULL,
	[KolvoNaSklade] [int] NULL,
	[Description] [text] NOT NULL,
	[Image] [nvarchar](50) NULL,
 CONSTRAINT [PK_Tovar] PRIMARY KEY CLUSTERED 
(
	[IDTovar] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TovarCategory](
	[IDTovarCategory] [int] IDENTITY(1,1) NOT NULL,
	[TovarCategoryName] [nvarchar](50) NULL,
 CONSTRAINT [PK_TovarCategory] PRIMARY KEY CLUSTERED 
(
	[IDTovarCategory] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[User](
	[IDUser] [int] NOT NULL,
	[IDRole] [int] NOT NULL,
	[Familia] [nvarchar](50) NOT NULL,
	[Imya] [nvarchar](50) NOT NULL,
	[Otchestvo] [nvarchar](50) NULL,
	[Login] [nvarchar](50) NOT NULL,
	[Password] [nvarchar](30) NOT NULL,
 CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED 
(
	[IDUser] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO 
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Zakaz](
	[IDZakaza] [int] IDENTITY(1,1) NOT NULL,
	[IDTovar] [int] NOT NULL,
	[IDPunktVidashi] [int] NULL,
	[IDUser] [int] NOT NULL,
	[IDStatusZakaza] [int] NULL,
	[NomerZakaza] [int] NOT NULL,
	[Kolvo] [int] NULL,
	[DateZakaza] [date] NULL,
	[DateDelivery] [date] NULL,
	[CodePolushenia] [int] NULL,
 CONSTRAINT [PK_Zakaz] PRIMARY KEY CLUSTERED 
(
	[IDZakaza] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
INSERT [dbo].[City] ([IDCity], [CityName]) VALUES (1, N'5A=>9')
GO
SET IDENTITY_INSERT [dbo].[EdIzmer] ON 

INSERT [dbo].[EdIzmer] ([IDEdIzm], [Edzm]) VALUES (1, N'HB.')
SET IDENTITY_INSERT [dbo].[EdIzmer] OFF
GO
SET IDENTITY_INSERT [dbo].[Postavshik] ON 

INSERT [dbo].[Postavshik] ([IDPostavshik], [PostavshikName]) VALUES (1, N'Pikeshop')
INSERT [dbo].[Postavshik] ([IDPostavshik], [PostavshikName]) VALUES (2, N'Playbig')
INSERT [dbo].[Postavshik] ([IDPostavshik], [PostavshikName]) VALUES (3, N'Knauf')
INSERT [dbo].[Postavshik] ([IDPostavshik], [PostavshikName]) VALUES (4, N'CHILITOY')
INSERT [dbo].[Postavshik] ([IDPostavshik], [PostavshikName]) VALUES (5, N'Vinylon')
SET IDENTITY_INSERT [dbo].[Postavshik] OFF
GO
SET IDENTITY_INSERT [dbo].[Proizvoditeli] ON 

INSERT [dbo].[Proizvoditeli] ([IDProizvoditelia], [NameProizvoditelia]) VALUES (1, N'ABS?;0AB8:')
INSERT [dbo].[Proizvoditeli] ([IDProizvoditelia], [NameProizvoditelia]) VALUES (2, N'BambiniFelici')
INSERT [dbo].[Proizvoditeli] ([IDProizvoditelia], [NameProizvoditelia]) VALUES (3, N'Junion')
SET IDENTITY_INSERT [dbo].[Proizvoditeli] OFF
GO
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (1, 1, 420151, N' C;. 8H=520O', 32)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (2, 1, 125061, N' C;. >43>@=0O', 8)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (3, 1, 630370, N' C;. (>AA59=0O', 24)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (4, 1, 400562, N' C;. 5;5=0O', 32)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (5, 1, 614510, N' C;. 0O:>2A:>3>', 47)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (6, 1, 410542, N' C;. !25B;0O', 46)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (7, 1, 620839, N' C;. &25B>G=0O', 8)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (8, 1, 443890, N' C;. ><<C=8AB8G5A:0O', 1)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (9, 1, 603379, N' C;. !?>@B82=0O', 46)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (10, 1, 603721, N' C;. >3>;O', 41)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (11, 1, 410172, N' C;. !525@=0O', 13)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (12, 1, 614611, N' C;. >;>456=0O', 50)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (13, 1, 454311, N' C;. >20O', 19)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (14, 1, 660007, N' C;. :BO1@LA:0O', 19)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (15, 1, 603036, N' C;. !04>20O', 4)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (16, 1, 394060, N' C;. $@C=75', 43)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (17, 1, 410661, N' C;. (:>;L=0O', 50)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (18, 1, 625590, N' C;. ><<C=8AB8G5A:0O', 20)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (19, 1, 625683, N' C;. 8 0@B0', NULL)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (20, 1, 450983, N' C;. ><A><>;LA:0O', 26)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (21, 1, 394782, N' C;. '5E>20', 3)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (22, 1, 603002, N' C;. 75@68=A:>3>', 28)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (23, 1, 450558, N' C;. 015@56=0O', 30)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (24, 1, 344288, N' C;. '5E>20', 1)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (25, 1, 614164, N'  C;. !B5?=0O', 30)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (26, 1, 394242, N' C;. ><<C=8AB8G5A:0O', 43)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (27, 1, 660540, N' C;. !>;=5G=0O', 25)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (28, 1, 125837, N' C;. (>AA59=0O', 40)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (29, 1, 125703, N' C;. 0@B870=A:0O', 49)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (30, 1, 625283, N' C;. >154K', 46)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (31, 1, 614753, N' C;. >;520O', 35)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (32, 1, 426030, N' C;. 0O:>2A:>3>', 44)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (33, 1, 450375, N'C;. ;C1=0O', 44)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (34, 1, 625560, N' C;. 5:@0A>20', 12)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (35, 1, 630201, N' C;. ><A><>;LA:0O', 17)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (36, 1, 190949, N' C;. 8GC@8=0', 26)
GO
INSERT [dbo].[Role] ([IDRole], [RoleName]) VALUES (1, N'4<8=8AB@0B>@')
INSERT [dbo].[Role] ([IDRole], [RoleName]) VALUES (2, N'5=5465@')
INSERT [dbo].[Role] ([IDRole], [RoleName]) VALUES (3, N'2B>@878@>20==K9 :;85=B')
GO
INSERT [dbo].[StatusZakaza] ([IDStatusZakaza], [StatusZakazaName]) VALUES (1, N'025@H5=')
INSERT [dbo].[StatusZakaza] ([IDStatusZakaza], [StatusZakazaName]) VALUES (2, N'>2K9')
GO
SET IDENTITY_INSERT [dbo].[Tovar] ON 

INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (1, 1, 1, 1, 1, N'PMEZMH', N'5BA:89 83@>2>9 =01>@ <0H8=>: )5=OG89 ?0B@C;L / Dogs mini . 9 35@>52 + 9 8=5@D8>==KE <0H8=>:', 1414.0000, 22, 50, N'5BA:89 =01>@ <0H8=>: A 35@>O<8 <C;LBA5@80;0 «)5=OG89 ?0B@C;L» ?>4>945B :0: 4;O <0;LG8:>2, B0: 8 4;O 452>G5:.  45BA:89 =01>@ 2E>48B 9 D83C@>: I5=:>2 A?0A0B5;59. ', N'1.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (2, 2, 1, 2, 1, N'BPV4MM', N'>=AB@C:B>@ 0@@8 >BB5@ !>20 C:;O 630 45B0;59 A>2<5AB8< A lego harry potter, ;53> A>2<5AB8<K9)', 771.0000, 15, 26, N'>;;5:F8>==0O <>45;L C:;O A>AB>8B 87 <=>65AB20 ?>B@OA0NI8E M;5<5=B>2, 0 B0:65 A?5F80;L=>3> <5E0=87<0 2=CB@8. ! 53> ?><>ILN <>6=> ?;02=> ?>4=8<0BL->?CA:0BL :@K;LO ?B8FK.', N'2.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (3, 2, 2, 3, 1, N'JVL42J', N'C7K:0;L=K5 8=AB@C<5=BK 4;O 45B59, :A8;>D>=, 10@010=K, @072820NI85 83@CH:8, 83@CH:8 4;O 45B59', 2750.0000, 15, 0, N'B:@>9B5 <8@ <C7K:8 4;O 20H53> @515=:0 A MB>9 C=8:0;L=>9 83@CH:>9! -B> <=>3>DC=:F8>=0;L=>5 <C7K:0;L=>5 GC4> >1J548=O5B 2 A515 2AQ, GB> =C6=> 4;O B2>@G5A:>3> @0728B8O.', N'3.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (4, 3, 1, 4, 1, N'F895RB', N'0H8=:0 83@CH:0 48A:> H0@ A25BOI0OAO <C7K:0;L=0O', 368.0000, 6, 7, N'!25BOI0OAO <C7K:0;L=0O <0H8=0 A 48A:> H0@>< ?5@5;8205BAO @07=K<8 F25B0<8, 83@05B @8B<8G=K5 <5;>488, >1J57605B ?@5?OBAB28O 8 :@CB8BAO, ?>MB><C A =59 B>G=> =5 1C45B A:CG=>.', N'4.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (5, 3, 2, 1, 1, N'3XBOTN', N'3@>2>9 =01>@ Hot Wheels Action Loop Cyclone Challenge Track, A <0H8=:>9 8 C4>1=K< E@0=5=85<, HTK16', 3426.0000, 10, 21, N'3@>2>9 =01>@ Hot Wheels Action Loop Cyclone Challenge Track - MB> C=8:0;L=0O 83@0, :>B>@0O ?>72>;8B 20< 8A?KB0BL A51O 8 A2>8E 4@C759 2 A:>@>AB8 8 ;>2:>AB8. -B>B =01>@ A>AB>8B 87 <5B0;;8G5A:>9 4>@>6:8 A F8:;>=><, :>B>@0O A>7405B ?>B@OA0NI89 MDD5:B 8 4>102;O5B 4>?>;=8B5;L=CN A;>6=>ABL 2 83@C.', N'5.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (6, 3, 3, 1, 1, N'3L7RCZ', N'3@>2>9 =01>@ A 45@52O==K<8 <0H8=:0<8 !B@>9?;>I04:0 @0=-0@:A, Junion', 7400.0000, 15, 0, N'3@>2>9 =01>@ «!B@>9?;>I04:0 @0=-0@:A Junion»   MB> 1>;LH0O 83@CH5G=0O ?0@:>2:0 A 45@52O==K<8 <0H8=:0<8 8 =0AB>OI8< ?>4JQ<=K< :@0=><, ?@84C<0==0O 2 /=45:A5 =0AB>OI8<8 @>48B5;O<8.', N'6.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (7, 4, 3, 3, 1, N'S72AM3', N'!8=B570B>@ 45BA:89 A <8:@>D>=>< 61 :;028H0', 1749.0000, 10, 35, N'B:@>9B5 4;O @515=:0 425@L 2 <8@ <C7K:8 A 45BA:8< A8=B570B>@><! -B>B :><?0:B=K9 8=AB@C<5=B A <8:@>D>=>< AB0=5B 25@=K< 4@C3>< 4;O N=KE <C7K:0=B>2, ?><>30O 8< @072820BL B2>@G5A:89 ?>B5=F80; 8 ?>;CG0BL C4>2>;LAB285 >B 83@K.', N'7.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (8, 5, 3, 1, 1, N'2G3280', N'5@52O==K9 83@>2>9 =01>@ JUNION !B@>9?;>I04:0 "@0=-0@:A" A ?>4JQ<=K<, AB@>8B5;L=K< :@0=>< 8 <0H8=:0<8, 18 ?@54<5B>2, ?>4286=K5 M;5<5=BK', 1624.0000, 9, 20, N'3@>2>9 =01>@ «!B@>9?;>I04:0 @0=-0@:A Junion»   MB> 1>;LH0O 83@CH5G=0O ?0@:>2:0 A 45@52O==K<8 <0H8=:0<8 8 =0AB>OI8< ?>4JQ<=K< :@0=><, ?@84C<0==0O 2 /=45:A5 =0AB>OI8<8 @>48B5;O<8.', N'8.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (9, 5, 2, 3, 1, N'MIO8YV', N'C7K:0;L=0O 83@CH:0 8=B5@0:B82=0O C;LB, 45BA:89 ?@>@57K20B5;L 4;O <0;KH59', 305.0000, 9, 31, N'C7K:0;L=0O 83@CH:0 8=B5@0:B82=0O C;LB, 45BA:89 ?@>@57K20B5;L 4;O <0;KH59', N'9.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (10, 5, 2, 1, 1, N'UER2QD', N'>;LH>9 =01>@ >?KB>2 8 M:A?5@8<5=B>2 4;O 45B59 14 2 1', 2506.0000, 8, 27, N'>;LH>9 =01>@ >?KB>2 8 M:A?5@8<5=B>2 4;O 45B59 14 2 1', N'10.jpg')
SET IDENTITY_INSERT [dbo].[Tovar] OFF
GO
SET IDENTITY_INSERT [dbo].[TovarCategory] ON 

INSERT [dbo].[TovarCategory] ([IDTovarCategory], [TovarCategoryName]) VALUES (1, N'3@>2>9 =01>@')
INSERT [dbo].[TovarCategory] ([IDTovarCategory], [TovarCategoryName]) VALUES (2, N'>=AB@C:B>@')
INSERT [dbo].[TovarCategory] ([IDTovarCategory], [TovarCategoryName]) VALUES (3, N'5BA:89 <C7K:0;L=K9 8=AB@C<5=B')
INSERT [dbo].[TovarCategory] ([IDTovarCategory], [TovarCategoryName]) VALUES (4, N'0H8=:0')
SET IDENTITY_INSERT [dbo].[TovarCategory] OFF
GO
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (1, 1, N'>@A8=', N'5B@', N'235=L528G', N'94d5ous@gmail.com', N'uzWC67')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (2, 1, N'!B0@8:>20', N';5=0', N'02;>2=0', N'uth4iz@mail.com', N'2L6KZG')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (3, 1, N'48=F>2', N'!5@0D8<', N'@BQ<>28G', N'yzls62@outlook.com', N'JlFRCZ')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (4, 2, N'8E09;N:', N'==0', N'OG5A;02>2=0', N'1diph5e@tutanota.com', N'8ntwUp')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (5, 2, N'!8B48:>20', N';5=0', N'=0B>;L52=0', N'tjde7c@yahoo.com', N'YOyhfR')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (6, 2, N'8:8D>@>20', N'5A5=8O', N'8:>;052=0', N'wpmrc3do@tutanota.com', N'RSbvHv')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (7, 3, N'!B5?0=>2', N'8E08;', N'@BQ<>28G', N'5d4zbu@tutanota.com', N'rwVDh9')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (8, 3, N'>@A8=', N'5B@', N'235=L528G', N'ptec8ym@yahoo.com', N'LdNyos')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (9, 3, N'!B0@8:>20', N';5=0', N'02;>2=0', N'1qz4kw@mail.com', N'gynQMT')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (10, 3, N'!07>=>2', N' CA;0=', N'5@<0=>28G', N'4np6se@mail.com', N'AtnDjr')
GO
SET IDENTITY_INSERT [dbo].[Zakaz] ON 

INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (1, 1, 1, 1, 1, 1, 2, CAST(N'2025-02-27' AS Date), CAST(N'2025-04-20' AS Date), 901)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (2, 2, 1, 7, 1, 1, 2, CAST(N'2025-02-27' AS Date), CAST(N'2025-04-20' AS Date), 901)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (3, 3, 11, 1, 1, 2, 1, CAST(N'2024-09-28' AS Date), CAST(N'2025-04-21' AS Date), 902)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (4, 4, 11, 1, 1, 2, 1, CAST(N'2024-09-28' AS Date), CAST(N'2025-04-21' AS Date), 902)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (5, 5, 2, 2, 1, 3, 10, CAST(N'2025-03-21' AS Date), CAST(N'2025-04-22' AS Date), 903)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (6, 6, 2, 2, 1, 3, 10, CAST(N'2025-03-21' AS Date), CAST(N'2025-04-22' AS Date), 903)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (7, 7, 11, 10, 1, 4, 5, CAST(N'2025-02-20' AS Date), CAST(N'2025-04-23' AS Date), 904)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (8, 8, 11, 10, 1, 4, 4, CAST(N'2025-02-20' AS Date), CAST(N'2025-04-23' AS Date), 904)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (9, 9, 2, 7, 1, 5, 2, CAST(N'2025-03-17' AS Date), CAST(N'2025-04-24' AS Date), 905)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (10, 10, 2, 7, 1, 5, 2, CAST(N'2025-03-17' AS Date), CAST(N'2025-04-24' AS Date), 905)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (11, 1, 15, 1, 1, 6, 2, CAST(N'2025-03-01' AS Date), CAST(N'2025-04-25' AS Date), 906)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (12, 2, 15, 1, 1, 6, 2, CAST(N'2025-03-01' AS Date), CAST(N'2025-04-25' AS Date), 906)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (13, 3, 3, 9, 1, 7, 1, CAST(N'2025-02-03' AS Date), CAST(N'2025-04-26' AS Date), 907)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (14, 4, 3, 9, 1, 7, 1, CAST(N'2025-02-03' AS Date), CAST(N'2025-04-26' AS Date), 907)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (15, 5, 19, 10, 2, 8, 10, CAST(N'2025-03-31' AS Date), CAST(N'2025-04-27' AS Date), 908)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (16, 6, 19, 10, 2, 8, 10, CAST(N'2025-03-31' AS Date), CAST(N'2025-04-27' AS Date), 908)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (17, 7, 5, 9, 2, 9, 5, CAST(N'2025-04-02' AS Date), CAST(N'2025-04-28' AS Date), 909)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (18, 8, 5, 9, 2, 9, 4, CAST(N'2025-04-02' AS Date), CAST(N'2025-04-28' AS Date), 909)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (19, 9, 19, 10, 2, 10, 2, CAST(N'2025-04-03' AS Date), CAST(N'2025-04-29' AS Date), 910)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (20, 10, 19, 10, 2, 10, 2, CAST(N'2025-04-03' AS Date), CAST(N'2025-04-29' AS Date), 910)
SET IDENTITY_INSERT [dbo].[Zakaz] OFF
GO
ALTER TABLE [dbo].[PunktVidachi]  WITH CHECK ADD  CONSTRAINT [FK_PunktVidachi_City] FOREIGN KEY([IDCity])
REFERENCES [dbo].[City] ([IDCity])
GO
ALTER TABLE [dbo].[PunktVidachi] CHECK CONSTRAINT [FK_PunktVidachi_City]
GO
ALTER TABLE [dbo].[Tovar]  WITH CHECK ADD  CONSTRAINT [FK_Tovar_EdIzmer] FOREIGN KEY([IDEdIzm])
REFERENCES [dbo].[EdIzmer] ([IDEdIzm])
GO
ALTER TABLE [dbo].[Tovar] CHECK CONSTRAINT [FK_Tovar_EdIzmer]
GO
ALTER TABLE [dbo].[Tovar]  WITH CHECK ADD  CONSTRAINT [FK_Tovar_Postavshik] FOREIGN KEY([IDPostavshik])
REFERENCES [dbo].[Postavshik] ([IDPostavshik])
GO
ALTER TABLE [dbo].[Tovar] CHECK CONSTRAINT [FK_Tovar_Postavshik]
GO
ALTER TABLE [dbo].[Tovar]  WITH CHECK ADD  CONSTRAINT [FK_Tovar_Proizvoditeli] FOREIGN KEY([IDProizvoditelia])
REFERENCES [dbo].[Proizvoditeli] ([IDProizvoditelia])
GO
ALTER TABLE [dbo].[Tovar] CHECK CONSTRAINT [FK_Tovar_Proizvoditeli]
GO
ALTER TABLE [dbo].[Tovar]  WITH CHECK ADD  CONSTRAINT [FK_Tovar_TovarCategory] FOREIGN KEY([IDTovarCategory])
REFERENCES [dbo].[TovarCategory] ([IDTovarCategory])
GO
ALTER TABLE [dbo].[Tovar] CHECK CONSTRAINT [FK_Tovar_TovarCategory]
GO
ALTER TABLE [dbo].[User]  WITH CHECK ADD  CONSTRAINT [FK_User_Role] FOREIGN KEY([IDRole])
REFERENCES [dbo].[Role] ([IDRole])
GO
ALTER TABLE [dbo].[User] CHECK CONSTRAINT [FK_User_Role]
GO
ALTER TABLE [dbo].[Zakaz]  WITH CHECK ADD  CONSTRAINT [FK_Zakaz_PunktVidachi] FOREIGN KEY([IDPunktVidashi])
REFERENCES [dbo].[PunktVidachi] ([IDPunktVidashi])
GO
ALTER TABLE [dbo].[Zakaz] CHECK CONSTRAINT [FK_Zakaz_PunktVidachi]
GO
ALTER TABLE [dbo].[Zakaz]  WITH CHECK ADD  CONSTRAINT [FK_Zakaz_StatusZakaza] FOREIGN KEY([IDStatusZakaza])
REFERENCES [dbo].[StatusZakaza] ([IDStatusZakaza])
GO
ALTER TABLE [dbo].[Zakaz] CHECK CONSTRAINT [FK_Zakaz_StatusZakaza]
GO
ALTER TABLE [dbo].[Zakaz]  WITH CHECK ADD  CONSTRAINT [FK_Zakaz_Tovar] FOREIGN KEY([IDTovar])
REFERENCES [dbo].[Tovar] ([IDTovar])
GO
ALTER TABLE [dbo].[Zakaz] CHECK CONSTRAINT [FK_Zakaz_Tovar]
GO
ALTER TABLE [dbo].[Zakaz]  WITH CHECK ADD  CONSTRAINT [FK_Zakaz_User] FOREIGN KEY([IDUser])
REFERENCES [dbo].[User] ([IDUser])
GO
ALTER TABLE [dbo].[Zakaz] CHECK CONSTRAINT [FK_Zakaz_User]
GO
USE [master]
GO
ALTER DATABASE [KomarovExam] SET  READ_WRITE 
GO

SokolovExamen.sql

USE [master]
GO
CREATE DATABASE [SokolovExamen]
GO
USE [SokolovExamen]
GO 
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[City](
	[IDCity] [int] NOT NULL,
	[CityName] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_City] PRIMARY KEY CLUSTERED 
(
	[IDCity] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EdIzmer](
	[IDEdIzm] [int] IDENTITY(1,1) NOT NULL,
	[Edzm] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_EdIzmer] PRIMARY KEY CLUSTERED 
(
	[IDEdIzm] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Postavshik](
	[IDPostavshik] [int] IDENTITY(1,1) NOT NULL,
	[PostavshikName] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Postavshik] PRIMARY KEY CLUSTERED 
(
	[IDPostavshik] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Proizvoditeli](
	[IDProizvoditelia] [int] IDENTITY(1,1) NOT NULL,
	[NameProizvoditelia] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Proizvoditeli] PRIMARY KEY CLUSTERED 
(
	[IDProizvoditelia] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PunktVidachi](
	[IDPunktVidashi] [int] NOT NULL,
	[IDCity] [int] NOT NULL,
	[AdressIndex] [int] NOT NULL,
	[Street] [nvarchar](50) NOT NULL,
	[StreetNumber] [int] NULL,
 CONSTRAINT [PK_PunktVidachi] PRIMARY KEY CLUSTERED 
(
	[IDPunktVidashi] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Role](
	[IDRole] [int] NOT NULL,
	[RoleName] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Role] PRIMARY KEY CLUSTERED 
(
	[IDRole] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatusZakaza](
	[IDStatusZakaza] [int] NOT NULL,
	[StatusZakazaName] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_StatusZakaza] PRIMARY KEY CLUSTERED 
(
	[IDStatusZakaza] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tovar](
	[IDTovar] [int] IDENTITY(1,1) NOT NULL,
	[IDPostavshik] [int] NOT NULL,
	[IDProizvoditelia] [int] NOT NULL,
	[IDTovarCategory] [int] NOT NULL,
	[IDEdIzm] [int] NOT NULL,
	[Article] [nvarchar](6) NOT NULL,
	[TovarName] [nvarchar](150) NOT NULL,
	[Cost] [money] NOT NULL,
	[Discount] [int] NULL,
	[KolvoNaSklade] [int] NULL,
	[Description] [text] NOT NULL,
	[Image] [nvarchar](50) NULL,
 CONSTRAINT [PK_Tovar] PRIMARY KEY CLUSTERED 
(
	[IDTovar] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TovarCategory](
	[IDTovarCategory] [int] IDENTITY(1,1) NOT NULL,
	[TovarCategoryName] [nvarchar](50) NULL,
 CONSTRAINT [PK_TovarCategory] PRIMARY KEY CLUSTERED 
(
	[IDTovarCategory] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[User](
	[IDUser] [int] NOT NULL,
	[IDRole] [int] NOT NULL,
	[Familia] [nvarchar](50) NOT NULL,
	[Imya] [nvarchar](50) NOT NULL,
	[Otchestvo] [nvarchar](50) NULL,
	[Login] [nvarchar](50) NOT NULL,
	[Password] [nvarchar](30) NOT NULL,
 CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED 
(
	[IDUser] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Zakaz](
	[IDZakaza] [int] IDENTITY(1,1) NOT NULL,
	[IDTovar] [int] NOT NULL,
	[IDPunktVidashi] [int] NULL,
	[IDUser] [int] NOT NULL,
	[IDStatusZakaza] [int] NULL,
	[NomerZakaza] [int] NOT NULL,
	[Kolvo] [int] NULL,
	[DateZakaza] [date] NULL,
	[DateDelivery] [date] NULL,
	[CodePolushenia] [int] NULL,
 CONSTRAINT [PK_Zakaz] PRIMARY KEY CLUSTERED 
(
	[IDZakaza] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
INSERT [dbo].[City] ([IDCity], [CityName]) VALUES (1, N'Лесной')
GO
SET IDENTITY_INSERT [dbo].[EdIzmer] ON 

INSERT [dbo].[EdIzmer] ([IDEdIzm], [Edzm]) VALUES (1, N'шт.')
SET IDENTITY_INSERT [dbo].[EdIzmer] OFF
GO
SET IDENTITY_INSERT [dbo].[Postavshik] ON 

INSERT [dbo].[Postavshik] ([IDPostavshik], [PostavshikName]) VALUES (1, N'Стройландия')
INSERT [dbo].[Postavshik] ([IDPostavshik], [PostavshikName]) VALUES (2, N'Кромма')
INSERT [dbo].[Postavshik] ([IDPostavshik], [PostavshikName]) VALUES (3, N'ЗолотоеРуно')
INSERT [dbo].[Postavshik] ([IDPostavshik], [PostavshikName]) VALUES (4, N'KRYLOVMANUFACTURA')
SET IDENTITY_INSERT [dbo].[Postavshik] OFF
GO
SET IDENTITY_INSERT [dbo].[Proizvoditeli] ON 

INSERT [dbo].[Proizvoditeli] ([IDProizvoditelia], [NameProizvoditelia]) VALUES (1, N'SVМЕБЕЛЬ')
INSERT [dbo].[Proizvoditeli] ([IDProizvoditelia], [NameProizvoditelia]) VALUES (2, N'Мебелони')
INSERT [dbo].[Proizvoditeli] ([IDProizvoditelia], [NameProizvoditelia]) VALUES (3, N'Инвуд')
INSERT [dbo].[Proizvoditeli] ([IDProizvoditelia], [NameProizvoditelia]) VALUES (4, N'RIDBERG')
INSERT [dbo].[Proizvoditeli] ([IDProizvoditelia], [NameProizvoditelia]) VALUES (5, N'Aero')
INSERT [dbo].[Proizvoditeli] ([IDProizvoditelia], [NameProizvoditelia]) VALUES (6, N'Fizard')
INSERT [dbo].[Proizvoditeli] ([IDProizvoditelia], [NameProizvoditelia]) VALUES (7, N'kari')
SET IDENTITY_INSERT [dbo].[Proizvoditeli] OFF
GO
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (1, 1, 420151, N' ул. Вишневая', 32)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (2, 1, 125061, N' ул. Подгорная', 8)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (3, 1, 630370, N' ул. Шоссейная', 24)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (4, 1, 400562, N' ул. Зеленая', 32)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (5, 1, 614510, N' ул. Маяковского', 47)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (6, 1, 410542, N' ул. Светлая', 46)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (7, 1, 620839, N' ул. Цветочная', 8)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (8, 1, 443890, N' ул. Коммунистическая', 1)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (9, 1, 603379, N' ул. Спортивная', 46)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (10, 1, 603721, N' ул. Гоголя', 41)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (11, 1, 410172, N' ул. Северная', 13)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (12, 1, 614611, N' ул. Молодежная', 50)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (13, 1, 454311, N' ул. Новая', 19)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (14, 1, 660007, N' ул. Октябрьская', 19)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (15, 1, 603036, N' ул. Садовая', 4)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (16, 1, 394060, N' ул. Фрунзе', 43)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (17, 1, 410661, N' ул. Школьная', 50)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (18, 1, 625590, N' ул. Коммунистическая', 20)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (19, 1, 625683, N' ул. 8 Марта', NULL)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (20, 1, 450983, N' ул. Комсомольская', 26)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (21, 1, 394782, N' ул. Чехова', 3)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (22, 1, 603002, N' ул. Дзержинского', 28)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (23, 1, 450558, N' ул. Набережная', 30)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (24, 1, 344288, N' ул. Чехова', 1)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (25, 1, 614164, N'  ул. Степная', 30)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (26, 1, 394242, N' ул. Коммунистическая', 43)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (27, 1, 660540, N' ул. Солнечная', 25)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (28, 1, 125837, N' ул. Шоссейная', 40)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (29, 1, 125703, N' ул. Партизанская', 49)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (30, 1, 625283, N' ул. Победы', 46)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (31, 1, 614753, N' ул. Полевая', 35)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (32, 1, 426030, N' ул. Маяковского', 44)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (33, 1, 450375, N'ул. Клубная', 44)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (34, 1, 625560, N' ул. Некрасова', 12)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (35, 1, 630201, N' ул. Комсомольская', 17)
INSERT [dbo].[PunktVidachi] ([IDPunktVidashi], [IDCity], [AdressIndex], [Street], [StreetNumber]) VALUES (36, 1, 190949, N' ул. Мичурина', 26)
GO
INSERT [dbo].[Role] ([IDRole], [RoleName]) VALUES (1, N'Администратор')
INSERT [dbo].[Role] ([IDRole], [RoleName]) VALUES (2, N'Менеджер')
INSERT [dbo].[Role] ([IDRole], [RoleName]) VALUES (3, N'Авторизированный клиент')
GO
INSERT [dbo].[StatusZakaza] ([IDStatusZakaza], [StatusZakazaName]) VALUES (1, N'Новый')
INSERT [dbo].[StatusZakaza] ([IDStatusZakaza], [StatusZakazaName]) VALUES (2, N'Завершен')
GO
SET IDENTITY_INSERT [dbo].[Tovar] ON 

INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (1, 1, 1, 1, 1, N'А112Т4', N'Прихожая Фаворит 1 1420х2056х352ммм Дуб Делано/Цемент Светлый SV-М 1 шт', 9577.0000, 10, 0, N'Удивительно функциональная и практичная прихожая Фаворит 1, обладая характерными чертами Скандинавского стиля, выглядит эффектно и способна задать тон интерьеру дома, встречая вас и ваших гостей. ', N'1.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (2, 1, 2, 1, 1, N'G843H5', N'Прихожая в коридор Твист с зеркалом мебель со шкафами, 120х37х202 см', 8803.0000, 25, 9, N'Этот стеллаж со шкафом в прихожую комнату станет отличным элементом для вашего интерьера. Мебель для дома обеспечивает удобное хранение перчаток, шапок, зонтов, сумок и других аксессуаров. ', N'2.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (3, 2, 3, 2, 1, N'D325D4', N'Угловой диван Кромма Инвуд Лайт, серый двухместный диван, Velutto 32', 29125.0000, 5, 12, N'Угловой диван Инвуд Лайт 2 - стильный и комфортный диван подойдет для комнаты любого размера.', N'3.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (4, 2, 4, 3, 1, N'S432T5', N'Обувница RIDBERG, с вешалкой, стальная, 170x60x26 см, 5 полок, вместимость до 15 пар', 885.0000, 15, 15, N'Обувница Ridberg с 5 полками и вешалкой - идеальное решение для организации хранения обуви в прихожей или гардеробной. ', N'4.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (5, 3, 3, 2, 1, N'F325D4', N'Диван, Прямой диван, Диван-кровать Сити темно-коричневый. Квест-33', 14322.0000, 18, 3, N'
Прямой диван-кровать Сити - это современное и функциональное решение для вашего дома.', N'5.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (6, 4, 3, 4, 1, N'G432G6', N'Пуф трансформер кровать раскладушка светло-коричневый велюр', 6149.0000, 22, 3, N'Пуф трансформер 5в1 представляет собой уникальное сочетание функций, выступая в качестве пуфика, столика, кресла, шезлонга и дополнительного спального места. ', N'6.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (7, 3, 3, 2, 1, N'H542F5', N'Диван, Прямой диван, диван кровать, Рио симпл механизм Пантограф. Симпл-16', 20708.0000, 4, 5, N'Диван Рио симпл от "Золотое Руно" - это сочетание комфорта, функциональности и стильного дизайна.', N'7.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (8, 4, 4, 5, 1, N'C346F5', N'Полка настенная ромб Лофт, черная, 40 см', 2843.0000, 5, 4, N'Полочки для цветов в стиле лофт. Подойдут как для цветов, так и в качестве декоративного элемента. Полки подойдут для дома, офиса, кафе, ресторана. ?', N'8.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (9, 4, 4, 6, 1, N'F256G6', N'Стулья для кухни', 4760.0000, 6, 2, N'Набор из четырех стульев в лофт-дизайне станет любимой мебелью для отдыха и подойдет для взрослых и детей. ', N'9.jpg')
INSERT [dbo].[Tovar] ([IDTovar], [IDPostavshik], [IDProizvoditelia], [IDTovarCategory], [IDEdIzm], [Article], [TovarName], [Cost], [Discount], [KolvoNaSklade], [Description], [Image]) VALUES (10, 4, 4, 5, 1, N'J532V5', N'Магнитная полка, для холодильника, металл, 3шт, универсальная, чёрная', 1387.0000, 8, 6, N'Магнитная полка для холодильника - это удобный и практичный аксессуар, который поможет организовать пространство в вашем доме.', N'10.jpg')
SET IDENTITY_INSERT [dbo].[Tovar] OFF
GO
SET IDENTITY_INSERT [dbo].[TovarCategory] ON 

INSERT [dbo].[TovarCategory] ([IDTovarCategory], [TovarCategoryName]) VALUES (1, N'Прихожая')
INSERT [dbo].[TovarCategory] ([IDTovarCategory], [TovarCategoryName]) VALUES (2, N'Диван')
INSERT [dbo].[TovarCategory] ([IDTovarCategory], [TovarCategoryName]) VALUES (3, N'Обувница')
INSERT [dbo].[TovarCategory] ([IDTovarCategory], [TovarCategoryName]) VALUES (4, N'Пуф')
INSERT [dbo].[TovarCategory] ([IDTovarCategory], [TovarCategoryName]) VALUES (5, N'Полка')
INSERT [dbo].[TovarCategory] ([IDTovarCategory], [TovarCategoryName]) VALUES (6, N'Стул')
SET IDENTITY_INSERT [dbo].[TovarCategory] OFF
GO
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (1, 1, N'Никифорова', N'Анна', N'Семеновна', N'94d5ous@gmail.com', N'uzWC67')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (2, 1, N'Стелина', N'Евгения', N'Петровна', N'uth4iz@mail.com', N'2L6KZG')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (3, 1, N'Никифорова', N'Весения', N'Николаевна', N'5d4zbu@tutanota.com', N'rwVDh9')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (4, 2, N'Сазонов', N'Руслан', N'Германович', N'ptec8ym@yahoo.com', N'LdNyos')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (5, 2, N'Одинцов', N'Серафим', N'Артёмович', N'1qz4kw@mail.com', N'gynQMT')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (6, 2, N'Старикова', N'Елена', N'Павловна', N'4np6se@mail.com', N'AtnDjr')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (7, 3, N'Степанов', N'Михаил', N'Артёмович', N'yzls62@outlook.com', N'JlFRCZ')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (8, 3, N'Михайлюк', N'Анна', N'Вячеславовна', N'1diph5e@tutanota.com', N'8ntwUp')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (9, 3, N'Ситдикова', N'Елена', N'Анатольевна', N'tjde7c@yahoo.com', N'YOyhfR')
INSERT [dbo].[User] ([IDUser], [IDRole], [Familia], [Imya], [Otchestvo], [Login], [Password]) VALUES (10, 3, N'Ворсин', N'Петр', N'Евгеньевич', N'wpmrc3do@tutanota.com', N'RSbvHv')
GO
SET IDENTITY_INSERT [dbo].[Zakaz] ON 

INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (1, 1, 1, 7, 1, 1, 2, CAST(N'2024-02-27' AS Date), CAST(N'2024-04-20' AS Date), 901)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (2, 2, 1, 7, 1, 1, 2, CAST(N'2024-02-27' AS Date), CAST(N'2024-04-20' AS Date), 901)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (3, 2, 11, 8, 1, 2, 1, CAST(N'2024-09-28' AS Date), CAST(N'2024-04-21' AS Date), 902)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (4, 1, 11, 8, 1, 2, 1, CAST(N'2024-09-28' AS Date), CAST(N'2024-04-21' AS Date), 902)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (5, 3, 2, 9, 1, 3, 10, CAST(N'2024-03-21' AS Date), CAST(N'2024-04-22' AS Date), 903)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (6, 4, 2, 9, 1, 3, 10, CAST(N'2024-03-21' AS Date), CAST(N'2024-04-22' AS Date), 903)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (7, 5, 11, 10, 2, 4, 5, CAST(N'2024-02-20' AS Date), CAST(N'2024-04-23' AS Date), 904)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (8, 3, 11, 10, 2, 4, 4, CAST(N'2024-02-20' AS Date), CAST(N'2024-04-23' AS Date), 904)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (9, 6, 2, 7, 2, 5, 20, CAST(N'2024-03-17' AS Date), CAST(N'2024-04-24' AS Date), 905)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (10, 7, 2, 7, 2, 5, 20, CAST(N'2024-03-17' AS Date), CAST(N'2024-04-24' AS Date), 905)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (11, 1, 15, 8, 2, 6, 2, CAST(N'2024-03-01' AS Date), CAST(N'2024-04-25' AS Date), 906)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (12, 2, 15, 8, 2, 6, 2, CAST(N'2024-03-01' AS Date), CAST(N'2024-04-25' AS Date), 906)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (13, 2, 3, 9, 2, 7, 1, CAST(N'2024-02-28' AS Date), CAST(N'2024-04-26' AS Date), 907)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (14, 1, 3, 9, 2, 7, 1, CAST(N'2024-02-28' AS Date), CAST(N'2024-04-26' AS Date), 907)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (15, 3, 19, 10, 1, 8, 10, CAST(N'2024-03-31' AS Date), CAST(N'2024-04-27' AS Date), 908)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (16, 4, 19, 10, 1, 8, 10, CAST(N'2024-03-31' AS Date), CAST(N'2024-04-27' AS Date), 908)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (17, 5, 5, 7, 1, 9, 5, CAST(N'2024-04-02' AS Date), CAST(N'2024-04-28' AS Date), 909)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (18, 3, 5, 7, 1, 9, 4, CAST(N'2024-04-02' AS Date), CAST(N'2024-04-28' AS Date), 909)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (19, 6, 19, 8, 1, 10, 20, CAST(N'2024-04-03' AS Date), CAST(N'2024-04-29' AS Date), 910)
INSERT [dbo].[Zakaz] ([IDZakaza], [IDTovar], [IDPunktVidashi], [IDUser], [IDStatusZakaza], [NomerZakaza], [Kolvo], [DateZakaza], [DateDelivery], [CodePolushenia]) VALUES (20, 7, 19, 8, 1, 10, 20, CAST(N'2024-04-03' AS Date), CAST(N'2024-04-29' AS Date), 910)
SET IDENTITY_INSERT [dbo].[Zakaz] OFF
GO
ALTER TABLE [dbo].[PunktVidachi]  WITH CHECK ADD  CONSTRAINT [FK_PunktVidachi_City] FOREIGN KEY([IDCity])
REFERENCES [dbo].[City] ([IDCity])
GO
ALTER TABLE [dbo].[PunktVidachi] CHECK CONSTRAINT [FK_PunktVidachi_City]
GO
ALTER TABLE [dbo].[Tovar]  WITH CHECK ADD  CONSTRAINT [FK_Tovar_EdIzmer] FOREIGN KEY([IDEdIzm])
REFERENCES [dbo].[EdIzmer] ([IDEdIzm])
GO
ALTER TABLE [dbo].[Tovar] CHECK CONSTRAINT [FK_Tovar_EdIzmer]
GO
ALTER TABLE [dbo].[Tovar]  WITH CHECK ADD  CONSTRAINT [FK_Tovar_Postavshik] FOREIGN KEY([IDPostavshik])
REFERENCES [dbo].[Postavshik] ([IDPostavshik])
GO
ALTER TABLE [dbo].[Tovar] CHECK CONSTRAINT [FK_Tovar_Postavshik]
GO
ALTER TABLE [dbo].[Tovar]  WITH CHECK ADD  CONSTRAINT [FK_Tovar_Proizvoditeli] FOREIGN KEY([IDProizvoditelia])
REFERENCES [dbo].[Proizvoditeli] ([IDProizvoditelia])
GO
ALTER TABLE [dbo].[Tovar] CHECK CONSTRAINT [FK_Tovar_Proizvoditeli]
GO
ALTER TABLE [dbo].[Tovar]  WITH CHECK ADD  CONSTRAINT [FK_Tovar_TovarCategory] FOREIGN KEY([IDTovarCategory])
REFERENCES [dbo].[TovarCategory] ([IDTovarCategory])
GO
ALTER TABLE [dbo].[Tovar] CHECK CONSTRAINT [FK_Tovar_TovarCategory]
GO
ALTER TABLE [dbo].[User]  WITH CHECK ADD  CONSTRAINT [FK_User_Role] FOREIGN KEY([IDRole])
REFERENCES [dbo].[Role] ([IDRole])
GO
ALTER TABLE [dbo].[User] CHECK CONSTRAINT [FK_User_Role]
GO
ALTER TABLE [dbo].[Zakaz]  WITH CHECK ADD  CONSTRAINT [FK_Zakaz_PunktVidachi] FOREIGN KEY([IDPunktVidashi])
REFERENCES [dbo].[PunktVidachi] ([IDPunktVidashi])
GO
ALTER TABLE [dbo].[Zakaz] CHECK CONSTRAINT [FK_Zakaz_PunktVidachi]
GO
ALTER TABLE [dbo].[Zakaz]  WITH CHECK ADD  CONSTRAINT [FK_Zakaz_StatusZakaza] FOREIGN KEY([IDStatusZakaza])
REFERENCES [dbo].[StatusZakaza] ([IDStatusZakaza])
GO
ALTER TABLE [dbo].[Zakaz] CHECK CONSTRAINT [FK_Zakaz_StatusZakaza]
GO
ALTER TABLE [dbo].[Zakaz]  WITH CHECK ADD  CONSTRAINT [FK_Zakaz_Tovar] FOREIGN KEY([IDTovar])
REFERENCES [dbo].[Tovar] ([IDTovar])
GO
ALTER TABLE [dbo].[Zakaz] CHECK CONSTRAINT [FK_Zakaz_Tovar]
GO
ALTER TABLE [dbo].[Zakaz]  WITH CHECK ADD  CONSTRAINT [FK_Zakaz_User] FOREIGN KEY([IDUser])
REFERENCES [dbo].[User] ([IDUser])
GO
ALTER TABLE [dbo].[Zakaz] CHECK CONSTRAINT [FK_Zakaz_User]
GO
USE [master]
GO
ALTER DATABASE [SokolovExamen] SET  READ_WRITE 
GO
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5 120 6/23/2026
1.0.3 110 6/19/2026
1.0.2 109 6/18/2026
1.0.1 110 6/18/2026
1.0.0 123 6/18/2026