unknown 8 miesięcy temu
rodzic
commit
0120050d5c

BIN
.vs/Sessioa/FileContentIndex/67dee0f4-82aa-49c3-976e-cc4fec348b27.vsidx


BIN
.vs/Sessioa/FileContentIndex/e0c5648b-e955-485b-8e82-2fb6061daf3e.vsidx


BIN
.vs/Sessioa/v17/.suo


+ 29 - 2
Sessioa/Pages/OrderNew.xaml

@@ -7,8 +7,35 @@
       mc:Ignorable="d" 
       d:DesignHeight="450" d:DesignWidth="800"
       Title="OrderNew">
-
+    <Page.Resources>
+        <BitmapImage x:Key="defaultImage" UriSource="/Resources/picture.png"/>
+    </Page.Resources>
     <Grid>
-        
+        <Grid.RowDefinitions>
+            <RowDefinition/>
+            <RowDefinition Height="0.1*"/>
+        </Grid.RowDefinitions>
+        <ListBox x:Name="LB_OrderProduct" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Margin="200,0">
+            <ListBox.ItemTemplate>
+                <DataTemplate>
+                    <Border BorderBrush="Black" BorderThickness="2" CornerRadius="5">
+                        <Grid>
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="0.3*"/>
+                                <ColumnDefinition Width="2*"/>
+                            </Grid.ColumnDefinitions>
+                            <StackPanel>
+                                <TextBlock Text="{Binding OrderID, StringFormat=Заказ #{0}}" Style="{StaticResource TextBlockBold}"/>
+                                <TextBlock Name="UserOrder" Loaded="UserOrder_Loaded" Style="{StaticResource TextBlock}" Uid="{Binding User.UserID}"/>
+                            </StackPanel>
+                            <StackPanel Grid.Column="1" HorizontalAlignment="Right" Margin="15,0">
+                                <TextBlock Text="{Binding OrderDate, StringFormat=Дата создания заказа: {0:d}}" Style="{StaticResource TextBlock}" Foreground="#eb9c00" Language="ru-RU"/>
+                                <TextBlock Text="{Binding OrderDeliveryDate, StringFormat=Дата выдачи: {0:d}}" Style="{StaticResource TextBlock}" Foreground="#498C51" Language="ru-RU"/>
+                            </StackPanel>
+                        </Grid>
+                    </Border>
+                </DataTemplate>
+            </ListBox.ItemTemplate>
+        </ListBox>
     </Grid>
 </Page>

+ 22 - 1
Sessioa/Pages/OrderNew.xaml.cs

@@ -12,6 +12,9 @@ using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using System.Windows.Navigation;
 using System.Windows.Shapes;
+using Sessioa.BaseModel;
+using Sessioa.Classes;
+using System.Data.Entity;
 
 namespace Sessioa.Pages
 {
@@ -20,9 +23,27 @@ namespace Sessioa.Pages
     /// </summary>
     public partial class OrderNew : Page
     {
-        public OrderNew()
+        User user = null;
+        public OrderNew(User userSign)
         {
             InitializeComponent();
+            user = userSign;
+            if(userSign.UserRole == 2)
+            {
+                LB_OrderProduct.ItemsSource = BaseClass.C_Base.Order.Include(x => x.PointsOfIssue).Include(x=>x.User).ToList();
+            }
+            else if (userSign.UserRole == 1)
+                LB_OrderProduct.ItemsSource = BaseClass.C_Base.Order.Include(x => x.PointsOfIssue).Where(x => x.UserID == userSign.UserID).ToList();
+        }
+
+        private void UserOrder_Loaded(object sender, RoutedEventArgs e)
+        {
+            TextBlock tb = (TextBlock)sender;
+            if(tb.Uid != null && user.UserRole == 2)
+            {
+                User us = BaseClass.C_Base.User.FirstOrDefault(x => x.UserID.ToString() == tb.Uid);
+                tb.Text = $"Заказчик: {us.UserSurname} {us.UserName[0]}.{(us.UserPatronymic != null && us.UserPatronymic != string.Empty ? $"{us.UserPatronymic[0]}." : "")}";
+            }
         }
     }
 }

+ 1 - 0
Sessioa/Pages/ProductsPage.xaml

