static void Main() { StudentGenerator.GenerateStudents(10); var students = StudentGenerator.GetStudents; students = students.OrderByDescending(s => s.Grade) .ToList(); WorkerGenerator.GenerateWorkers(10); var workers = WorkerGenerator.GetWorkers; workers = workers.OrderByDescending(w => w.HourlyWage) .ToList(); var mergedList = new List <Human>(); mergedList = mergedList.Concat(students) .Concat(workers) .OrderBy(x => x.FirstName) .ThenBy(x => x.LastName) .ToList(); foreach (var person in mergedList) { Console.WriteLine("{0} {1}", person.FullName.PadRight(25, '-'), Type.GetType(person.ToString()).Name); } }
public static void InitialSeed(StudentSystemContext context) { StudentGenerator.InitialStudentSeed(context, 5); CourseGenerator.InitialCourseSeed(context, 10); var students = context.Students.ToList(); var courses = context.Courses.ToList(); HomeworkGenerator.InitialHomeworkSeed(context, 30, courses, students); }
public static void RandomSeed(StudentDbContext context) { for (int i = 0; i < 100; i++) { context.Add(StudentGenerator.GenerateStudent()); context.Add(CourseGenerator.GenerateCourse()); context.Add(ResourceGenerator.GenerateResource()); context.SaveChanges(); } }
private static void SeedStudents(StudentSystemContext context, int count) { var studentGenerator = new StudentGenerator(); for (int i = 0; i < count; i++) { context.Students.Add(studentGenerator.NewStudent()); } context.SaveChanges(); }
public static void Main() { var db = new CourseContext(); var generator = new StudentGenerator(db); generator.GenerateStudents(); generator.Separator(); generator.SaveChanges(); generator.Separator(); generator.ShowDb(); ReadKey(); }
public static void Seed(StudentSystemContext context) { Course[] courses = CourseGenerator.CreateCourses(); context.Courses.AddRange(courses); Student[] students = StudentGenerator.CreateStudents(); context.Students.AddRange(students); Resource[] resources = ResourceGenerator.CreateResources(); context.Resources.AddRange(resources); Homework[] homeworks = HomeworkGenerator.CreateHomeworks(); context.HomeworkSubmissions.AddRange(homeworks); StudentCourse[] studentCourses = StudentCourseGenerator.CreateStudentCourses(); context.StudentCourses.AddRange(studentCourses); context.SaveChanges(); Console.WriteLine("Sample data inserted successfully."); }
/// <summary> /// Allows user to add a student. /// </summary> public static void AddStudent(ConsoleUtils instance) { StudentGenerator sg = new StudentGenerator(); Console.WriteLine("Please Enter First Name"); string first = Console.ReadLine(); Console.WriteLine("Please Enter Last Name"); string last = Console.ReadLine(); Console.WriteLine("Please Enter Grade"); int grade = int.Parse(Console.ReadLine()); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"\nAdded Student\n"); Console.ForegroundColor = ConsoleColor.White; Student s = sg.Generate(first, last, grade); Students.StudentsList.Add(s); }
static void Main(string[] args) { var students = StudentGenerator.InitStudents(); // display student has score >=8 in order of birthday Console.WriteLine("students have score >=8 in order of birthday :"); var goodStudents = students.Where(student => student.Score >= 8).OrderBy(student => student.BirthDate); goodStudents.ToList().ForEach(Console.WriteLine); // display student has score between 5 and 7.5 in order of name Console.WriteLine("\n\nstudents have score between 5 and 7.5 in order of name"); var mediumStudents = students.Where(student => student.Score >= 5 && student.Score <= 7.5).OrderBy(student => student.Name); mediumStudents.ToList().ForEach(Console.WriteLine); // display student has score between 6 and 8 Console.WriteLine("\n\nstudents have score between 6 and 8 in order of name birthday year in (1990-1992)"); var nearlyGoodStudents = students.Where(student => student.Score >= 6 && student.Score <= 8 && student.BirthDate.Year >= 1990 && student.BirthDate.Year <= 1992); nearlyGoodStudents.ToList().ForEach(Console.WriteLine); Console.ReadKey(); }
public MainWindow() { InitializeComponent(); DBSetup.MigrateDB(); var writeConnection = $"Data Source=courses.sqlite;foreign keys=true;"; using (var DB = new SQLiteConnection(writeConnection)) { var newStudents = new StudentGenerator(DB); var newCourses = new CourseGenerator(DB); var newAssignments = new AssignmentGenerator(DB); var newCourseStudents = new CourseStudentGenerator(DB); newCourses.Generate(10); newStudents.Generate(10); newAssignments.Generate(10); newCourseStudents.Generate(10); } var students = Student.All(); var courses = Course.All(); var assignments = Assignment.All(); StudentsListBoxView.ItemsSource = students; foreach (var course in courses) { course.CalculateGrades(); } StudentsCourseListView.ItemsSource = courses; AssignmentsListView.ItemsSource = assignments; }
public void GlobalSetup() { Students = StudentGenerator.Generate(NumberOfRows); }
private static void SeedStudents(StudentSystemContext context) { StudentGenerator.InitialStudentsSeed(context); }