소스 검색

All application, menu admin, add check acount

MoskalenkoSergey 6 달 전
부모
커밋
612d9507f8

+ 7 - 0
PP_Ven_MosS/PP_Ven_MosS.csproj

@@ -105,6 +105,10 @@
     <Compile Include="ModelBase\User.cs">
       <DependentUpon>Model1.tt</DependentUpon>
     </Compile>
+    <Page Include="Pages\Acount.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Pages\ApplicationsListAdmin.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -135,6 +139,9 @@
       <DesignTime>True</DesignTime>
       <DependentUpon>Model1.edmx</DependentUpon>
     </Compile>
+    <Compile Include="Pages\Acount.xaml.cs">
+      <DependentUpon>Acount.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Pages\ApplicationsListAdmin.xaml.cs">
       <DependentUpon>ApplicationsListAdmin.xaml</DependentUpon>
     </Compile>

+ 57 - 0
PP_Ven_MosS/Pages/Acount.xaml

@@ -0,0 +1,57 @@
+<Page x:Class="PP_Ven_MosS.Pages.Acount"
+      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:PP_Ven_MosS.Pages"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="Acount">
+
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="35"></RowDefinition>
+            <RowDefinition></RowDefinition>
+            <RowDefinition Height="30"></RowDefinition>
+        </Grid.RowDefinitions>
+        <StackPanel Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
+            <TextBlock Text="Зарегистрированные пользователи" FontWeight="Bold" FontSize="30" Margin="100,0"></TextBlock>
+        </StackPanel>
+        <StackPanel Grid.Row="1" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Top" Orientation="Vertical">
+            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
+                <GroupBox Height="60" Header="Введите текст для поиска" BorderThickness="2" BorderBrush="#FF0000" Margin="10,0,0,0">
+                    <TextBox TextChanged="TB_Search_app_TextChanged"  Name="TB_Search_app" Width="200" Height="30"/>
+                </GroupBox>
+                <ComboBox SelectionChanged="CB_Filter_user_SelectionChanged" Name="CB_Filter_user" Width="200" Height="30" Margin="10,10,0,0" />
+            </StackPanel>
+            <ListView Grid.Row="2" Grid.Column="0" Name="UserList" Height="700" MinWidth="500">
+                <ListView.ItemsPanel>
+                    <ItemsPanelTemplate>
+                        <WrapPanel Orientation="Vertical" HorizontalAlignment="Center"/>
+                    </ItemsPanelTemplate>
+                </ListView.ItemsPanel>
+                <ListView.ItemTemplate>
+                    <DataTemplate>
+                        <Border Width="500" Height="150" BorderThickness="1" BorderBrush="Red">
+                            <StackPanel Orientation="Horizontal">
+                                <StackPanel Margin="10,0,0,0" Width="300" Orientation="Vertical" HorizontalAlignment="Left">
+                                    <TextBlock Text="{Binding Surname}"/>
+                                    <TextBlock Text="{Binding Name}"/>
+                                    <TextBlock Text="{Binding Patronymic}"/>
+                                    <TextBlock Text="{Binding Post}"/>
+                                    <TextBlock Text="{Binding Phone_number}"/>
+                                    <TextBlock Text="{Binding Path=Role.Title_role}"/>
+                                    <TextBlock Text="{Binding Count_complete_app}"/>
+                                    <TextBlock Text="{Binding Count_complete_event}"/>
+                                </StackPanel>
+                            </StackPanel>
+                        </Border>
+                    </DataTemplate>
+                </ListView.ItemTemplate>
+            </ListView>
+        </StackPanel>
+        <StackPanel Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
+            <Button Height="30" Content="Выйти" FontSize="20" Style="{StaticResource BtnSt}" Name="Exit" Click="Exit_Click"></Button>
+        </StackPanel>
+    </Grid>
+</Page>

+ 71 - 0
PP_Ven_MosS/Pages/Acount.xaml.cs

@@ -0,0 +1,71 @@
+using PP_Ven_MosS.Classes;
+using PP_Ven_MosS.ModelBase;
+using System;
+using System.Collections.Generic;
+using System.Data.Entity;
+using System.Linq;
+using System.Security.RightsManagement;
+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 PP_Ven_MosS.Pages
+{
+    /// <summary>
+    /// Логика взаимодействия для Acount.xaml
+    /// </summary>
+    public partial class Acount : Page
+    {
+        public Acount()
+        {
+            InitializeComponent();
+            UserList.ItemsSource = Classes.Database.entities.User.ToList();
+            CB_Filter_user.ItemsSource = new List<string> { "Роли", "Сотрудники", "Пользователи" };
+            CB_Filter_user.SelectedIndex = 0;
+        }
+
+        private void CB_Filter_user_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            Filter();
+        }
+        private void TB_Search_app_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            Filter();
+        }
+        private void Filter()
+        {
+            List<User> users = Classes.Database.entities.User.ToList();
+
+            if (CB_Filter_user.SelectedIndex != 0)
+            {
+                switch (CB_Filter_user.SelectedIndex)
+                {
+                    case 1:
+                        users = users.Where(x => x.Id_role == 1 || x.Id_role == 2).ToList();
+                        break;
+                    case 2:
+                        users = users.Where(x => x.Id_role == 3).ToList();
+                        break;
+                }
+            }
+            if (!string.IsNullOrEmpty(TB_Search_app.Text))
+            {
+                users = users.Where(x => x.Surname.ToUpper().Contains(TB_Search_app.Text.ToUpper())).ToList();
+            }
+            UserList.ItemsSource = users;
+        }
+
+        private void Exit_Click(object sender, RoutedEventArgs e)
+        {
+            FrameClass.MainFrame.Navigate(new MenuAdmin());
+        }
+    }
+}

