Explorar o código

Было добавлено страница со списком исполнителей и функции добавления и уделения и была добавлена страница со списком менеджеров

Ruzal hai 5 meses
pai
achega
7ea09945ff

+ 14 - 0
Esoft/Esoft.csproj

@@ -98,6 +98,9 @@
     <Compile Include="Pages\AddEditPage.xaml.cs">
       <DependentUpon>AddEditPage.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Pages\AddExecutor.xaml.cs">
+      <DependentUpon>AddExecutor.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Pages\Diagram.xaml.cs">
       <DependentUpon>Diagram.xaml</DependentUpon>
     </Compile>
@@ -107,6 +110,9 @@
     <Compile Include="Pages\General.xaml.cs">
       <DependentUpon>General.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Pages\ManagerList.xaml.cs">
+      <DependentUpon>ManagerList.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Status.cs" />
     <Compile Include="Task.cs">
       <DependentUpon>Model1.tt</DependentUpon>
@@ -135,6 +141,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Pages\AddExecutor.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Pages\AddTask.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -155,6 +165,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Pages\ManagerList.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Pages\TaskList.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 56 - 8
Esoft/MainWindow.xaml

@@ -25,10 +25,10 @@
                 <RowDefinition Height="*"/>
             </Grid.RowDefinitions>
             <Button x:Name="btnClose" Style="{DynamicResource PanelButtonX}" Margin="0,10,10,0" Grid.Row="0" Grid.Column="1" Height="35" Width="35" Click="btnClose_Click">
-        
+
             </Button>
             <Button x:Name="btnMinimize" Style="{DynamicResource PanelButtonMin}" Margin="0,10,55,0" Grid.Row="0" Grid.Column="1" Height="35" Width="35" Click="btnMinimize_Click">
-               
+
             </Button>
             <Frame Name="MainFrame" NavigationUIVisibility="Hidden" Grid.Column="1" Grid.Row="1"/>
 
@@ -51,27 +51,75 @@
                         <TextBlock Text="Главная" Style="{StaticResource Text_Style}" FontFamily="Arial Black" Margin="60,0,0,0"/>
                     </Grid>
                 </Button>
-                <Separator Height="20" Background="Transparent"/>
+                <Separator Height="3" Background="Transparent" RenderTransformOrigin="0.5,0.5">
+                    <Separator.RenderTransform>
+                        <TransformGroup>
+                            <ScaleTransform ScaleY="-1"/>
+                            <SkewTransform/>
+                            <RotateTransform/>
+                            <TranslateTransform/>
+                        </TransformGroup>
+                    </Separator.RenderTransform>
+                </Separator>
                 <Button Name="TaskList" Style="{DynamicResource NaviButtons}" Click="TaskList_Click">
                     <Grid Width="280">
                         <TextBlock Text="Задачи" Style="{StaticResource Text_Style}" FontFamily="Arial Black"/>
                         <Image Source="/Resources/TaskList.png" Style="{StaticResource ImageStyle}"/>
                     </Grid>
                 </Button>
-                <Separator Height="20" Background="Transparent"/>
+                <Separator Height="3" Background="Transparent" RenderTransformOrigin="0.5,0.5">
+                    <Separator.RenderTransform>
+                        <TransformGroup>
+                            <ScaleTransform ScaleY="-1"/>
+                            <SkewTransform/>
+                            <RotateTransform/>
+                            <TranslateTransform/>
+                        </TransformGroup>
+                    </Separator.RenderTransform>
+                </Separator>
                 <Button Name="ExecutorList" Style="{DynamicResource NaviButtons}" Click="ExecutorList_Click">
                     <Grid Width="280">
-                    <TextBlock Text="Исполнители" Style="{StaticResource Text_Style}" FontFamily="Arial Black"/>
-                    <Image Source="/Resources/EmployeeList.png" Style="{StaticResource ImageStyle}"/>
+                        <TextBlock Text="Исполнители" Style="{StaticResource Text_Style}" FontFamily="Arial Black"/>
+                        <Image Source="/Resources/EmployeeList.png" Style="{StaticResource ImageStyle}"/>
                     </Grid>
                 </Button>