@@ -74,6 +74,7 @@
         <StackPanel Orientation="Horizontal">
             <Button Name="SignOf" Content="Выйти" Style="{StaticResource ButtonAct}" Margin="10,0" MaxHeight="50" MinWidth="90" MaxWidth="150" Click="SignOf_Click" HorizontalAlignment="Left"/>
             <Button Name="NewProduct" Content="Добавить продукт" Style="{StaticResource ButtonSt}" Margin="10,0" MaxHeight="50" MinWidth="90" MaxWidth="150" Click="NewProduct_Click" HorizontalAlignment="Left" Visibility="Collapsed" Loaded="NewProduct_Loaded"/>
+            <Button Name="OrdersUser" Content="Корзина" Style="{StaticResource ButtonSt}" Margin="10,0" MaxHeight="50" MinWidth="90" MaxWidth="150" Click="OrdersUser_Click" HorizontalAlignment="Left" Visibility="Collapsed" Loaded="OrdersUser_Loaded"/>
         </StackPanel>    
     </Grid>
 </Page>

+ 15 - 0
Sessioa/Pages/ProductsPage.xaml.cs

@@ -205,5 +205,20 @@ namespace Sessioa.Pages
                 }
             }
         }
+
+        private void OrdersUser_Loaded(object sender, RoutedEventArgs e)
+        {
+            Button button = (Button)sender;
+            if (user != null)
+            {
+                if (BaseClass.C_Base.Order.Where(x=>x.UserID == user.UserID).Count() > 0)
+                    button.Visibility = Visibility.Visible;
+            }
+        }
+
+        private void OrdersUser_Click(object sender, RoutedEventArgs e)
+        {
+            FrameClass.C_Frame.Navigate(new OrderNew(user));
+        }
     }
 }

BIN
Sessioa/bin/Debug/Sessioa.exe


BIN
Sessioa/bin/Debug/Sessioa.pdb


BIN
Sessioa/obj/Debug/Pages/OrderNew.baml


+ 36 - 2
Sessioa/obj/Debug/Pages/OrderNew.g.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\..\Pages\OrderNew.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9228B94045A53D6D0DA008BA7C739DCE1AA9DC12E4521C75F9E4DCA9EF74A931"
+#pragma checksum "..\..\..\Pages\OrderNew.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "377D98C5E84B78305410BA6AFCB6B27FA26D2A1516779CEC5CB1DBEAF5C49ACD"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     Этот код создан программой.
@@ -38,7 +38,15 @@ namespace Sessioa.Pages {
     /// <summary>
     /// OrderNew
     /// </summary>
-    public partial class OrderNew : System.Windows.Controls.Page, System.Windows.Markup.IComponentConnector {
+    public partial class OrderNew : System.Windows.Controls.Page, System.Windows.Markup.IComponentConnector, System.Windows.Markup.IStyleConnector {
+        
+        
+        #line 18 "..\..\..\Pages\OrderNew.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.ListBox LB_OrderProduct;
+        
+        #line default
+        #line hidden
         
         private bool _contentLoaded;
         
@@ -68,8 +76,34 @@ namespace Sessioa.Pages {
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
         void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
+            switch (connectionId)
+            {
+            case 1:
+            this.LB_OrderProduct = ((System.Windows.Controls.ListBox)(target));
+            return;
+            }
             this._contentLoaded = true;
         }
+        
+        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
+        void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target) {
+            switch (connectionId)
+            {
+            case 2:
+            
+            #line 29 "..\..\..\Pages\OrderNew.xaml"
+            ((System.Windows.Controls.TextBlock)(target)).Loaded += new System.Windows.RoutedEventHandler(this.UserOrder_Loaded);
+            
+            #line default
+            #line hidden
+            break;
+            }
+        }
     }
 }
 

+ 36 - 2
Sessioa/obj/Debug/Pages/OrderNew.g.i.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\..\Pages\OrderNew.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9228B94045A53D6D0DA008BA7C739DCE1AA9DC12E4521C75F9E4DCA9EF74A931"
+#pragma checksum "..\..\..\Pages\OrderNew.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "377D98C5E84B78305410BA6AFCB6B27FA26D2A1516779CEC5CB1DBEAF5C49ACD"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     Этот код создан программой.
@@ -38,7 +38,15 @@ namespace Sessioa.Pages {
     /// <summary>
     /// OrderNew
     /// </summary>
-    public partial class OrderNew : System.Windows.Controls.Page, System.Windows.Markup.IComponentConnector {
+    public partial class OrderNew : System.Windows.Controls.Page, System.Windows.Markup.IComponentConnector, System.Windows.Markup.IStyleConnector {
+        
+        
+        #line 18 "..\..\..\Pages\OrderNew.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.ListBox LB_OrderProduct;
+        
+        #line default
+        #line hidden
         
         private bool _contentLoaded;
         
@@ -68,8 +76,34 @@ namespace Sessioa.Pages {
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
         void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
+            switch (connectionId)
+            {
+            case 1:
+            this.LB_OrderProduct = ((System.Windows.Controls.ListBox)(target));
+            return;
+            }
             this._contentLoaded = true;
         }
+        
+        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
+        void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target) {
+            switch (connectionId)
+            {
+            case 2:
+            
+            #line 29 "..\..\..\Pages\OrderNew.xaml"
+            ((System.Windows.Controls.TextBlock)(target)).Loaded += new System.Windows.RoutedEventHandler(this.UserOrder_Loaded);
+            
+            #line default
+            #line hidden
+            break;
+            }
+        }
     }
 }
 

