Bladeren bron

Почти готовый профиль

Сергей Москаленко 6 maanden geleden
bovenliggende
commit
fbdf7b8644

+ 3 - 0
PP_Ven_MosS/Pages/ApplicationsListAdmin.xaml

@@ -22,6 +22,9 @@
         <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="0" HorizontalAlignment="Right" Grid.Column="1">
+            <Button Content="Личный кабинет" Style="{StaticResource BtnSt}" Name="GoProfile" Click="Profile_Click"></Button>
+        </StackPanel>
         <StackPanel Grid.Row="1" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
             <TextBlock Text="Служебные записки" FontWeight="Bold" FontSize="20"></TextBlock>
         </StackPanel>

+ 7 - 1
PP_Ven_MosS/Pages/ApplicationsListAdmin.xaml.cs

@@ -23,7 +23,7 @@ namespace PP_Ven_MosS.Pages
     /// </summary>
     public partial class ApplicationsListAdmin
     {
-       
+       User user = new User();
         private string evtype;
         public string EventType 
         {
@@ -47,6 +47,7 @@ namespace PP_Ven_MosS.Pages
         { 
             
             InitializeComponent();
+           
             ApplicationList.ItemsSource = DB.Applications.ToList();
             Applications appl = DB.Applications.Where(x => x.Id_status_app == id).FirstOrDefault();
             CB_Filter_app.ItemsSource = new List<string> { "Фильтр по статусу", "Выполнен", "Не выполнен" };
@@ -190,5 +191,10 @@ namespace PP_Ven_MosS.Pages
         {
             FrameClass.MainFrame.Navigate(new Avtorization());
         }
+        private void Profile_Click(object sender, RoutedEventArgs e)
+        {
+
+            FrameClass.MainFrame.Navigate(new Profile(user));
+        }
     }
 }

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

@@ -37,15 +37,24 @@ namespace PP_Ven_MosS
             User user = Database.entities.User.FirstOrDefault(x => x.Login == TBLog.Text && x.Password == GHCPass);
             if (user != null)
             {
-                if(user.Id_role == 2)
+                if (user.Id_role == 1)
                 {
+                    UserRole.userrole = user.Id_role;
                     UserID.userid = user.Id_user;
                     FrameClass.MainFrame.Navigate(new ApplicationsListUser());
                 }
-                if(user.Id_role == 1)
+                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());
+                }
             }
             else
             {

+ 4 - 4
PP_Ven_MosS/Pages/Profile.xaml

@@ -39,11 +39,11 @@
             <GroupBox Width="500" Height="50" Header="Пароль">
                 <TextBox x:Name="txtPass" MinWidth="500" BorderBrush="#FF6C73E6" BorderThickness="0,0,0,2" Text="{Binding Password}"/>
             </GroupBox>
-            <GroupBox Width="500" Height="50" Header="Выполненные заявки">
-                <TextBox x:Name="txtApp" MinWidth="500" BorderBrush="#FF6C73E6" BorderThickness="0,0,0,2" Text="{Binding Count_complete_app}"/>
+            <GroupBox Width="500" Height="50" Header="Выполненные заявки" Visibility="Hidden" Name="GBApp">
+                <TextBlock x:Name="txtApp" MinWidth="500"/>
             </GroupBox>
-            <GroupBox Width="500" Height="50" Header="Проведенные мероприятия">
-                <TextBox x:Name="txtEvent" MinWidth="500" BorderBrush="#FF6C73E6" BorderThickness="0,0,0,2" Text="{Binding Count_complete_event}"/>
+            <GroupBox Width="500" Height="50" Header="Проведенные мероприятия" Visibility="Hidden" Name="GBEvent">
+                <TextBlock x:Name="txtEvent" MinWidth="500"/>
             </GroupBox>
         </StackPanel>
         <StackPanel Grid.Row="3" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">

+ 23 - 0
PP_Ven_MosS/Pages/Profile.xaml.cs

@@ -29,13 +29,34 @@ namespace PP_Ven_MosS.Pages
         User user = new User();
         public Profile(User ID_User)
         {
+
             InitializeComponent();
             DataContext = ID_User;
             buffer = ID_User;
             changeuser = ID_User;
             user = ID_User;
+            List<User> usr = Classes.Database.entities.User.ToList();
+
+            User userr = new User()
+            {
+                Surname = txtSurn.Text,
+                Name = txtName.Text,
+                Patronymic = txtPatron.Text,
+                Post = txtPost.Text,
+                Phone_number = txtPhone.Text,
+                Login = txtLog.Text,
+                //Count_complete_app = txtApp.Text,
+                //Count_complete_event = txtEvent.Text,
+            };
+            if (UserRole.userrole == 2)
+            {
+                GBApp.Visibility = Visibility.Visible;
+                GBEvent.Visibility = Visibility.Visible;
+            }
         }
 
+
+
         private void Save_Click(object sender, RoutedEventArgs e)
         {
             List<User> code = Classes.Database.entities.User.ToList();
@@ -69,3 +90,5 @@ namespace PP_Ven_MosS.Pages
         }
     }
 }
+
+