-                <Separator Height="20" Background="Transparent"/>
+
+                <Separator Height="5" Background="Transparent" RenderTransformOrigin="0.5,0.5">
+                    <Separator.RenderTransform>
+                        <TransformGroup>
+                            <ScaleTransform ScaleY="-1"/>
+                            <SkewTransform/>
+                            <RotateTransform/>
+                            <TranslateTransform/>
+                        </TransformGroup>
+                    </Separator.RenderTransform>
+                </Separator>
                 <Button Name="Chart" Style="{DynamicResource NaviButtons}" Click="Chart_Click">
                     <Grid Width="280">
-                        <TextBlock Text="Графики" Style="{StaticResource Text_Style}" FontFamily="Arial Black"/>
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition Width="13*"/>
+                            <ColumnDefinition Width="27*"/>
+                        </Grid.ColumnDefinitions>
+                        <TextBlock Text="Графики" Style="{StaticResource Text_Style}" FontFamily="Arial Black" Grid.ColumnSpan="2" Margin="60,0,0,0"/>
                         <Image Source="/Resources/Chart.png" Style="{StaticResource ImageStyle}"/>
                     </Grid>
                 </Button>
+                <Separator Height="1" Background="Transparent" RenderTransformOrigin="0.5,0.5">
+                    <Separator.RenderTransform>
+                        <TransformGroup>
+                            <ScaleTransform ScaleY="-1"/>
+                            <SkewTransform/>
+                            <RotateTransform/>
+                            <TranslateTransform/>
+                        </TransformGroup>
+                    </Separator.RenderTransform>
+                </Separator>
+                <Button Name="Mahager" Style="{DynamicResource NaviButtons}" Click="Manager_Click">
+                    <Grid Width="280">
+                        <TextBlock Text="Менеджеры" Style="{StaticResource Text_Style}" FontFamily="Arial Black"/>
+                        <Image Source="/Resources/EmployeeList.png" Style="{StaticResource ImageStyle}"/>
+                    </Grid>
+                </Button>
 
             </StackPanel>
             <StackPanel VerticalAlignment="Bottom" Height="3" Width="250" Margin="0,0,0,100" Background="#2e5d85"/>

+ 4 - 0
Esoft/MainWindow.xaml.cs

@@ -105,6 +105,10 @@ namespace Esoft
         {
             MainFrame.Navigate(new Pages.ExecutorList());
         }
