Иван Прытов 8 månader sedan
förälder
incheckning
912583938c
9 ändrade filer med 294 tillägg och 37 borttagningar
  1. 11 7
      GGwp/Authoriz.xaml
  2. 1 1
      GGwp/Authoriz.xaml.cs
  3. 12 5
      GGwp/GGwp.csproj
  4. 20 14
      GGwp/Guest.xaml
  5. 20 1
      GGwp/Guest.xaml.cs
  6. BIN
      GGwp/Pictures/capcha.png
  7. 9 9
      GGwp/Window/Cart.xaml
  8. 46 0
      GGwp/Zakaz.xaml
  9. 175 0
      GGwp/Zakaz.xaml.cs

+ 11 - 7
GGwp/Page/Authoriz.xaml → GGwp/Authoriz.xaml

@@ -8,20 +8,24 @@
       d:DesignHeight="450" d:DesignWidth="800"
       Title="Authoriz">
 
-    <Grid>
-        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="350">
-            <TextBlock HorizontalAlignment="Center" Text="Логин"/>
+    <Grid Background="LightGreen">
+        <Rectangle HorizontalAlignment="Center" Height="350"  Fill="White" VerticalAlignment="Center" Width="550" RadiusX="15" RadiusY="15"/>
+        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="300">
+
+            <TextBlock  Foreground="Green" HorizontalAlignment="Left" Text="Логин"/>
             <TextBox Background="#0000" Name="EnteredLogin"/>
-            <TextBlock HorizontalAlignment="Center" Text="Пароль"/>
+            <TextBlock  Foreground="Green" HorizontalAlignment="Left" Text="Пароль"/>
             <TextBox Background="#0000" Name="EnteredPass"/>
-            <Button Name="AuthUser" Click="GoAuth" Margin="0,10,0,0" Content="Войти"/>
-            <TextBlock Margin="0,5,0,0" HorizontalAlignment="Center" Text="ИЛИ"/>
-            <Button Name="AuthGuest" Click="GoGuest" Margin="0,5,0,0" Content="Войти как гость"/>
+            <Button  Foreground="Green" Background="LightGreen" Name="AuthUser" Click="GoAuth" Margin="0,10,0,0" Content="Войти"/>
+
+            <Button  Foreground="Green" Background="LightGreen" Name="AuthGuest" Click="GoGuest" Margin="0,5,0,0" Content="Войти как гость"/>
             <StackPanel Margin="0,10,0,0" Visibility="Collapsed" Name="Capa">
                 <Image Source="\Pictures\capcha.png"/>
                 <TextBlock Text="Введите текст с картинки"/>
                 <TextBox Name="CapaText"/>
             </StackPanel>
+            
         </StackPanel>
+        
     </Grid>
 </Page>

+ 1 - 1
GGwp/Page/Authoriz.xaml.cs → GGwp/Authoriz.xaml.cs