+ 6 - 2
PP_Ven_MosS/Pages/Avtorization.xaml.cs

@@ -37,20 +37,24 @@ namespace PP_Ven_MosS
             {
                 string GHCPass = PBPass.Password.GetHashCode().ToString();
                 User user = Database.entities.User.FirstOrDefault(x => x.Login == TBLog.Text && x.Password == GHCPass);
-                UserRole.userrole = user.Id_role;
-                UserID.userid = user.Id_user;
                 if (user != null)
                 {
                     if (user.Id_role == 1)
                     {
+                        UserRole.userrole = user.Id_role;
+                        UserID.userid = user.Id_user;
                         FrameClass.MainFrame.Navigate(new MenuAdmin());
                     }
                     else if (user.Id_role == 2)
                     {
+                        UserRole.userrole = user.Id_role;
+                        UserID.userid = user.Id_user;
                         FrameClass.MainFrame.Navigate(new ApplicationsListAdmin());
                     }
                     else if (user.Id_role == 3)
                     {
+                        UserRole.userrole = user.Id_role;
+                        UserID.userid = user.Id_user;
                         FrameClass.MainFrame.Navigate(new ApplicationsListUser());
                     }
                 }

+ 5 - 2
PP_Ven_MosS/Pages/MenuAdmin.xaml

@@ -25,6 +25,9 @@
         <StackPanel Grid.Row="0" HorizontalAlignment="Right" Grid.Column="1">
             <Button Content="Личный кабинет" Style="{StaticResource BtnSt}" Name="GoProfile" Click="Profile_Click"></Button>
         </StackPanel>
+        <StackPanel Grid.Row="0" HorizontalAlignment="Left" Grid.Column="0">
+            <Button Content="Пользователи" Style="{StaticResource BtnSt}" Name="Users" Click="Users_Click"></Button>
+        </StackPanel>
         <StackPanel Grid.Row="1" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
             <TextBlock Text="Служебные записки" FontWeight="Bold" FontSize="20"></TextBlock>
         </StackPanel>
@@ -39,7 +42,7 @@
                 <ComboBox SelectionChanged="SortFilterChanged" Name="CB_Sort_app" Width="200" Height="30" Margin="10,10,0,0" />
                 <ComboBox SelectionChanged="SortFilterChanged" Name="CB_Filter_app" Width="200" Height="30" Margin="10,10,0,0" />
             </StackPanel>
-            <ListView Grid.Row="2" Grid.Column="0" Name="ApplicationList" Height="500">
+            <ListView Grid.Row="2" Grid.Column="0" Name="ApplicationList" Height="700">
                 <ListView.ItemsPanel>
                     <ItemsPanelTemplate>
                         <WrapPanel Orientation="Vertical" HorizontalAlignment="Center"/>
@@ -74,7 +77,7 @@
                 <ComboBox Name="CB_Sort_event" SelectionChanged="CB_Sort_event_SelectionChanged" Width="200" Height="30" Margin="10,10,0,0"></ComboBox>
                 <ComboBox Name="CB_Filter_event" SelectionChanged="CB_Filter_event_SelectionChanged" Width="200" Height="30" Margin="10,10,0,0"></ComboBox>
             </StackPanel>
-            <ListView Grid.Row="2" Grid.Column="1" Name="EventList" Height="500">
+            <ListView Grid.Row="2" Grid.Column="1" Name="EventList" Height="700">
                 <ListView.ItemsPanel>
                     <ItemsPanelTemplate>
                         <WrapPanel Orientation="Vertical" HorizontalAlignment="Center"/>

+ 5 - 0
PP_Ven_MosS/Pages/MenuAdmin.xaml.cs

@@ -80,6 +80,11 @@ namespace PP_Ven_MosS.Pages
                 
             }
         }
+
+        private void Users_Click(object sender, RoutedEventArgs e)
+        {
+            FrameClass.MainFrame.Navigate(new Acount());
+        }
     }
     public partial class MenuAdmin : Page
     {