+        private void Manager_Click(object sender, RoutedEventArgs e)
+        {
+            MainFrame.Navigate(new Pages.ManagerList());
+        }
         private void Chart_Click(object sender, RoutedEventArgs e)
         {
             //MainFrame.Navigate(new Pages.Chart());

+ 31 - 0
Esoft/Pages/AddExecutor.xaml

@@ -0,0 +1,31 @@
+<Page x:Class="Esoft.Windows.AddExecutor"
+        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:Esoft.Pages"
+        mc:Ignorable="d"
+        Title="AddExecutor" Height="476" Width="831">
+    <Grid Margin="0,10,0,10" HorizontalAlignment="Center" Width="1109">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="*"/>
+            <RowDefinition Height="Auto"/>
+        </Grid.RowDefinitions>
+
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="172"/>
+            <ColumnDefinition Width="5*"/>
+            <ColumnDefinition Width="61*"/>
+        </Grid.ColumnDefinitions>
+        <TextBlock Text="Исполнитель:" FontSize="25" FontFamily="Comic Sans Ms" Foreground="#52a8ff" HorizontalAlignment="Left" Width="173" Margin="36,18,0,340" Grid.RowSpan="3" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2"/>
+        <TextBox Grid.Row="1" Grid.Column="2" Text="{Binding User.FirstName, UpdateSourceTrigger=PropertyChanged}" x:Name="FirstName" Margin="143,24,388,334" Grid.RowSpan="3"/>
+        <StackPanel Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Left" Margin="31,5,0,5" Grid.Column="1" Width="708" Grid.ColumnSpan="2">
+            <Button x:Name="BtnAddCancel" Content="Назад" Style="{StaticResource AuthoButtons}" Click="BtnCancel_Click"/>
+            <Button x:Name="BtnAddSave" Content="Сохранить" Style="{StaticResource AuthoButtons}" Margin="100,0,0,0" Click="BtnSave_Click"/>
+        </StackPanel>
+
+    </Grid>
+</Page>

+ 60 - 0
Esoft/Pages/AddExecutor.xaml.cs

@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+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;
+
+namespace Esoft.Windows
+{
+    public partial class AddExecutor : Page
+    {
+        private user6Entities _context = new user6Entities();
+        private Task _currentTask = null;
+
+    
+        public AddExecutor()
+        {
+            InitializeComponent();
+            // Здесь можно задать контекст данных, если необходимо
+        }
+
+        private void BtnCancel_Click(object sender, RoutedEventArgs e)
+        {
+            // Логика отмены, например, закрыть окно
+            NavigationService?.GoBack();
+        }
+
+        private void BtnSave_Click(object sender, RoutedEventArgs e)
+        {
+            // Логика сохранения данных
+            // Например, валидация и сохранение объекта User
+            if (ValidateInputs())
+            {
+                // Сохранение данных
+                MessageBox.Show("Исполнитель сохранен.");
+            }
+            else
+            {
+                MessageBox.Show("Пожалуйста, заполните все обязательные поля.");
+                var context = user6Entities.GetContext();
+                context.SaveChanges();
+                NavigationService.GoBack();
+            }
+        }
+
+        private bool ValidateInputs()
+        {
+            // Ваша логика валидации
+            return !string.IsNullOrWhiteSpace(FirstName.Text);
+        }
+    }
+}

+ 8 - 5
Esoft/Pages/ExecutorList.xaml

@@ -14,7 +14,7 @@
             <RowDefinition Height="30"/>
             <RowDefinition Height="*"/>
         </Grid.RowDefinitions>
-        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.RowSpan="2" Width="725">
+        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.RowSpan="3" Width="726" Margin="0,1,0,389">
 
 
             <Separator Background="Transparent" BorderThickness="0" Width="7"/>
@@ -23,23 +23,26 @@
             <Separator Background="Transparent" BorderThickness="0" Width="7"/>
 
             <Separator Background="Transparent" BorderThickness="0" Width="7"/>
+           
 
         </StackPanel>
         <DataGrid RowStyle="{DynamicResource DataGridRowStyle1}" ColumnHeaderStyle="{DynamicResource DataGridColumnHeaderStyle1}" Style="{DynamicResource DataGridStyle1}" Grid.Row="2" x:Name="DGTasks" AutoGenerateColumns="False" IsReadOnly="True" ItemsSource="{Binding}" RenderTransformOrigin="0.5,0.5" Margin="10,0,12,45" Background="#FFDDB3FB">
             <DataGrid.Columns>
-                
+
                 <DataGridTextColumn Header="Исполнители" Binding="{Binding Executor.User.MiddleName}" Width="2000"/>
                 <DataGridTemplateColumn Width="0">
+                    
                     <DataGridTemplateColumn.CellTemplate>
                         <DataTemplate>
-                            
-                            
+
+
                         </DataTemplate>
                     </DataGridTemplateColumn.CellTemplate>
                 </DataGridTemplateColumn>
             </DataGrid.Columns>
         </DataGrid>
-
+        <Button Content="Добавить" Grid.Row="2" Style="{DynamicResource AddDeleteBtn}" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="100,5" Click="BtnAdd_Click" FontFamily="Arial Black"/>
+        <Button Content="Удалить" Name="BtnDelTask" Grid.Row="2" Style="{DynamicResource AddDeleteBtn}"  HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,5" Click="BtnDelTask_Click" FontFamily="Arial Black"/>
     </Grid>
 </Page>
 

+ 34 - 3
Esoft/Pages/ExecutorList.xaml.cs

@@ -1,4 +1,6 @@
-using System;
+using Esoft.Windows;
+using Microsoft.Office.Interop.Word;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -26,7 +28,7 @@ namespace Esoft.Pages
         {
             InitializeComponent();
 
-  
+           
             //CmbExecutorSort.ItemsSource = user6Entities.GetContext().Executor.ToList();
 
 
@@ -39,7 +41,36 @@ namespace Esoft.Pages
             //CmbExecutorSort.ItemsSource = listUsers;
 
         }
+
+        private void BtnAdd_Click(object sender, RoutedEventArgs e)
+        {
+            NavigationService.Navigate(new AddExecutor());
+        }
+
+        private void BtnEdit_Click(object sender, RoutedEventArgs e)
+        {
+            NavigationService.Navigate(new AddExecutor());
+        }
+
+        private void BtnDelTask_Click(object sender, RoutedEventArgs e)
+        {
+            var taskIsForRemoving = DGTasks.SelectedItems.Cast<Task>().ToList();
+            if (MessageBox.Show($"Вы точно хотите удалить иполнителя?",
+                "Внимание", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
+            {
+                try
+                {
+                    user6Entities.GetContext().Task.RemoveRange(taskIsForRemoving);
+                    user6Entities.GetContext().SaveChanges();
+                    MessageBox.Show("Данные удалены");
+                    DGTasks.ItemsSource = user6Entities.GetContext().Task.ToList();
+                }
+                catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }
+            }
+        }
+    
+        }
+        
     }