BIN
Sessioa/obj/Debug/Pages/ProductsPage.baml


+ 24 - 1
Sessioa/obj/Debug/Pages/ProductsPage.g.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\..\Pages\ProductsPage.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9CF137696ED124294E3934F397E150E748F50A8E98AFD266B5926FC0600BF87E"
+#pragma checksum "..\..\..\Pages\ProductsPage.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "86C100D66E9C50140F19AB0C4114506A3771BE22BB329E547D1909148A22D59A"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     Этот код создан программой.
@@ -136,6 +136,14 @@ namespace Sessioa.Pages {
         #line default
         #line hidden
         
+        
+        #line 77 "..\..\..\Pages\ProductsPage.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.Button OrdersUser;
+        
+        #line default
+        #line hidden
+        
         private bool _contentLoaded;
         
         /// <summary>
@@ -267,6 +275,21 @@ namespace Sessioa.Pages {
             #line 76 "..\..\..\Pages\ProductsPage.xaml"
             this.NewProduct.Loaded += new System.Windows.RoutedEventHandler(this.NewProduct_Loaded);
             
+            #line default
+            #line hidden
+            return;
+            case 18:
+            this.OrdersUser = ((System.Windows.Controls.Button)(target));
+            
+            #line 77 "..\..\..\Pages\ProductsPage.xaml"
+            this.OrdersUser.Click += new System.Windows.RoutedEventHandler(this.OrdersUser_Click);
+            
+            #line default
+            #line hidden
+            
+            #line 77 "..\..\..\Pages\ProductsPage.xaml"
+            this.OrdersUser.Loaded += new System.Windows.RoutedEventHandler(this.OrdersUser_Loaded);
+            
             #line default
             #line hidden
             return;

+ 24 - 1
Sessioa/obj/Debug/Pages/ProductsPage.g.i.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\..\Pages\ProductsPage.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9CF137696ED124294E3934F397E150E748F50A8E98AFD266B5926FC0600BF87E"
+#pragma checksum "..\..\..\Pages\ProductsPage.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "86C100D66E9C50140F19AB0C4114506A3771BE22BB329E547D1909148A22D59A"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     Этот код создан программой.
@@ -136,6 +136,14 @@ namespace Sessioa.Pages {
         #line default
         #line hidden
         
+        
+        #line 77 "..\..\..\Pages\ProductsPage.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.Button OrdersUser;
+        
+        #line default
+        #line hidden
+        
         private bool _contentLoaded;
         
         /// <summary>
@@ -267,6 +275,21 @@ namespace Sessioa.Pages {
             #line 76 "..\..\..\Pages\ProductsPage.xaml"
             this.NewProduct.Loaded += new System.Windows.RoutedEventHandler(this.NewProduct_Loaded);
             
+            #line default
+            #line hidden
+            return;
+            case 18:
+            this.OrdersUser = ((System.Windows.Controls.Button)(target));
+            
+            #line 77 "..\..\..\Pages\ProductsPage.xaml"
+            this.OrdersUser.Click += new System.Windows.RoutedEventHandler(this.OrdersUser_Click);
+            
+            #line default
+            #line hidden
+            
+            #line 77 "..\..\..\Pages\ProductsPage.xaml"
+            this.OrdersUser.Loaded += new System.Windows.RoutedEventHandler(this.OrdersUser_Loaded);
+            
             #line default
             #line hidden
             return;

BIN
Sessioa/obj/Debug/Sessioa.exe


BIN
Sessioa/obj/Debug/Sessioa.g.resources


BIN
Sessioa/obj/Debug/Sessioa.pdb