@@ -40,7 +40,7 @@ namespace GGwp
                 }
                 else if (user != null && CapaFlag == true)
                 {
-                    if (CapaText.Text.ToUpper() == "A4B1".ToUpper())
+                    if (CapaText.Text.ToUpper() == "1A84".ToUpper())
                     {
                         MainFRM.mFrame.Navigate(new Guest(user.UserID));
                     }

+ 12 - 5
GGwp/GGwp.csproj

@@ -65,7 +65,7 @@
       <SubType>Designer</SubType>
     </ApplicationDefinition>
     <Compile Include="Hopscotch\AmountProduct.cs" />
-    <Compile Include="Page\Authoriz.xaml.cs">
+    <Compile Include="Authoriz.xaml.cs">
       <DependentUpon>Authoriz.xaml</DependentUpon>
     </Compile>
     <Compile Include="Window\Cart.xaml.cs">
@@ -74,7 +74,7 @@
     <Compile Include="Categories.cs">
       <DependentUpon>Model1.tt</DependentUpon>
     </Compile>
-    <Compile Include="Page\Guest.xaml.cs">
+    <Compile Include="Guest.xaml.cs">
       <DependentUpon>Guest.xaml</DependentUpon>
     </Compile>
     <Compile Include="Hopscotch\MainFRM.cs" />
@@ -113,7 +113,10 @@
     <Compile Include="User.cs">
       <DependentUpon>Model1.tt</DependentUpon>
     </Compile>
-    <Page Include="Page\Authoriz.xaml">
+    <Compile Include="Zakaz.xaml.cs">
+      <DependentUpon>Zakaz.xaml</DependentUpon>
+    </Compile>
+    <Page Include="Authoriz.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
@@ -121,7 +124,7 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
-    <Page Include="Page\Guest.xaml">
+    <Page Include="Guest.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
@@ -137,6 +140,10 @@
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
+    <Page Include="Zakaz.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Model1.Context.cs">
@@ -193,10 +200,10 @@
       <DependentUpon>Model1.edmx</DependentUpon>
       <LastGenOutput>Model1.cs</LastGenOutput>
     </Content>
+    <Resource Include="Pictures\capcha.png" />
     <Resource Include="Pictures\A346R4.jpg" />
     <Resource Include="Pictures\A543T6.jpg" />
     <Resource Include="Pictures\B730E2.jpg" />
-    <Resource Include="Pictures\capcha.png" />
     <Resource Include="Pictures\D419T7.png" />
     <Resource Include="Pictures\F719R5.jpg" />
     <Resource Include="Pictures\G278R6.png" />

+ 20 - 14
GGwp/Page/Guest.xaml → GGwp/Guest.xaml

@@ -8,21 +8,22 @@
       d:DesignHeight="450" d:DesignWidth="800"
       Title="Guest">
 
-    <Grid Background="White">
+    <Grid Background="LightGreen">
         <Grid.RowDefinitions>
             <RowDefinition Height="*"/>
             <RowDefinition Height="10*"/>
             <RowDefinition Height="*"/>
         </Grid.RowDefinitions>
         <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
-            <Button Click="CartGo" Name="ToCart" Content="Корзина" Visibility="Hidden"/>
-            <ComboBox SelectionChanged="SortFilterChanged" Name="SortByName" Height="30" Margin="10,0,0,0" Width="200"/>
-            <ComboBox SelectionChanged="SortFilterChanged" Name="FilterByPromo" Height="30" Margin="10,0,0,0"  Width="200"/>
+            <Button BorderBrush="White" BorderThickness="2" Foreground="Green" Background="LightGreen" Width="100" Height="30" Click="CartGo" Name="ToCart" Content="Корзина" Visibility="Hidden"/>
+            <ComboBox Foreground="Green" Background="LightGreen" SelectionChanged="SortFilterChanged" Name="SortByName" Height="30" Margin="10,0,0,0" Width="200"/>
+            <ComboBox Foreground="Green" Background="LightGreen" SelectionChanged="SortFilterChanged" Name="FilterByPromo" Height="30" Margin="10,0,0,0"  Width="200"/>
             <TextBox TextChanged="SearchChanged" Name="SearchByName" Height="30" TextAlignment="Center"  Margin="10,0,0,0"  Width="200"/>
             <TextBlock TextAlignment="Center"  Margin="10,0,0,0"  Name="AmountOfData"/>
+            <Button BorderBrush="White" BorderThickness="2" Foreground="Green" Background="LightGreen" Width="100" Height="30" Click="BackToAuth" Content="Выйти"/>
         </StackPanel>
 
-        <ListView Grid.Row="1" Name="ProductList" d:ItemsSource="{d:SampleData ItemCount=5}">
+        <ListView Background="White" Grid.Row="1" Name="ProductList" d:ItemsSource="{d:SampleData ItemCount=5}">
 
             <ListView.ItemsPanel>
                 <ItemsPanelTemplate>
@@ -43,13 +44,13 @@
                                 <StackPanel Orientation="Horizontal">
                                     <Image Width="200" Height="195" Grid.Column="0" Uid="{Binding ProductArticleNumber}" Loaded="Photo"/>
                                     <StackPanel Margin="10,0,0,0" Width="300" HorizontalAlignment="Center" Grid.Column="1" Orientation="Vertical">
-                                        <TextBlock Text="{Binding ProductName}"/>
-                                        <TextBlock Text="{Binding ProductDescription}" TextWrapping="Wrap"/>
-                                        <TextBlock Text="{Binding StringFormat=Произоводитель: {0},Path=Manufacturers.ManufacturerName}"/>
-                                        <TextBlock Text="{Binding ProductCost}"  Uid="{Binding ProductArticleNumber}" Loaded="StrikePrice"/>
-                                        <TextBlock Text="{Binding ProductCost}"  Uid="{Binding ProductArticleNumber}" Loaded="PromoPrice"/>
+                                        <TextBlock Foreground="Green" Text="{Binding ProductName}"/>
+                                        <TextBlock Foreground="Green" Text="{Binding ProductDescription}" TextWrapping="Wrap"/>
+                                        <TextBlock Foreground="Green" Text="{Binding StringFormat=Произоводитель: {0},Path=Manufacturers.ManufacturerName}"/>
+                                        <TextBlock Foreground="Green" Text="{Binding ProductCost}"  Uid="{Binding ProductArticleNumber}" Loaded="StrikePrice"/>
+                                        <TextBlock Foreground="Green" Text="{Binding ProductCost}"  Uid="{Binding ProductArticleNumber}" Loaded="PromoPrice"/>
                                     </StackPanel>
-                                    <TextBlock Margin="10,0,0,0" HorizontalAlignment="Center" Grid.Column="2" Text="{Binding StringFormat=Скидка: {0}%, Path=ProductMaxDiscountAmount}"/>
+                                    <TextBlock FontWeight="Bold" Foreground="Green" Margin="10,0,0,0" HorizontalAlignment="Center" Grid.Column="2" Text="{Binding StringFormat=Скидка: {0}%, Path=ProductMaxDiscountAmount}"/>
                                 </StackPanel>
                             </Grid>
 
@@ -60,9 +61,14 @@
         </ListView>
 
         <StackPanel Name="ButtonsForAdmin" Visibility="Hidden" HorizontalAlignment="Center" Orientation="Horizontal" Grid.Row="2">
-            <Button Width="70" Height="30" Content="Добавить"/>
-            <Button Margin="10,0,0,0" Height="30" Width="90" Content="Редактировать"/>
-            <Button Margin="10,0,0,0" Height="30" Width="70" Content="Удалить"/>
+            <Button BorderBrush="White" BorderThickness="2" Foreground="Green" Background="LightGreen" Width="70" Height="30" Content="Добавить"/>
+            <Button BorderBrush="White" BorderThickness="2" Foreground="Green" Background="LightGreen" Margin="10,0,0,0" Height="30" Width="90" Content="Редактировать"/>
+            <Button BorderBrush="White" BorderThickness="2" Foreground="Green" Background="LightGreen" Margin="10,0,0,0" Height="30" Width="70" Content="Удалить"/>
+            <Button BorderBrush="White" BorderThickness="2" Foreground="Green" Background="LightGreen" Margin="10,0,0,0" Name="ViewOrder" Width="130" Height="30" Click="ViewOrders" Content="Посмотреть заказы"/>
+            
         </StackPanel>
+
+        
+
     </Grid>
 </Page>

+ 20 - 1
GGwp/Page/Guest.xaml.cs → GGwp/Guest.xaml.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Net;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
@@ -22,7 +23,7 @@ namespace GGwp
     {
         TradePrytovEntities DB = new TradePrytovEntities();
         int AllData;
-
+        int id;
         public Guest()
         {
             InitializeComponent();
@@ -42,11 +43,27 @@ namespace GGwp
             if (user.UserRole == 1)
             {
                 ButtonsForAdmin.Visibility = Visibility.Visible;
+                ViewOrder.Visibility = Visibility.Visible;
+            }
+            if (user.UserRole == 3)
+            {
+                ViewOrder.Visibility = Visibility.Visible;
             }
             FilterByPromo.ItemsSource = new List<string>() { "Все", "Скидка 0-9,99%", "Скидка 10-14,99%", "Скидка 15% и более" };
             SortByName.ItemsSource = new List<string>() { "Без сортировки", "По имени А-Я", "По имени Я-А" };
             SortByName.SelectedIndex = 0;
             FilterByPromo.SelectedIndex = 0;
+            this.id = id;
+        }
+
+        private void ViewOrders(object sender, RoutedEventArgs e)
+        {
+            MainFRM.mFrame.Navigate(new Zakaz(id));
+        }
+
+        private void BackToAuth(object sender, RoutedEventArgs e)
+        {
+            MainFRM.mFrame.Navigate(new Authoriz());
         }
 
         public void BackgroundLoad(object sender, RoutedEventArgs e)
@@ -177,5 +194,7 @@ namespace GGwp
             Cart ct = new Cart();
             ct.ShowDialog();
         }
+
+
     }
 }

