Пример #1
0
        private void profileButton_Click(object sender, RoutedEventArgs e)
        {
            Button selectedButton = sender as Button;

            Core.Students activeStudent = (Core.Students)selectedButton.DataContext;
            //this.NavigationService.Navigate(new ProfilePage(context, activeStudent));
        }
Пример #2
0
 private void DeleteBtn_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Core.Students students = (Core.Students)DeleteDataGrid.Items[DeleteDataGrid.SelectedIndex];
         context.Students.Remove(students);
         context.SaveChanges();
     }
     catch
     {
         MessageBox.Show("Критический сбор в работе приложения:", "Уведомление", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
Пример #3
0
        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string[] name = NameStudentBox.Text.Split(' ');


                int NameProfession = Convert.ToInt32(Professions_List.SelectedValue);


                int Year = Convert.ToInt32(YearAddList.SelectedValue);


                int Name = Convert.ToInt32(FormTimeList.SelectedValue);


                int NameGroup = Convert.ToInt32(GroupsList.SelectedValue);

                string        str      = String.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}", name[0], name[1], name[2], NameProfession, Name, NameGroup, Year);
                Core.Students students = new Core.Students()
                {
                    FiestName      = name[0],
                    LastName       = name[1],
                    PatronomicName = name[2],
                    IdProfession   = NameProfession,
                    IdFormTime     = Name,
                    IdGroup        = NameGroup,
                    IdYearAdd      = Year
                };

                context.Students.Add(students);
                context.SaveChanges();
            }
            catch
            {
                MessageBox.Show("Критический сбор в работе приложения:", "Уведомление", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }