Иван Прытов há 7 meses atrás
pai
commit
b08a2e8234

+ 2 - 2
PPPISI52/App.config

@@ -8,8 +8,8 @@
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
   </startup>
   <connectionStrings>
-    <add name="PP_PISIEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=ngknn.ru;initial catalog=PP_PISI;user id=43П;password=444444;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
-  </connectionStrings>
+   
+  <add name="PP_PISIEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=ngknn.ru;initial catalog=PP_PISI;user id=43П;password=444444;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>
   <entityFramework>
     <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
       <parameters>

+ 2 - 2
PPPISI52/App.xaml

@@ -14,14 +14,14 @@
         <!--Кнопка-->
         <Style TargetType="Button">
             <Style.Setters>
-                <Setter Property="Background" Value="#76e383"/>
+                <Setter Property="Background" Value="HotPink"/>
                 <Setter Property="FontSize" Value="14"/>
                 <Setter Property="Foreground" Value="White"/>
             </Style.Setters>
             <Style.Triggers>
                 <Trigger Property="IsMouseOver" Value="True">
                     <Setter Property="Foreground" Value="White"/>
-                    <Setter Property="Background" Value="#498c51"/>
+                    <Setter Property="Background" Value="HotPink"/>
                 </Trigger>
             </Style.Triggers>
         </Style>

+ 2 - 2
PPPISI52/Model1.edmx.diagram

@@ -4,7 +4,7 @@
   <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
     <!-- Diagram content (shape and connector positions) -->
     <edmx:Diagrams>
-      <Diagram DiagramId="b823d80a0d194ce3b12a1f1a293dc176" Name="Diagram1">
+      <Diagram DiagramId="cacb1e5646d5497f8e1e501442d15d40" Name="Diagram1">
         <EntityTypeShape EntityType="PP_PISIModel.Manufacturer" Width="1.5" PointX="0.75" PointY="3.625" IsExpanded="true" />
         <EntityTypeShape EntityType="PP_PISIModel.Order" Width="1.5" PointX="3" PointY="11.375" IsExpanded="true" />
         <EntityTypeShape EntityType="PP_PISIModel.OrderProduct" Width="1.5" PointX="5.25" PointY="3.25" IsExpanded="true" />
@@ -14,7 +14,7 @@
         <EntityTypeShape EntityType="PP_PISIModel.Provider" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
         <EntityTypeShape EntityType="PP_PISIModel.Role" Width="1.5" PointX="1.5" PointY="17.5" IsExpanded="true" />
         <EntityTypeShape EntityType="PP_PISIModel.StatusOrder" Width="1.5" PointX="0.75" PointY="11.625" IsExpanded="true" />
-        <EntityTypeShape EntityType="PP_PISIModel.User" Width="1.5" PointX="0.75" PointY="14" IsExpanded="true" />
+        <EntityTypeShape EntityType="PP_PISIModel.User" Width="1.5" PointX="0.75" PointY="14.125" IsExpanded="true" />
         <AssociationConnector Association="PP_PISIModel.FK__Product__Product__4D94879B" ManuallyRouted="false" />
         <AssociationConnector Association="PP_PISIModel.FK__Order__OrderPick__48CFD27E" ManuallyRouted="false" />
         <AssociationConnector Association="PP_PISIModel.FK__Order__OrderStat__49C3F6B7" ManuallyRouted="false" />

+ 7 - 11
PPPISI52/PPPISI52.csproj

@@ -116,9 +116,6 @@
     <Compile Include="Windows\AutorisationWindow.xaml.cs">
       <DependentUpon>AutorisationWindow.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Windows\OrdersWindow.xaml.cs">
-      <DependentUpon>OrdersWindow.xaml</DependentUpon>
-    </Compile>
     <Compile Include="Windows\UsialWindow.xaml.cs">
       <DependentUpon>UsialWindow.xaml</DependentUpon>
     </Compile>
@@ -146,10 +143,6 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
-    <Page Include="Windows\OrdersWindow.xaml">
-      <SubType>Designer</SubType>
-      <Generator>MSBuild:Compile</Generator>
-    </Page>
     <Page Include="Windows\UsialWindow.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -192,20 +185,23 @@
   <ItemGroup>
     <None Include="App.config" />
   </ItemGroup>