BIN
GGwp/Pictures/capcha.png


+ 9 - 9
GGwp/Window/Cart.xaml

@@ -6,7 +6,7 @@
         xmlns:local="clr-namespace:GGwp"
         mc:Ignorable="d"
         Title="Cart" Height="450" Width="800">
-    <Grid>
+    <Grid Background="LightGreen" >
         <Grid.RowDefinitions>
             <RowDefinition Height="10*"/>
             <RowDefinition Height="*"/>
@@ -24,17 +24,17 @@
                             <Grid Width="795" Height="195">
                                 <Image Width="200" Height="195" Uid="{Binding ProductArticleNumber}" Loaded="Photo"/>
                                 <StackPanel Orientation="Horizontal">
-                                    <TextBlock Margin="10,0,0,0" Text="{Binding ProductArticleNumber}"/>
-                                    <TextBlock Margin="10,0,0,0" Text="{Binding ProductName}"/>
-                                    <TextBlock Margin="10,0,0,0" Uid="{Binding ProductArticleNumber}" Loaded="CostCalculate"/>
-                                    <TextBlock Margin="10,0,0,0" Text="{Binding ProductDescription}"/>
-                                    <StackPanel Margin="10,0,0,0" Orientation="Vertical">
+                                    <TextBlock Foreground="Green" Margin="10,0,0,0" Text="{Binding ProductArticleNumber}"/>
+                                    <TextBlock Foreground="Green" Margin="10,0,0,0" Text="{Binding ProductName}"/>
+                                    <TextBlock Foreground="Green" Margin="10,0,0,0" Uid="{Binding ProductArticleNumber}" Loaded="CostCalculate"/>
+                                    <TextBlock Foreground="Green" Margin="10,0,0,0" Text="{Binding ProductDescription}"/>
+                                    <StackPanel  Margin="10,0,0,0" Orientation="Vertical">
                                         <StackPanel Orientation="Horizontal">
                                             <Button Content="-"/>
