瀏覽代碼

10.03 Student

gr672_bda 4 年之前
父節點
當前提交
44cad1a333

+ 3 - 1
ProjectAnalogParus/BookerPage.xaml

@@ -9,6 +9,8 @@
       Title="Страница бухгалтера">
 
     <Grid>
-        
+        <Button Content="Сотрудник" HorizontalAlignment="Left" Margin="120,69,0,0" VerticalAlignment="Top" Width="75" Click="EmployeeOpenPage"/>
+        <Button Content="Студент" HorizontalAlignment="Left" Margin="239,69,0,0" VerticalAlignment="Top" Width="75" Click="StudentOpenPage"/>
+
     </Grid>
 </Page>

+ 10 - 0
ProjectAnalogParus/BookerPage.xaml.cs

@@ -24,5 +24,15 @@ namespace ProjectAnalogParus
         {
             InitializeComponent();
         }
+
+        private void EmployeeOpenPage(object sender, RoutedEventArgs e)
+        {
+            FramePage.MainFrame.Navigate(new EmployeePage());
+        }
+
+        private void StudentOpenPage(object sender, RoutedEventArgs e)
+        {
+            FramePage.MainFrame.Navigate(new StudentPage());
+        }
     }
 }

+ 15 - 0
ProjectAnalogParus/DeleteEncouragementWindow.xaml

@@ -0,0 +1,15 @@
+<Window x:Class="ProjectAnalogParus.DeleteEncouragementWindow"
+        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:ProjectAnalogParus"
+        mc:Ignorable="d"
+        Title="DeleteEncouragementWindow" Height="450" Width="800">
+    <Grid>
+        <ComboBox Name="cmbEncouragement" HorizontalAlignment="Left" Margin="357,126,0,0" VerticalAlignment="Top" Width="120"/>
+        <Button Content="Удалить" HorizontalAlignment="Left" Margin="134,229,0,0" VerticalAlignment="Top" Width="75" Click="DeleteClick"/>
+        <Button Content="Отмена" HorizontalAlignment="Left" Margin="308,229,0,0" VerticalAlignment="Top" Width="75" Click="CancelClick"/>
+
+    </Grid>
+</Window>

+ 48 - 0
ProjectAnalogParus/DeleteEncouragementWindow.xaml.cs

@@ -0,0 +1,48 @@
+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.Shapes;
+
+namespace ProjectAnalogParus
+{
+    /// <summary>
+    /// Логика взаимодействия для DeleteEncouragementWindow.xaml
+    /// </summary>
+    public partial class DeleteEncouragementWindow : Window
+    {
+        public DeleteEncouragementWindow()
+        {
+            InitializeComponent();
+            gr672_bdaEntities db = new gr672_bdaEntities();
+            cmbEncouragement.ItemsSource = db.TypeEncouragement.ToList();
+            cmbEncouragement.DisplayMemberPath = "NameTypeEncouragement";
+            cmbEncouragement.SelectedValuePath = "IdTypeEncouragement"; 
+        }
+
+        private void DeleteClick(object sender, RoutedEventArgs e)
+        {
+            gr672_bdaEntities db = new gr672_bdaEntities();
+            int num = Convert.ToInt32(cmbEncouragement.SelectedValue.ToString());
+            var dRow = db.Encouragement.Where(w => w.IdEncouragement == num).FirstOrDefault();
+            var bRow = db.TypeEncouragement.Where(w => w.IdTypeEncouragement == num).FirstOrDefault();
+            db.Encouragement.Remove(dRow);
+            db.TypeEncouragement.Remove(bRow);
+            db.SaveChanges();
+            
+        }
+
+        private void CancelClick(object sender, RoutedEventArgs e)
+        {
+            this.Close();
+        }
+    }
+}

+ 14 - 0
ProjectAnalogParus/EmployeePage.xaml

@@ -0,0 +1,14 @@
+<Page x:Class="ProjectAnalogParus.EmployeePage"
+      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:ProjectAnalogParus"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="EmployeePage">
+
+    <Grid>
+        
+    </Grid>
+</Page>