+  <ItemGroup>
+    <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
+  </ItemGroup>
   <ItemGroup>
     <Content Include="Model1.Context.tt">
       <Generator>TextTemplatingFileGenerator</Generator>
-      <LastGenOutput>Model1.Context.cs</LastGenOutput>
       <DependentUpon>Model1.edmx</DependentUpon>
+      <LastGenOutput>Model1.Context.cs</LastGenOutput>
     </Content>
     <Content Include="Model1.tt">
       <Generator>TextTemplatingFileGenerator</Generator>
       <DependentUpon>Model1.edmx</DependentUpon>
       <LastGenOutput>Model1.cs</LastGenOutput>
     </Content>
-  </ItemGroup>
-  <ItemGroup>
-    <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
+    <Resource Include="Photos\A346R4.jpg" />
+    <Resource Include="Photos\B730E2.jpg" />
+    <Resource Include="Photos\picture.png" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 25 - 26
PPPISI52/Pages/MainUserPage.xaml

@@ -15,39 +15,38 @@
     <Grid>
         <DockPanel>
             <StackPanel DockPanel.Dock="Top">
-                <TextBlock x:Name="TBUser" HorizontalAlignment="Right" Margin="0,20,50,0" Foreground="#498c51"/>
-                <TextBlock x:Name="TBItems" HorizontalAlignment="Right" Margin="0,10,50,0" Foreground="#498c51"/>
-                <Button x:Name="BOrders" Content="Корзина" Height="25" Width="150" HorizontalAlignment="Left" Margin="30,0,0,5" Click="ShowOrders_Click"/>
+   
+                <TextBlock x:Name="TBItems" HorizontalAlignment="Right" Margin="0,10,50,0" Foreground="HotPink"/>
+                
                 <Button x:Name="BAddProduct" Content="Добавить товар" Height="25" Width="150" HorizontalAlignment="Left" Margin="30,0,0,20" Click="AddNewProduct_Click" Visibility="Collapsed"/>
                 <TextBox x:Name="TBSearch" Width="500" Height="20" TextChanged="Search_TextChanged"/>
                 <StackPanel Orientation="Horizontal" Margin="10" HorizontalAlignment="Center">
-                    <TextBlock Text="Сортировка по ценовому диапозону:"/>
-                    <ComboBox x:Name="CBDiscount" Width="200" Margin="20,0,0,0" SelectionChanged="ComboBox_SelectionChanged"/>
+                    <TextBlock Text="Сортировка по отделу:"/>
+                    <ComboBox Name="CBDiscount" Width="200" Margin="20,0,0,0" SelectionChanged="ComboBox_SelectionChanged"/>
                 </StackPanel>
-                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
-                    <RadioButton x:Name="RBUsial" Checked="RadioButton_Checked" Content="Без сортировки"/>
-                    <RadioButton x:Name="RBUP" Checked="RadioButton_Checked" Content="По возрастанию" Margin="20,0,0,0"/>
-                    <RadioButton x:Name="RBDown" Checked="RadioButton_Checked" Content="По убыванию" Margin="20,0,0,0"/>
-                </StackPanel>
-                <RadioButton x:Name="RBDrop" Checked="RadioButton_Checked" Content="Сбросить сортировку" HorizontalAlignment="Center" Margin="10"/>
-            </StackPanel>
-            <DockPanel  DockPanel.Dock="Top" Margin="10">
-                <ListView x:Name="LVProducts">
-                    <ListView.ItemTemplate>
-                        <DataTemplate>
-                            <Border BorderBrush="Black" BorderThickness="2" Width="700" Height="170" Uid="{Binding ProductArticleNumber}" Loaded="Border_Loaded">
+                
+                
+            </StackPanel >
+            <DockPanel HorizontalAlignment="Center"  DockPanel.Dock="Top" Margin="10">
+                <ListView Name="LVProducts"  >
+                    <ListView.ItemTemplate  >
+                        <DataTemplate >
+                            <Border  BorderBrush="HotPink" BorderThickness="2" Width="700" Height="170">
                                 <StackPanel Orientation="Horizontal" Width="700" Height="170">
                                     <Image Source="{Binding ProductPhoto, TargetNullValue={StaticResource defaultImage}}" Height="70" RenderOptions.BitmapScalingMode="HighQuality" Margin="15" VerticalAlignment="Center"/>
                                     <StackPanel Orientation="Vertical">
