public void CopyTestStudents() { foreach (Student student in getAllStudents()) { context.Students.Add(student); } context.SaveChanges(); }
private void SaveStudentsInTable(StudentInfoContext context) { foreach (Student st in StudentData.DefaultStudents) { context.Students.Add(st); } context.SaveChanges(); }
private void SaveUsersInTable(StudentInfoContext context) { foreach (User user in UserData.TestUsers) { context.Users.Add(user); } context.SaveChanges(); }
void CopyTestUsers() { StudentInfoContext context = new StudentInfoContext(); foreach (User u in UserData.TestUsers) { context.Users.Add(u); } context.SaveChanges(); }
public static void insertIntoStudentAndGrades() { StudentInfoContext context = new StudentInfoContext(); foreach (Student student in getAllStudents(context)) { context.Students.Add(student); } context.SaveChanges(); }
void CopyTestStudents() { StudentInfoContext context = new StudentInfoContext(); foreach (Student st in StudentData.TestStudents) { context.Students.Add(st); } context.SaveChanges(); }
public void CopyTestStudents() { // StudentInfoContext context = new StudentInfoContext(); foreach (Student st in TestStudents) { context.Students.Add(st); } context.SaveChanges(); if (TestStudentsIfEmpty()) { CopyTestStudents(); } }
public static void CopyTestStudents() { StudentInfoContext context = new StudentInfoContext(); foreach (Student us in TestStudents) { context.Students.Add(us); } context.SaveChanges(); }
public static void resetStudents() { students = new List <Student>(); students.Add(new Student("Pastrashko", "Magarokov", "Georgiev", "FKST", "KSI", "bachelor", "polojitelen", "121214666", 2, 9, 45)); students.Add(new Student("Kiro", "Gavrailov", "Dondukov", "FPMI", "MI", "bachelor", "prekusnal", "0112874", 1, 9, 7)); students.Add(new Student("Tomas", "Zlatanov", "Biolojkov", "FKST", "ITI", "bachelor", "deistvasht", "503118001", 2, 9, 50)); foreach (Student student in students) { studentInfoContext.Students.Add(student); } studentInfoContext.SaveChanges(); }
private void InsertSpecializationExamples() { string[] specializations = { "Computer science", "Engineering", "Driver", "Chef", "Manager" }; StudentInfoContext context = new StudentInfoContext(); int i = 1; foreach (string specialization in specializations) { context.Specializations.Add(new Specialization(i, specialization)); i++; } context.SaveChanges(); }
private void OnClick_Save(object sender, RoutedEventArgs e) { try { StudentInfoContext context = new StudentInfoContext(); DbSet <User> usersTable = context.Users; string username = txtUsername.Text; if (DatabaseUtils.IsUserPresent(username)) { throw new Exception("Потребител с това потребителско име вече съществува!"); } string password = boxPassword.Password; string role = boxRole.Text; usersTable.Add(new User(username, password, role, DateTime.Now, DateTime.Now.AddYears(1))); if (UserRoles.STUDENT.Equals(role)) { string name = txtName.Text; string surname = txtSurname.Text; string lastName = txtLastName.Text; string faculty = boxFaculty.Text; string specialty = boxSpecialty.Text; string degree = boxDegree.Text; string status = boxStatus.Text; string facultyNumber = txtFacultyNumber.Text; int course = int.Parse(txtCourse.Text); int flow = int.Parse(txtFlow.Text); int group = int.Parse(txtGroup.Text); context.Students.Add(new Student(name, surname, lastName, faculty, specialty, degree, status, facultyNumber, course, flow, group)); } context.SaveChanges(); MessageBox.Show("Записано успешно!"); ResetInputControls(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void addSpecialization_Click(object sender, RoutedEventArgs e) { string specializationText = this.specializationBox.Text; clearListBox(); if (specializationText == "") { GetSpecializations(); return; } Specialization newSpec = new Specialization(specializationText); context.Specializations.Add(newSpec); context.SaveChanges(); this.specializationBox.Clear(); clearListBox(); GetSpecializations(); }