private async Task RefreshStudentsDataGride() { var studentViewSource = (CollectionViewSource)FindResource("studentViewSource"); studentViewSource.Source = await StudentOperations.StudentsToListAsync(); }
private bool DeleteStudent(string pesel) { try { StudentOperations.DeleteStudentWithPesel(pesel); return(true); } catch (Exception) { return(false); } }
private void FormRent_Load(object sender, EventArgs e) { rentOpr = new RentOperations(); bookOpr = new BookOperations(); stdOpr = new StudentOperations(); string[] key = { "Book Name", "Author", "Type", "Number" }; cb_c_type.Items.AddRange(key); cb_r_type.Items.AddRange(key); }
public Student(long id, string surname, string name, string patronymic, DateTime dob, DateTime enterDate, string groupIndex, string faculty, string specialty, int academicPerformance) { Id = id; Surname = surname; Name = name; Patronymic = patronymic; DateOfBirth = dob; EnterDate = enterDate; GroupIndex = groupIndex; Faculty = faculty; Specialty = specialty; AcademicPerformance = academicPerformance; Age = StudentOperations.GetStudentAge(DateOfBirth); Group = StudentOperations.GetStudentGroup(Faculty, GroupIndex); CourseAndSemester = StudentOperations.GetCourseAndSemester(EnterDate); }
private static void StudentAgeOperation() { var maleBirthDate = "17.03.1992"; var femaleBirthDate = "03.11.1993"; Student maleStudent = new Student("Peter", "Ivanov"); maleStudent.AddBirthdayDate(maleBirthDate); Student femaleStudent = new Student("Stella", "Markova"); femaleStudent.AddBirthdayDate(femaleBirthDate); var olderStudent = StudentOperations.GetOlderStudent(maleStudent, femaleStudent); ConsoleWriter.Write($"The older from {maleStudent.FirstName} and {femaleStudent.FirstName} is {olderStudent.FirstName}"); }
private void BTNAdd_Click(object sender, RoutedEventArgs e) { if (TXTBPesel.Text.Length < 11) { MessageBox.Show("Podaj poprawny PESEL!", "Libary System", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (TXTBName.Text == string.Empty) { MessageBox.Show("Podaj Imie!", "Libary System", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (TXTBSurname.Text == string.Empty) { MessageBox.Show("Podaj Nazwisko!", "Libary System", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (TXTBClass.Text == string.Empty) { MessageBox.Show("Podaj klase do jakiej chodzi uczen!", "Libary System", MessageBoxButton.OK, MessageBoxImage.Error); return; } var student = new Student(TXTBPesel.Text, TXTBName.Text, TXTBSurname.Text, TXTBClass.Text, TXTBSecoundName.Text); try { StudentOperations.AddStudent(student); MessageBox.Show("Uczen zostal dodany poprawnie!", "Libary System", MessageBoxButton.OK, MessageBoxImage.Information); TXTBPesel.Text = string.Empty; TXTBName.Text = string.Empty; TXTBSurname.Text = string.Empty; TXTBClass.Text = string.Empty; TXTBSecoundName.Text = string.Empty; } catch (Exception exception) { MessageBox.Show(exception.Message, "Libary System", MessageBoxButton.OK, MessageBoxImage.Error); throw exception; } }
private void BTNDelete_Click(object sender, RoutedEventArgs e) { if (TXTBPesel.Text.Length < 11) { MessageBox.Show("Podaj poprawny PESEL!", "Libary System", MessageBoxButton.OK, MessageBoxImage.Error); return; } try { StudentOperations.DeleteStudentWithPesel(TXTBPesel.Text); MessageBox.Show("Uczen zostal poprawnie usuniety!", "Libary System", MessageBoxButton.OK, MessageBoxImage.Information); TXTBPesel.Text = string.Empty; } catch (NullReferenceException exception) { MessageBox.Show(exception.Message, "Libary System", MessageBoxButton.OK, MessageBoxImage.Error); } catch (Exception exception) { MessageBox.Show(exception.Message, "Libary System", MessageBoxButton.OK, MessageBoxImage.Error); throw new Exception(); } }
public void AddAndDeleteStudentTest() { using (var context = new DbContext()) { var student = new Student("00000000000", "test", "test", "testclass"); StudentOperations.AddStudent(student); var studentInDb = context.Students.Find(student.PESEL); if (studentInDb == null) { throw new NullReferenceException("No student in Db"); } Assert.AreEqual(student.PESEL, studentInDb.PESEL); Assert.AreEqual(student.Name, studentInDb.Name); Assert.AreEqual(student.SecondName, studentInDb.SecondName); Assert.AreEqual(student.Surname, studentInDb.Surname); Assert.AreEqual(student.Class, studentInDb.Class); Assert.IsTrue(DeleteStudent(student.PESEL)); } }
/// <summary> /// Выполнение операций по рабработе со студентами и группами. /// </summary> private void PerformOperations() { switch ((Actions)_chosedActions) { case Actions.Add: StudentOperations.AddStudent(_inputStudentData, GroupOperations.GetFoundedGroup()); isAbleToBack = true; break; case Actions.Print: StudentOperations.PrintStudents(GroupOperations.GetFoundedGroup()); isAbleToBack = true; break; case Actions.Remove: StudentOperations.RemoveStudent(_singleInput, GroupOperations.GetFoundedGroup()); isAbleToBack = true; break; case Actions.Sort: StudentOperations.SortStudents(GroupOperations.GetFoundedGroup()); isAbleToBack = true; break; case Actions.Find: Console.WriteLine("Не работает такое!"); isAbleToBack = true; break; case Actions.Quit: _menu.CallMenu(); break; default: Console.WriteLine("Опять ты брешишь..."); isAbleToBack = false; break; } }
public StudentsController(StudentManagement context) { studentOperations = new StudentOperations(context); }
public ActionResult StudentGrades(int courseId, int userId) { var course = StudentOperations.GetStudentCourse(userId, courseId); return(View(course)); }