-                                        <TextBlock FontWeight="Bold" Text="{Binding ProductName}" Margin="3"/>
-                                        <TextBlock Text="{Binding ProductDescription}" TextWrapping="Wrap" Margin="3"/>
-                                        <TextBlock Text="{Binding Manufacturer.Manufacturer1, StringFormat=Производитель: {0}}" Margin="3"/>
-                                        <StackPanel Orientation="Horizontal">
-                                            <TextBlock Text="Цена: " Margin="3"/>
-                                            <TextBlock Uid="{Binding ProductArticleNumber}" Loaded="ProductCost_Loaded" Margin="3"/>
-                                            <TextBlock Uid="{Binding ProductArticleNumber}" Loaded="ProductCost2_Loaded" Margin="3"/>
-                                        </StackPanel>
-                                        <TextBlock Uid="{Binding ProductArticleNumber}" Loaded="ProductCost3_Loaded" Margin="3"/>
+
+                                        
+                                        <TextBlock Text="{Binding ProductName, StringFormat=Название: {0}}" Margin="3"/>
+                                        <TextBlock Text="{Binding ProductDescription, StringFormat=Цвет: {0}}" Margin="3"/>
+                                        <TextBlock Text="{Binding ProductArticleNumber, StringFormat=Артикул: {0}}" Margin="3"/>
+                                        <TextBlock Text="{Binding ProductCategory1.CategoryTitle, StringFormat=Отдел: {0}}" Margin="3"/>
+                                        
+                                        <TextBlock Text="{Binding OrderProductOrderUserRole.RoleName, StringFormat=Производитель: {0}}" Margin="3"/>
+                                        
+                                        
+                                      
+                                        <TextBlock Uid="{Binding ProductArticleNumber}" />
                                     </StackPanel>
                                 </StackPanel>
                             </Border>

+ 53 - 69
PPPISI52/Pages/MainUserPage.xaml.cs

@@ -1,6 +1,7 @@
 using PPPISI52.Windows;
 using System;
 using System.Collections.Generic;
+using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -25,7 +26,8 @@ namespace PPPISI52.Pages
         User current_user;
         int all_items;
         int showed_items;