+ 28 - 0
ProjectAnalogParus/EmployeePage.xaml.cs

@@ -0,0 +1,28 @@
+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 ProjectAnalogParus
+{
+    /// <summary>
+    /// Логика взаимодействия для EmployeePage.xaml
+    /// </summary>
+    public partial class EmployeePage : Page
+    {
+        public EmployeePage()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 24 - 0
ProjectAnalogParus/EncouragementPage.xaml

@@ -0,0 +1,24 @@
+<Page x:Class="ProjectAnalogParus.EncouragementPage"
+      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:ProjectAnalogParus"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="EncouragementPage" Loaded="LoadedWindows">
+
+    <Grid>
+        <DataGrid Name="Encouragementgrid" HorizontalAlignment="Left" AutoGenerateColumns="False" Height="150" Margin="10,10,0,0" VerticalAlignment="Top" Width="780" >
+
+            <DataGrid.Columns>
+                <DataGridTextColumn Binding="{Binding IdEncouragement}" Header="Id" Width="*"/>
+                <DataGridTextColumn Binding="{Binding TypeEncouragement.NameTypeEncouragement}" Header="Поощрение" Width="3*"/>
+                <DataGridTextColumn Binding="{Binding Amount}" Header="Сумма" Width="3*" />                
+            </DataGrid.Columns>
+        </DataGrid>
+        <Button Content="Добавить поощрение" HorizontalAlignment="Left" Margin="73,344,0,0" VerticalAlignment="Top" Width="134" Click="InsertEncouragementClick"/>
+        <Button Content="Изменить поощрение" HorizontalAlignment="Left" Margin="236,344,0,0" VerticalAlignment="Top" Width="137" Click="UpdateEncouragementClick"/>
+        <Button Content="Удалить поощрение" HorizontalAlignment="Left" Margin="403,344,0,0" VerticalAlignment="Top" Width="145" Click="DeleteEncouragementClick"/>
+    </Grid>
+</Page>

+ 53 - 0
ProjectAnalogParus/EncouragementPage.xaml.cs

@@ -0,0 +1,53 @@
+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 ProjectAnalogParus
+{
+    /// <summary>
+    /// Логика взаимодействия для EncouragementPage.xaml
+    /// </summary>
+    public partial class EncouragementPage : Page
+    {
+        public EncouragementPage()
+        {
+            InitializeComponent();
+            gr672_bdaEntities db = new gr672_bdaEntities();
+        }
+        private void LoadedWindows(object sender, RoutedEventArgs e)
+        {
+            gr672_bdaEntities db = new gr672_bdaEntities();
+            Encouragementgrid.ItemsSource = db.Encouragement.ToList();
+
+        }
+
+        private void InsertEncouragementClick(object sender, RoutedEventArgs e)
+        {
+            InsertEncouragementWindow openwin = new InsertEncouragementWindow();
+            openwin.Show();
+
+        }
+
+        private void UpdateEncouragementClick(object sender, RoutedEventArgs e)
+        {
+
+        }
+
+        private void DeleteEncouragementClick(object sender, RoutedEventArgs e)
+        {
+            DeleteEncouragementWindow openwin = new DeleteEncouragementWindow();
+            openwin.Show();
+        }
+    }
+}

+ 16 - 0
ProjectAnalogParus/InsertEncouragementWindow.xaml

@@ -0,0 +1,16 @@
+<Window x:Class="ProjectAnalogParus.InsertEncouragementWindow"
+        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:ProjectAnalogParus"
+        mc:Ignorable="d"
+        Title="InsertEncouragementWindow" Height="450" Width="800">
+    <Grid>
+        <TextBox Name="txtNameEncouragement" HorizontalAlignment="Left" Height="23" Margin="319,93,0,0" TextWrapping="Wrap"  VerticalAlignment="Top" Width="120"/>
+        <TextBox Name="txtAmount" HorizontalAlignment="Left" Height="23" Margin="319,141,0,0" TextWrapping="Wrap"  VerticalAlignment="Top" Width="120"/>
+        <Button Content="Добавить" HorizontalAlignment="Left" Margin="287,247,0,0" VerticalAlignment="Top" Width="75" Click="InsertClick"/>
+        <Button Content="Отмена" HorizontalAlignment="Left" Margin="399,247,0,0" VerticalAlignment="Top" Width="75" Click="CancelClick"/>
+
+    </Grid>
+</Window>

+ 45 - 0
ProjectAnalogParus/InsertEncouragementWindow.xaml.cs

@@ -0,0 +1,45 @@
+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.Shapes;
+
+namespace ProjectAnalogParus
+{
+    /// <summary>
+    /// Логика взаимодействия для InsertEncouragementWindow.xaml
+    /// </summary>
+    public partial class InsertEncouragementWindow : Window
+    {
+        public InsertEncouragementWindow()
+        {
+            InitializeComponent();
+            gr672_bdaEntities db = new gr672_bdaEntities();
+        }
+
+        private void InsertClick(object sender, RoutedEventArgs e)
+        {
+            gr672_bdaEntities db = new gr672_bdaEntities();
+            Encouragement encouragement = new Encouragement();
+            TypeEncouragement NameEncouragement = new TypeEncouragement();
+            encouragement.Amount = Convert.ToDecimal(txtAmount.Text);
+            NameEncouragement.NameTypeEncouragement = txtNameEncouragement.Text;
+            db.TypeEncouragement.Add(NameEncouragement);
+            db.Encouragement.Add(encouragement);
+            db.SaveChanges();           
+        }
+
+        private void CancelClick(object sender, RoutedEventArgs e)
+        {
+            this.Close();
+        }
+    }
+}

+ 27 - 0
ProjectAnalogParus/ListStudentPage.xaml

@@ -0,0 +1,27 @@
+<Page x:Class="ProjectAnalogParus.ListStudentPage"
+      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:ProjectAnalogParus"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="ListStudentPage" Loaded="LoadedWindows">
+
+    <Grid>
+        <DataGrid Name="Studentgrid" HorizontalAlignment="Left" AutoGenerateColumns="False" Height="150" Margin="10,10,0,0" VerticalAlignment="Top" Width="780" >
+
+            <DataGrid.Columns>
+                <DataGridTextColumn Binding="{Binding IdStudent}" Header="Id" Width="*"/>
+                <DataGridTextColumn Binding="{Binding LastName}" Header="Фамилия" Width="3*"/>
+                <DataGridTextColumn Binding="{Binding FirstName}" Header="Имя" Width="3*" />
+                <DataGridTextColumn Binding="{Binding Middlename}" Header="Отчество" Width="3*" />
+                <DataGridTextColumn Binding="{Binding Group.NumberGroup}" Header="Группа" Width="2*" />
+                <DataGridTextColumn Binding="{Binding Group.Specialty.NameSpecialty}" Header="Специальность" Width="6*" />
+                <DataGridTextColumn Binding="{Binding Group.Course}" Header="Курс" Width="1*" />
+            </DataGrid.Columns>
+
+        </DataGrid>
+        <Button Content="Создать отчет" HorizontalAlignment="Left" Margin="103,277,0,0" VerticalAlignment="Top" Width="116" Click="CreateListStudent"/>
+    </Grid>
+</Page>

+ 40 - 0
ProjectAnalogParus/ListStudentPage.xaml.cs

@@ -0,0 +1,40 @@
+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 ProjectAnalogParus
+{
+    /// <summary>
+    /// Логика взаимодействия для ListStudentPage.xaml
+    /// </summary>
+    public partial class ListStudentPage : Page
+    {
+        public ListStudentPage()
+        {
+            InitializeComponent();
+            gr672_bdaEntities db = new gr672_bdaEntities();
+        }
+        private void LoadedWindows(object sender, RoutedEventArgs e)
+        {
+            gr672_bdaEntities db = new gr672_bdaEntities();
+            Studentgrid.ItemsSource = db.Student.ToList();          
+
+        }
+
+        private void CreateListStudent(object sender, RoutedEventArgs e)
+        {
+
+        }
+    }
+}

+ 42 - 0
ProjectAnalogParus/ProjectAnalogParus.csproj

@@ -106,6 +106,9 @@
     <Compile Include="CompositionExperience.cs">
       <DependentUpon>Model.tt</DependentUpon>
     </Compile>
+    <Compile Include="DeleteEncouragementWindow.xaml.cs">
+      <DependentUpon>DeleteEncouragementWindow.xaml</DependentUpon>
+    </Compile>
     <Compile Include="DimensionCoefficient.cs">
       <DependentUpon>Model.tt</DependentUpon>
     </Compile>
@@ -115,9 +118,15 @@
     <Compile Include="Employee.cs">
       <DependentUpon>Model.tt</DependentUpon>
     </Compile>
+    <Compile Include="EmployeePage.xaml.cs">
+      <DependentUpon>EmployeePage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Encouragement.cs">
       <DependentUpon>Model.tt</DependentUpon>
     </Compile>
+    <Compile Include="EncouragementPage.xaml.cs">
+      <DependentUpon>EncouragementPage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Experience.cs">
       <DependentUpon>Model.tt</DependentUpon>
     </Compile>
@@ -133,9 +142,15 @@
     <Compile Include="Hirer.cs">
       <DependentUpon>Model.tt</DependentUpon>
     </Compile>
+    <Compile Include="InsertEncouragementWindow.xaml.cs">
+      <DependentUpon>InsertEncouragementWindow.xaml</DependentUpon>
+    </Compile>
     <Compile Include="InsertUserWindow.xaml.cs">
       <DependentUpon>InsertUserWindow.xaml</DependentUpon>
     </Compile>
+    <Compile Include="ListStudentPage.xaml.cs">
+      <DependentUpon>ListStudentPage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Model.cs">
       <AutoGen>True</AutoGen>
       <DesignTime>True</DesignTime>
@@ -171,6 +186,9 @@
     <Compile Include="Student.cs">
       <DependentUpon>Model.tt</DependentUpon>
     </Compile>
+    <Compile Include="StudentPage.xaml.cs">
+      <DependentUpon>StudentPage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Subdivision.cs">
       <DependentUpon>Model.tt</DependentUpon>
     </Compile>
@@ -207,10 +225,30 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="DeleteEncouragementWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="EmployeePage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="EncouragementPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="InsertEncouragementWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="InsertUserWindow.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="ListStudentPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -227,6 +265,10 @@
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
+    <Page Include="StudentPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Model.Context.cs">

+ 18 - 0
ProjectAnalogParus/StudentPage.xaml

@@ -0,0 +1,18 @@
+<Page x:Class="ProjectAnalogParus.StudentPage"
+      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:ProjectAnalogParus"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="StudentPage">
+
+    <Grid>
+        <Button Content="Список студентов" HorizontalAlignment="Left" Margin="55,44,0,0" VerticalAlignment="Top" Width="114" Height="22" Click="OpenListStudent"/>
+        <Button Content="Расчет стипендии" HorizontalAlignment="Left" Margin="212,44,0,0" VerticalAlignment="Top" Width="128" Height="22"/>
+        <Button Content="Начисление стипендии" HorizontalAlignment="Left" Margin="381,44,0,0" VerticalAlignment="Top" Width="147" Height="22"/>
+        <Button Content="Поощрения" HorizontalAlignment="Left" Margin="55,117,0,0" VerticalAlignment="Top" Width="75" Click="OpenEncouragementPage"/>
+
+    </Grid>
+</Page>

+ 38 - 0
ProjectAnalogParus/StudentPage.xaml.cs

@@ -0,0 +1,38 @@
+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 ProjectAnalogParus
+{
+    /// <summary>
+    /// Логика взаимодействия для StudentPage.xaml
+    /// </summary>
+    public partial class StudentPage : Page
+    {
+        public StudentPage()
+        {
+            InitializeComponent();
+        }
+
+        private void OpenListStudent(object sender, RoutedEventArgs e)
+        {
+            FramePage.MainFrame.Navigate(new ListStudentPage());
+        }
+
+        private void OpenEncouragementPage(object sender, RoutedEventArgs e)
+        {
+            FramePage.MainFrame.Navigate(new EncouragementPage());
+        }
+    }
+}