-}
 
 

+ 32 - 0
Esoft/Pages/ManagerList.xaml

@@ -0,0 +1,32 @@
+<Page x:Class="Esoft.Pages.ManagerList"
+      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:Esoft.Pages"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="ManagerList">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="30"/>
+            <RowDefinition Height="30"/>
+            <RowDefinition Height="*"/>
+        </Grid.RowDefinitions>
+        <DataGrid RowStyle="{DynamicResource DataGridRowStyle1}" ColumnHeaderStyle="{DynamicResource DataGridColumnHeaderStyle1}" Style="{DynamicResource DataGridStyle1}" Grid.Row="2" x:Name="DGTasks" AutoGenerateColumns="False" IsReadOnly="True" ItemsSource="{Binding}" RenderTransformOrigin="0.5,0.5" Margin="10,0,12,45" Background="#FFDDB3FB">
+            <DataGrid.Columns>
+                <DataGridTextColumn Header="Менеджеры" Width="2000" Binding="{Binding Executor.Manager.User.MiddleName}"/>
+                <DataGridTemplateColumn Width="auto">
+                    <DataGridTemplateColumn.CellTemplate>
+                        <DataTemplate>
+                            
+              
+                           
+                        </DataTemplate>
+                    </DataGridTemplateColumn.CellTemplate>
+                </DataGridTemplateColumn>
+            </DataGrid.Columns>
+        </DataGrid>
+
+    </Grid>
+</Page>

+ 41 - 0
Esoft/Pages/ManagerList.xaml.cs

@@ -0,0 +1,41 @@
+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 Esoft.Pages
+{
+    /// <summary>
+    /// Логика взаимодействия для ManagerList.xaml
+    /// </summary>
+    public partial class ManagerList : Page
+    {
+        public ManagerList()
+        {
+            InitializeComponent();
+
+
+            //CmbExecutorSort.ItemsSource = user6Entities.GetContext().Executor.ToList();
+
+
+            DGTasks.ItemsSource = user6Entities.GetContext().Task.ToList();
+
+            //foreach (var user in _context.User.ToList())
+            //{
+            //    listUsers.Add(user.getFamilia());
+            //}
+            //CmbExecutorSort.ItemsSource = listUsers;
+
+        }
+    }
+}