-        List<string> discount_d = new List<string>() { "Все диапозоны", "0-9,99%", "10-14,99%", "15% и более" };
+
+
         public MainUserPage()
         {
             InitializeComponent();
@@ -35,74 +37,69 @@ namespace PPPISI52.Pages
         public MainUserPage(User user)
         {
             InitializeComponent();
+            PP_PISIEntities DB = new PP_PISIEntities();
+            LVProducts.ItemsSource = DB.Product.ToList();
+
             current_user = user;
             DefaultData();
-            TBUser.Text = user.UserName + " " + user.UserSurname + user.UserPatronymic;
+            
             List<Order> orders = Base.MyBase.Order.Where(x => x.UserID == user.UserID).ToList();
             if (orders.Count > 0)
             {
-                BOrders.Visibility = Visibility.Visible;
+                BAddProduct.Visibility = Visibility.Visible;
             }
-            if (current_user.UserRole == 2)
+            
+            List<ProductCategory> rl = DB.ProductCategory.ToList();
+            CBDiscount.Items.Add("Все отделы");
+            foreach (ProductCategory i in rl)
             {
-                BAddProduct.Visibility = Visibility.Visible;
+                CBDiscount.Items.Add(i.CategoryTitle);
+            }
+            CBDiscount.SelectedIndex = 0;
+
+        }
+
+        public void Filter()
+        {
+            PP_PISIEntities DB = new PP_PISIEntities();
+            List<Product> prFilter = new List<Product>();
+            List<ProductCategory> rl = DB.ProductCategory.ToList();
+            if (CBDiscount.SelectedIndex != 0)
+            {
+                List<ProductCategory> aut = DB.ProductCategory.ToList();
+                int index = Convert.ToInt32(aut.Where(x => x.CategoryID == CBDiscount.SelectedIndex).Select(x => x.CategoryID).FirstOrDefault());
+                prFilter = DB.Product.Where(x => x.ProductCategory == index).ToList();
+            }
+            else
+            {
+                prFilter = DB.Product.ToList();
             }
+
+
+            LVProducts.ItemsSource = prFilter;
         }
 
         private void DefaultData()
         {
             products = Base.MyBase.Product.ToList();
             LVProducts.ItemsSource = products;
-            CBDiscount.ItemsSource = discount_d;
+
             CBDiscount.SelectedIndex = 0;
-            RBUsial.IsChecked = true;
+            
             all_items = products.Count;
             showed_items = products.Count;
             TBItems.Text = showed_items + "/" + all_items;
-            BOrders.Visibility = Visibility.Collapsed;
+            
             TBSearch.Text = "";
         }
 
-        private void Border_Loaded(object sender, RoutedEventArgs e)
-        {
-            Border border = (Border)sender;
-            Product product = Base.MyBase.Product.FirstOrDefault(x => x.ProductArticleNumber == border.Uid);
-            if (product.ProductDiscountAmount > 15)
-            {
-                border.BorderBrush = (Brush)(new BrushConverter().ConvertFrom("#7fff00"));
-            }
-        }
+     
 
-        private void ProductCost_Loaded(object sender, RoutedEventArgs e)
-        {
-            TextBlock textBlock = (TextBlock)sender;
-            Product product = Base.MyBase.Product.FirstOrDefault(x => x.ProductArticleNumber == textBlock.Uid);
-            textBlock.Text = product.ProductCost.ToString().Substring(0, product.ProductCost.ToString().Length - 2);
-            if (product.ProductDiscountAmount > 0)
-            {
-                textBlock.TextDecorations = TextDecorations.Strikethrough;
-            }
-        }
+       
 
-        private void ProductCost2_Loaded(object sender, RoutedEventArgs e)
-        {
-            TextBlock textBlock = (TextBlock)sender;
-            Product product = Base.MyBase.Product.FirstOrDefault(x => x.ProductArticleNumber == textBlock.Uid);
-            if (product.ProductDiscountAmount > 0)
-            {
-                textBlock.Text = (product.ProductCost - product.ProductCost * product.ProductDiscountAmount / 100).ToString().Substring(0, (product.ProductCost - product.ProductCost * product.ProductDiscountAmount / 100).ToString().Length - 2);
-            }
-        }
+       
 
-        private void ProductCost3_Loaded(object sender, RoutedEventArgs e)
-        {
-            TextBlock textBlock = (TextBlock)sender;
-            Product product = Base.MyBase.Product.FirstOrDefault(x => x.ProductArticleNumber == textBlock.Uid);
-            if (product.ProductDiscountAmount > 0)
-            {
-                textBlock.Text = "Скидка: " + product.ProductDiscountAmount.ToString() + "%";
-            }
-        }
+        
 
         private void Sort()
         {
@@ -121,24 +118,9 @@ namespace PPPISI52.Pages
                 default: break;
             }
 
-            if (RBUP.IsChecked == true)
-            {
-                products = products.OrderBy(x => x.ProductCost).ToList();
-            }
-            if (RBDown.IsChecked == true)
-            {
-                products = products.OrderBy(x => x.ProductCost).ToList();
-                products.Reverse();
-            }
+           
 
-            if (RBDrop.IsChecked == true)
-            {
-                RBDrop.IsChecked = false;
-                RBUsial.IsChecked = true;
-                TBSearch.Text = string.Empty;
-                CBDiscount.SelectedIndex = 0;
-                products = Base.MyBase.Product.ToList();
-            }
+           
 
             showed_items = products.Count();
             TBItems.Text = showed_items + "/" + all_items;
@@ -146,6 +128,8 @@ namespace PPPISI52.Pages
             LVProducts.ItemsSource = products;
         }
 