-                                            <TextBlock Margin="10,0,0,0" Uid="{Binding ProductArticleNumber}" Loaded="AmountCalculate"/>
+                                            <TextBlock Foreground="Green" Margin="10,0,0,0" Uid="{Binding ProductArticleNumber}" Loaded="AmountCalculate"/>
                                             <Button Margin="10,0,0,0" Content="+"/>
                                         </StackPanel>
-                                        <Button Margin="0,10,0,0" Content="Удалить"/>
+                                        <Button BorderBrush="White" BorderThickness="2" Foreground="Green" Background="LightGreen" Margin="0,10,0,0" Content="Удалить"/>
                                     </StackPanel>
                                 </StackPanel>
                             </Grid>
@@ -46,7 +46,7 @@
 
         <StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center">
             <TextBlock Name="CostOrder"/>
-            <Button Margin="10,0,0,0" Content="Заказать"/>
+            <Button Width="100" Height="30" BorderBrush="White" BorderThickness="2" Foreground="Green" Background="LightGreen" Margin="10,0,0,0" Content="Заказать"/>
         </StackPanel>
     </Grid>
 </Window>

+ 46 - 0
GGwp/Zakaz.xaml

@@ -0,0 +1,46 @@
+<Page x:Class="GGwp.Zakaz"
+      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+      xmlns:local="clr-namespace:GGwp"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="Zakaz">
+
+    <Grid Background="LightGreen">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="*"/>
+            <RowDefinition Height="10*"/>
+        </Grid.RowDefinitions>
+
+        <StackPanel Height="30" HorizontalAlignment="Center" Orientation="Horizontal" Grid.Row="0">
+            <Button BorderBrush="White" BorderThickness="2" Foreground="Green" Background="LightGreen" Content="Вернутся к товарам" Click="BackToProduct"/>
+            <ComboBox SelectionChanged="SortOrFilter" Name="SortOrders" Margin="10,0,0,0" Width="150"/>
+            <ComboBox SelectionChanged="SortOrFilter" Name="FilterOrders" Margin="10,0,0,0" Width="150"/>
+        </StackPanel>
+
+        <ListView Grid.Row="1" Name="OrderList" d:ItemsSource="{d:SampleData ItemCount=5}">
+            <ListView.ItemsPanel>
+                <ItemsPanelTemplate>
+                    <WrapPanel Orientation="Vertical" HorizontalAlignment="Center"/>
+                </ItemsPanelTemplate>
+            </ListView.ItemsPanel>
+            <ListView.ItemTemplate>
+                <DataTemplate>
+                    <Border Uid="{Binding OrderID}" Loaded="BgrLoad" Width="800" Height="200"  BorderThickness="1" BorderBrush="Black">
+                        <StackPanel>
+                            <TextBlock  Foreground="Green" Text="{Binding StringFormat=Номер заказа: {0}, Path=OrderID}"/>
+                            <TextBlock  Foreground="Green" Text="{Binding StringFormat=Дата оформления: {0}, Path=OrderCreateDate}"/>
+                            <TextBlock  Foreground="Green" Text="{Binding  StringFormat=Дата доставки: {0}, Path=OrderDeliveryDate}"/>
+                            <TextBlock  Foreground="Green" Text="Состав заказа: " FontWeight="Bold"/>
+                            <TextBlock  Foreground="Green" Uid="{Binding OrderID}" Loaded="WhatInOrder"/>
+                            <TextBlock  Foreground="Green" Uid="{Binding OrderID}" Loaded="TotalPromo"/>
+                            <TextBlock  Foreground="Green" Uid="{Binding OrderID}" Loaded="OrderCost"/>
+                        </StackPanel>
+                    </Border>
+                </DataTemplate>
+            </ListView.ItemTemplate>
+        </ListView>
+    </Grid>
+</Page>

