private void NewStudentType() { person = new Student(); Facylty_Box.Visibility = Visibility.Visible; Specialty_Box.Visibility = Visibility.Visible; Group_Box.Visibility = Visibility.Visible; CardNumber_Field.Visibility = Visibility.Visible; var stu = dbl.GiveStudents().OrderByDescending(s => s.CardNumber); string NewStudentCardNumber = new List <Student>(stu)[0].CardNumber; int scn; if (Int32.TryParse(NewStudentCardNumber, out scn)) { NewStudentCardNumber = (scn + 1).ToString(); } else { NewStudentCardNumber = null; } CardNumber_Field.Text = NewStudentCardNumber; Login_Field.Text = NewStudentCardNumber; Passwod_Field.Text = NewStudentCardNumber; }
public StudentsGridPage(DBL d) { InitializeComponent(); dbl = d; Students = new ObservableCollection <Student>(); if (dbl.accounttype == DBL.AccountType.Dean) { foreach (Student s in dbl.GiveStudents()) { if (s.University == dbl.LoggedPerson.University && s.Group.Faculty == ((Dean)dbl.LoggedPerson).Faculty) { Students.Add(s); } } } else if (dbl.accounttype == DBL.AccountType.Teacher) { foreach (Student s in dbl.GiveStudents()) { if (s.University == dbl.LoggedPerson.University) { Students.Add(s); } } AddStudent.Visibility = Visibility.Hidden; RemoveStudent.Visibility = Visibility.Hidden; EditStudent.Visibility = Visibility.Hidden; } else if (dbl.accounttype == DBL.AccountType.Rector) { foreach (Student s in dbl.GiveStudents()) { if (s.University == dbl.LoggedPerson.University) { Students.Add(s); } } } StudentsGrid.ItemsSource = Students; }