+        
+
         private void Search_TextChanged(object sender, TextChangedEventArgs e)
         {
             Sort();
@@ -160,13 +144,13 @@ namespace PPPISI52.Pages
         {
             Sort();
         }
-
-        private void ShowOrders_Click(object sender, RoutedEventArgs e)
+        private void CBFilterBreed_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
-            OrdersWindow ordersWindow = new OrdersWindow(current_user);
-            ordersWindow.ShowDialog();
+            Filter();
         }
 
+
+
         private void ContextMenu_Loaded(object sender, RoutedEventArgs e)
         {
             ContextMenu cm = (ContextMenu)sender;
@@ -176,13 +160,13 @@ namespace PPPISI52.Pages
         private void EditProduct_Loaded(object sender, RoutedEventArgs e)
         {
             MenuItem menuItem = (MenuItem)sender;
-            if (current_user == null || current_user.UserRole != 2) menuItem.Visibility = Visibility.Collapsed;
+            if (current_user == null );
         }
 
         private void DeleteProduct_Loaded(object sender, RoutedEventArgs e)
         {
             MenuItem menuItem = (MenuItem)sender;
-            if (current_user == null || current_user.UserRole != 2) menuItem.Visibility = Visibility.Collapsed;
+            if (current_user == null );
         }
 
         private void EditProduct_Click(object sender, RoutedEventArgs e)
@@ -243,7 +227,7 @@ namespace PPPISI52.Pages
                     op.ProductCount = 1;
                     Base.MyBase.OrderProduct.Add(op);
                     Base.MyBase.SaveChanges();
-                    BOrders.Visibility = Visibility.Visible;
+                    
                 }
             }
             catch { }

BIN
PPPISI52/Photos/A346R4.jpg


BIN
PPPISI52/Photos/B730E2.jpg


BIN
PPPISI52/Photos/D419T7.jpg


BIN
PPPISI52/Photos/picture.png


+ 2 - 11
PPPISI52/Windows/AddChangeProductWindow.xaml

@@ -37,18 +37,9 @@
                 <TextBlock Text="Поставщик: " Margin="10,0,0,0"/>
                 <ComboBox x:Name="CBProductProvider" Width="242" Margin="10,0,0,0" SelectionChanged="CBProductProvider_Changed"/>
             </StackPanel>
+            
             <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
-                <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
-                    <TextBlock Text="Цена: " Margin="10,0,0,0"/>
-                    <TextBox x:Name="TBProductCost" Width="100" Margin="10,0,0,0"/>
-                </StackPanel>
-                <StackPanel Orientation="Horizontal" Margin="30,10,0,0">
-                    <TextBlock Text="Скидка (%): " Margin="10,0,0,0"/>
-                    <TextBox x:Name="TBProductDiscountAmount" Width="100" Margin="10,0,0,0"/>
-                </StackPanel>
-            </StackPanel>
-            <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
-                <TextBlock Text="Количество на складе: " Margin="10,0,0,0"/>
+                <TextBlock Text="Количество отправленных: " Margin="10,0,0,0"/>
                 <TextBox x:Name="TBProductInStock" Width="100" Margin="10,0,0,0"/>
             </StackPanel>
 

+ 7 - 15
PPPISI52/Windows/AddChangeProductWindow.xaml.cs

@@ -61,8 +61,7 @@ namespace PPPISI52.Windows
                 CBProductCategory.SelectedIndex = categories.IndexOf(Base.MyBase.ProductCategory.FirstOrDefault(x => x.CategoryID == new_product.ProductCategory).CategoryTitle);
                 CBProductManufacturer.SelectedIndex = manufacturers.IndexOf(Base.MyBase.Manufacturer.FirstOrDefault(x => x.ManufacturerID == new_product.ProductManufacturer).Manufacturer1);
                 CBProductProvider.SelectedIndex = providers.IndexOf(Base.MyBase.Provider.FirstOrDefault(x => x.ProviderID == new_product.ProductProvider).Provider1);
-                TBProductCost.Text = new_product.ProductCost.ToString();
-                TBProductDiscountAmount.Text = new_product.ProductDiscountAmount.ToString();
+                
                 TBProductInStock.Text = new_product.ProductQuantityInStock.ToString();
             }
         }