+ 175 - 0
GGwp/Zakaz.xaml.cs

@@ -0,0 +1,175 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace GGwp
+{
+    /// <summary>
+    /// Логика взаимодействия для Zakaz.xaml
+    /// </summary>
+    public partial class Zakaz : Page
+    {
+
+        TradePrytovEntities DB = new TradePrytovEntities();
+        int id;
+
+        public Zakaz(int id)
+        {
+            InitializeComponent();
+            OrderList.ItemsSource = DB.Order.ToList();
+            SortOrders.ItemsSource = new List<string>() { "Без сортировки", "Сначала дешёвые", "Сначала дорогие" };
+            FilterOrders.ItemsSource = new List<string>() { "Без фильтрации", "Скидка 0%-10%", "Скидка 10%-15%", "Скидка более 15%" };
+            SortOrders.SelectedIndex = 0;
+            FilterOrders.SelectedIndex = 0;
+            this.id = id;
+        }
+
+        private void WhatInOrder(object sender, RoutedEventArgs e)
+        {
+            TextBlock tb = (TextBlock)sender;
+            int id = Convert.ToInt32(tb.Uid);
+            string WhatIn = "";
+            foreach (OrderProduct op in DB.OrderProduct)
+            {
+                if (op.OrderID == id)
+                {
+                    WhatIn += DB.Product.Where(x => x.ProductArticleNumber == op.ProductArticleNumber).Select(x => x.ProductName).FirstOrDefault() + " ";
+                    WhatIn += op.ProductAmount + " " + DB.Product.Where(x => x.ProductArticleNumber == op.ProductArticleNumber).Select(x => x.UnitsOfMeasurement.UnitName).FirstOrDefault() + "\n";
+                }
+            }
+            tb.Text = WhatIn;
+        }
+        private void OrderCost(object sender, RoutedEventArgs e)
+        {
+            TextBlock tb = (TextBlock)sender;
+            int id = Convert.ToInt32(tb.Uid);
+            decimal? TotalCost = 0;
+            foreach (OrderProduct op in DB.OrderProduct)
+            {
+                if (op.OrderID == id)
+                {
+                    TotalCost += DB.Product.Where(x => x.ProductArticleNumber == op.ProductArticleNumber).Select(x => x.ProductCost).FirstOrDefault() *
+                        op.ProductAmount;
+                }
+            }
+            tb.Text = "Стоимость заказа: " + string.Format("{0:C2}", TotalCost);
+        }
+
+        private void TotalPromo(object sender, RoutedEventArgs e)
+        {
+            TextBlock tb = (TextBlock)sender;
+            int id = Convert.ToInt32(tb.Uid);
+            int? Promo = 0;
+            foreach (OrderProduct op in DB.OrderProduct)
+            {
+                if (op.OrderID == id)
+                {
+                    Promo += DB.Product.Where(x => x.ProductArticleNumber == op.ProductArticleNumber).Select(x => x.ProductMaxDiscountAmount).FirstOrDefault();
+                }
+            }
+            tb.Text = "Общая скидка: " + Promo.ToString() + "%";
+        }
+
+        private void BgrLoad(object sender, RoutedEventArgs e)
+        {
+            Border br = (Border)sender;
+            int id = Convert.ToInt32(br.Uid);
+            Product pr = DB.OrderProduct.Where(x => x.OrderID == id).Select(x => x.Product).FirstOrDefault();
+            if (pr.ProductQuantityInStock > 3)
+            {
+                br.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#20b2aa");
+            }
+            if (pr.ProductQuantityInStock == 0)
+            {
+                br.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#ff8c00");
+            }
+        }
+
+        public void Filter()
+        {
+            List<Order> UpdateOrders = DB.Order.ToList();
+            if (SortOrders.SelectedIndex != 0)
+            {
+                decimal? TotalCost = 0;
+                foreach (Order or in UpdateOrders)
+                {
+                    TotalCost = 0;
+                    foreach (OrderProduct op in DB.OrderProduct)
+                    {
+                        if (op.OrderID == or.OrderID)
+                        {
+                            TotalCost += DB.Product.Where(x => x.ProductArticleNumber == op.ProductArticleNumber).Select(x => x.ProductCost).FirstOrDefault() *
+                                op.ProductAmount;
+                        }
+                    }
+                    or.OrderReceivingCode = Convert.ToInt32(TotalCost);
+                }
+                switch (SortOrders.SelectedIndex)
+                {
+                    case 1:
+                        UpdateOrders = UpdateOrders.OrderBy(x => x.OrderReceivingCode).ToList();
+                        break;
+                    case 2:
+                        UpdateOrders = UpdateOrders.OrderByDescending(x => x.OrderReceivingCode).ToList();
+                        break;
+                    default:
+                        break;
+                }
+            }
+
+            if (FilterOrders.SelectedIndex != 0)
+            {
+                int? TotalPromo = 0;
+                foreach (Order or in UpdateOrders)
+                {
+                    TotalPromo = 0;
+                    foreach (OrderProduct op in DB.OrderProduct)
+                    {
+                        if (op.OrderID == or.OrderID)
+                        {
+                            TotalPromo += DB.Product.Where(x => x.ProductArticleNumber == op.ProductArticleNumber).Select(x => x.ProductMaxDiscountAmount).FirstOrDefault();
+                        }
+                    }
+                    or.OrderPickupPoint = Convert.ToInt32(TotalPromo);
+                }
+                switch (FilterOrders.SelectedIndex)
+                {
+                    case 1:
+                        UpdateOrders = UpdateOrders.Where(x => x.OrderPickupPoint >= 0 && x.OrderPickupPoint < 10).ToList();
+                        break;
+                    case 2:
+                        UpdateOrders = UpdateOrders.Where(x => x.OrderPickupPoint >= 10 && x.OrderPickupPoint < 15).ToList();
+                        break;
+                    case 3:
+                        UpdateOrders = UpdateOrders.Where(x => x.OrderPickupPoint >= 15).ToList();
+                        break;
+                    default:
+                        break;
+                }
+            }
+            OrderList.ItemsSource = UpdateOrders;
+        }
+
+        private void SortOrFilter(object sender, SelectionChangedEventArgs e)
+        {
+            Filter();
+        }
+
+        private void BackToProduct(object sender, RoutedEventArgs e)
+        {
+            MainFRM.mFrame.Navigate(new Guest(id));
+        }
+
+    }
+}