Example #1
0
        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int Group   = Convert.ToInt32(GroupList.SelectedValue);
                int Student = Convert.ToInt32(StudentList.SelectedValue);
                int Subject = Convert.ToInt32(SubjectsList.SelectedValue);
                int Rating  = Convert.ToInt32(RatingTextBox.Text);

                Core.Journals journals = new Core.Journals()
                {
                    IdStudent  = Student,
                    IdGroup    = Group,
                    IdSubject  = Subject,
                    Evaluation = Rating
                };


                context.Journals.Add(journals);
                context.SaveChanges();
            }
            catch
            {
                MessageBox.Show("Критический сбор в работе приложения:", "Уведомление", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Example #2
0
 private void AccessButton_click(object sender, RoutedEventArgs e)
 {
     try
     {
         int a = context.Users.Where(x => x.Login == LoginTextBox.Text).Count();
         if (a == 0)
         {
             if (PasswordTextBox.Password == RePasswordTextBox.Password)
             {
                 Core.Users user = new Core.Users()
                 {
                     Login    = LoginTextBox.Text,
                     Password = PasswordTextBox.Password
                 };
                 //context.users.Add(new Core.users
                 //{
                 //    login = LoginTextBox.Text,
                 //    password = PasswordTextBox.Password
                 //});
                 context.Users.Add(user);
                 context.SaveChanges();
                 this.NavigationService.Navigate(new LoginPage());
             }
         }
     }
     catch
     {
         MessageBox.Show("Критический сбор в работе приложения:", "Уведомление", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
Example #3
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);
     }
 }
        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);
            }
        }