@@ -89,19 +88,15 @@ namespace PPPISI52.Windows
                 MessageBox.Show("Товар с таким артикулом уже существует!", "Невозможно внести изменения");
                 return false;
             }
-            if ((TBProductName.Text.Length <= 0) || (TBProductDescription.Text.Length <= 0) || (CBProductCategory.SelectedIndex < 0) || (CBProductManufacturer.SelectedIndex < 0) || (CBProductProvider.SelectedIndex < 0) || (TBProductCost.Text.Length <= 0))
+            if ((TBProductName.Text.Length <= 0) || (TBProductDescription.Text.Length <= 0) || (CBProductCategory.SelectedIndex < 0) || (CBProductManufacturer.SelectedIndex < 0) || (CBProductProvider.SelectedIndex < 0))
             {
                 MessageBox.Show("Все поля, кроме скидки и количества на складе должны быть заполнены!", "Невозможно внести изменения");
                 return false;
             }
-            if ((Convert.ToInt32(TBProductCost.Text) <= 0))
-            {
-                MessageBox.Show("Цена, размер скидки и количества на складе не могут быть отрицательны!", "Невозможно внести изменения");
-                return false;
-            }
+          
             try
             {
-                if ((Convert.ToInt32(TBProductInStock.Text) < 0) || (Convert.ToDouble(TBProductDiscountAmount.Text) < 0))
+                if ((Convert.ToInt32(TBProductInStock.Text) < 0))
                 {
                     MessageBox.Show("Цена, размер скидки и количества на складе не могут быть отрицательны!", "Невозможно внести изменения");
                     return false;
@@ -120,12 +115,9 @@ namespace PPPISI52.Windows
             {
                 new_product.ProductPhoto = "";
             }
-            new_product.ProductCost = Convert.ToDecimal(TBProductCost.Text);
-            try
-            {
-                new_product.ProductDiscountAmount = Convert.ToByte(TBProductDiscountAmount.Text);
-            }
-            catch { }
+            
+        
+            
             try
             {
                 new_product.ProductQuantityInStock = Convert.ToInt32(TBProductInStock.Text);

+ 2 - 2
PPPISI52/Windows/AutorisationWindow.xaml

@@ -10,13 +10,13 @@
         <Frame Name="frame" Grid.Row="1" NavigationUIVisibility="Hidden">
         </Frame>
         <StackPanel x:Name="SPMain">
-            <TextBlock Text="АВТОРИЗАЦИЯ" Foreground="#498c51" FontWeight="Bold" HorizontalAlignment="Center" Margin="10"/>
+            <TextBlock Text="АВТОРИЗАЦИЯ" Foreground="HotPink" FontWeight="Bold" HorizontalAlignment="Center" Margin="10"/>
             <TextBlock Text="Логин" HorizontalAlignment="Center" Margin="0,0,0,5"/>
             <TextBox x:Name="TBLogin" Width="200" Margin="10,0,0,0" HorizontalAlignment="Center"/>
             <TextBlock Text="Пароль" HorizontalAlignment="Center" Margin="0,0,0,5"/>
             <PasswordBox x:Name="TBPassword" PasswordChar="*" Width="200" Margin="10,0,0,0" HorizontalAlignment="Center"/>
             <Button Click="Autorisation_Click" Content="ВОЙТИ" Width="200" HorizontalAlignment="Center" Margin="0,20,0,0"/>
-            <Button Click="WithoutAutorisation_Click" Content="Просмотр без авторизации" Width="200" HorizontalAlignment="Center" Margin="0,20,0,0"/>
+            
         </StackPanel>
 
     </Grid>

+ 0 - 54
PPPISI52/Windows/OrdersWindow.xaml

@@ -1,54 +0,0 @@
-<Window x:Class="PPPISI52.Windows.OrdersWindow"
-        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:PPPISI52.Windows"
-        mc:Ignorable="d"
-        Title="OrdersWindow" Height="450" Width="800">
-    <Window.Resources>
-        <BitmapImage x:Key="defaultImage" UriSource="/Photos/picture.png"/>
-    </Window.Resources>
-    <Grid>
-        <DockPanel>
-            <Button Content="Назад" Click="Back_Click" Width="100" Height="25" HorizontalAlignment="Left" Margin="10" DockPanel.Dock="Top"/>
-            <TextBlock x:Name="TBNameUser" Margin="10,0,0,0" DockPanel.Dock="Top"/>
-            <StackPanel HorizontalAlignment="Center" x:Name="SPForAdminOrManager" DockPanel.Dock="Top">
-                <RadioButton x:Name="RBDrop" Checked="RadioButton_Checked" Content="Сброс сортировки" HorizontalAlignment="Center"/>
-                <StackPanel Orientation="Horizontal" Margin="10" HorizontalAlignment="Center">
-                    <TextBlock Text="Сортировка по ценовому диапозону:"/>
-                    <ComboBox x:Name="CBDiscount" Width="200" Margin="20,0,0,0" SelectionChanged="ComboBox_SelectionChanged"/>
-                </StackPanel>
-                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
-                    <RadioButton x:Name="RBUsial" Checked="RadioButton_Checked" Content="Без сортировки"/>
-                    <RadioButton x:Name="RBUP" Checked="RadioButton_Checked" Content="По возрастанию" Margin="20,0,0,0"/>
-                    <RadioButton x:Name="RBDown" Checked="RadioButton_Checked" Content="По убыванию" Margin="20,0,0,0"/>
-                </StackPanel>
-                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
-                    <RadioButton x:Name="RBNew" Content="Новые" Checked="RadioButton_Checked" Margin="0,5,0,0"/>
-                    <RadioButton x:Name="RBFinished" Content="Завершенные" Checked="RadioButton_Checked" Margin="20,5,0,0"/>
-                </StackPanel>
-            </StackPanel>
-            <DockPanel  DockPanel.Dock="Top" Margin="10">
-                <ListView x:Name="LVOrders">
-                    <ListView.ItemTemplate>
-                        <DataTemplate>
-                            <Border BorderBrush="Black" BorderThickness="2" Width="700" Height="300">
-                                <StackPanel Orientation="Vertical">
-                                    <TextBlock Text="{Binding OrderID, StringFormat=Номер заказа: {0}}" Margin="5"/>
-                                    <TextBlock Text="{Binding OrderDate, StringFormat=Дата заказа: {0}}" Margin="5"/>
-                                    <TextBlock Text="{Binding OrderDeliveryDate, StringFormat=Дата доставки: {0}}" Margin="5"/>
-                                    <TextBlock Text="{Binding PickUpPoint.PointName, StringFormat=Адрес: {0}}" Margin="5"/>
-                                    <TextBlock Text="{Binding Code, StringFormat=Код: {0}}" Margin="5"/>
-                                    <TextBlock Uid="{Binding OrderID}" Loaded="Products_Loaded" Margin="5"/>
-                                    <TextBlock Uid="{Binding OrderID}" Loaded="Summ_Loaded" Margin="5" Height="60"/>
-                                    <TextBlock Uid="{Binding UserID}" Loaded="UserName_Loaded" Margin="5"/>
-                                </StackPanel>
-                            </Border>
-                        </DataTemplate>
-                    </ListView.ItemTemplate>
-                </ListView>
-            </DockPanel>
-        </DockPanel>
-    </Grid>
-</Window>

+ 0 - 142
PPPISI52/Windows/OrdersWindow.xaml.cs

@@ -1,142 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-using static System.Net.Mime.MediaTypeNames;
-
-namespace PPPISI52.Windows
-{
-    /// <summary>
-    /// Логика взаимодействия для OrdersWindow.xaml
-    /// </summary>
-    public partial class OrdersWindow : Window
-    {
-        User current_user;
-        List<Order> orders = new List<Order>();
-        List<string> discount_d = new List<string>() { "Все диапозоны (не робит)", "0-9,99%", "10-14,99%", "15% и более" };
-        public OrdersWindow(User user)
-        {
-            InitializeComponent();
-            current_user = user;
-            if (current_user.UserRole == 1)
-            {
-                orders = Base.MyBase.Order.Where(x => x.UserID == current_user.UserID).ToList();
-                TBNameUser.Text = "Заказы пользователя: " + user.UserName + " " + user.UserSurname;
-                SPForAdminOrManager.Visibility = Visibility.Collapsed;
-            }
-            else
-            {
-                orders = Base.MyBase.Order.ToList();
-                CBDiscount.ItemsSource = discount_d;
-                CBDiscount.SelectedIndex = 0;
-                RBUsial.IsChecked = true;
-            }
-            LVOrders.ItemsSource = orders;
-        }
-
-        private void Sort()
-        {
-            orders = Base.MyBase.Order.ToList();
-
-            if (RBNew.IsChecked == true)
-            {
-                orders = orders.Where(x => x.OrderStatus == 2).ToList();
-            }
-            if (RBFinished.IsChecked == true)
-            {
-                orders = orders.Where(x => x.OrderStatus == 1).ToList();
-            }
-            if (RBDrop.IsChecked == true)
-            {
-                RBDrop.IsChecked = false;
-                RBFinished.IsChecked = false;
-                RBFinished.IsChecked = false;
-                RBUsial.IsChecked = true;
-                CBDiscount.SelectedIndex = 0;
-            }
-            LVOrders.ItemsSource = orders;
-        }
-
-        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-            Sort();
-        }
-
-        private void RadioButton_Checked(object sender, RoutedEventArgs e)
-        {
-            Sort();
-        }
-
-        private void Back_Click(object sender, RoutedEventArgs e)
-        {
-            this.Close();
-        }
-
-        private void Products_Loaded(object sender, RoutedEventArgs e)
-        {
-            TextBlock textBlock = (TextBlock)sender;
-            List<OrderProduct> op = Base.MyBase.OrderProduct.Where(x => x.OrderID.ToString() == textBlock.Uid).ToList();
-            List<Product> products = new List<Product>();
-            string text = "Товары: ";
-            foreach (OrderProduct a in op)
-            {
-                Product b = Base.MyBase.Product.FirstOrDefault(x => x.ProductArticleNumber == a.ProductArticleNumber);
-                text += b.ProductName + " (" + b.ProductArticleNumber + ") " + a.ProductCount + " шт., ";
-            }
-            text = text.Substring(0, text.Length - 2);
-            textBlock.TextWrapping = TextWrapping.Wrap;
-            textBlock.Text = text;
-        }
-
-        private void Summ_Loaded(object sender, RoutedEventArgs e)
-        {
-            TextBlock textBlock = (TextBlock)sender;
-            List<OrderProduct> op = Base.MyBase.OrderProduct.Where(x => x.OrderID.ToString() == textBlock.Uid).ToList();
-            string text = "";
-            double all_cost = 0;
-            double cost = 0;
-            double discount = 0;
-            foreach (OrderProduct a in op)
-            {
-                Product b = Base.MyBase.Product.FirstOrDefault(x => x.ProductArticleNumber == a.ProductArticleNumber);
-                all_cost += Convert.ToDouble(b.ProductCost * a.ProductCount);
-                discount += Convert.ToDouble(b.ProductCost * b.ProductDiscountAmount / 100);
-                cost += Convert.ToDouble((b.ProductCost - b.ProductCost * b.ProductDiscountAmount / 100) * a.ProductCount);
-            }
-            if (discount == 0)
-            {
-                text = "Итого: " + all_cost.ToString() + " рублей";
-            }
-            else
-            {
-                text = "Общая сумма: " + all_cost.ToString() + " рублей\n" + "Скидка: " + discount.ToString() + " рублей\n" + "Итого: " + cost.ToString() + " рублей";
-            }
-
-            textBlock.Text = text;
-        }
-
-        private void UserName_Loaded(object sender, RoutedEventArgs e)
-        {
-            TextBlock textBlock = (TextBlock)sender;
-            User user = Base.MyBase.User.FirstOrDefault(x => x.UserID.ToString() == textBlock.Uid);
-            if (user != null)
-            {
-                textBlock.Text = "Заказчик: " + user.UserSurname + user.UserName + " " + user.UserPatronymic;
-            }
-            else
-            {
-                textBlock.Text = "Заказчик: не найдено";
-            }
-            if (current_user.UserRole == 1) textBlock.Text = "";
-        }
-    }
-}