Esempio n. 1
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DbStudentRepository" /> class.
 /// </summary>
 public DbStudentRepository(Lab10DbContext context)
 {
     _db = context;
 }
Esempio n. 2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DbCourseRepository" /> class.
 /// </summary>
 public DbCourseRepository(Lab10DbContext context)
 {
     _db = context;
 }
 public DbCourseOfferingRepository(Lab10DbContext context)
 {
     _db = context;
 }
Esempio n. 4
0
        /// <summary>
        ///     Seed the Database with Courses, A default user, and roles
        ///     User and Role Seeding:
        ///     http://stackoverflow.com/questions/29526215/seed-entities-and-users-roles
        /// </summary>
        /// <param name="context">The context.</param>
        public static void Seed(Lab10DbContext context)
        {
            // If No users exist
            if (!context.Users.Any())
            {
                // Wire up Roles services
                var roleStore = new RoleStore<IdentityRole>(context);
                var roleManager = new RoleManager<IdentityRole>(roleStore);

                // Add Roles
                if (roleManager.FindByName(UserRoles.Coordinator) == null)
                    roleManager.Create(new IdentityRole(UserRoles.Coordinator));
                if (roleManager.FindByName(UserRoles.DepartmentChair) == null)
                    roleManager.Create(new IdentityRole(UserRoles.DepartmentChair));
                if (roleManager.FindByName(UserRoles.Instructor) == null)
                    roleManager.Create(new IdentityRole(UserRoles.Instructor));

                // Wire up user services
                var userStore = new UserStore<ApplicationUser>(context);
                var userManager = new UserManager<ApplicationUser>(userStore);

                // Set up the default password
                var password = "******";
                var hashedPassword = new PasswordHasher().HashPassword(password);

                if (userManager.FindByEmail("*****@*****.**") == null)
                {
                    var user = AddUser("WeiGong", "*****@*****.**", hashedPassword);
                    userManager.Create(user, password);
                    userManager.AddToRole(user.Id, UserRoles.Instructor);
                }

                if (userManager.FindByEmail("*****@*****.**") == null)
                {
                    var user = AddUser("JaneDoe", "*****@*****.**", hashedPassword);
                    userManager.Create(user, password);
                    userManager.AddToRole(user.Id, UserRoles.Instructor);
                }

                if (userManager.FindByEmail("*****@*****.**") == null)
                {
                    var user = AddUser("JohnSmith", "*****@*****.**", hashedPassword);
                    userManager.Create(user, password);
                    userManager.AddToRole(user.Id, UserRoles.Coordinator);
                }

                if (userManager.FindByEmail("*****@*****.**") == null)
                {
                    var user = AddUser("DavidJones", "*****@*****.**", hashedPassword);
                    userManager.Create(user, password);
                    userManager.AddToRole(user.Id, UserRoles.Coordinator);
                    userManager.AddToRole(user.Id, UserRoles.Instructor);
                }

                if (userManager.FindByEmail("*****@*****.**") == null)
                {
                    var user = AddUser("MaryRobinson", "*****@*****.**", hashedPassword);
                    userManager.Create(user, password);
                    userManager.SetLockoutEnabled(user.Id, false);
                    userManager.AddToRole(user.Id, UserRoles.DepartmentChair);
                }
            }

            // Seed the course Information
            context.Courses.AddOrUpdate(c => c.CourseNumber,
                new Course
                {
                    CourseNumber = "ICT0001",
                    CourseName = "Web Programming",
                    CourseDescription =
                        "Students learn how to manage their laptop environment to gain the best advantage during their college program and later in the workplace. Create backups, install virus protection, manage files through a basic understanding of the Windows Operating System, install and configure the Windows Operating System, install and manage a virtual machine environment. Explore computer architecture including the functional hardware and software components that are needed to run programs. Finally, study basic numerical systems and operations including Boolean logic.",
                    WeeklyHours = 4
                },
                new Course
                {
                    CourseNumber = "ICT0002",
                    CourseName = "Introduction to Computer Programming",
                    CourseDescription =
                        "Learn the fundamental problem-solving methodologies needed in software development, such as structured analysis, structured design, structured programming and introduction to object-oriented programming. Use pseudocode, flowcharting, as well as a programming language to develop solutions to real-world problems of increasing complexity. The basics of robust computer programming, with emphasis on correctness, structure, style and documentation are learned using Java. Theory is reinforced with application by means of practical laboratory assignments.",
                    WeeklyHours = 6
                },
                new Course
                {
                    CourseNumber = "ICT0003",
                    CourseName = "Web Programming I",
                    CourseDescription =
                        "Students learn to develop websites with XHTML, CSS and JavaScript which emphasize structured and modular programming with an object-based paradigm. The course reinforces theory with practical lab assignments to create websites and to explore web-based applications that include client-side script",
                    WeeklyHours = 4
                },
                new Course
                {
                    CourseNumber = "ICT0004",
                    CourseName = "Introduction to Database Systems",
                    CourseDescription =
                        "Students are introduced to the design and development of database systems using a current Database Management System (DBMS). Concepts and terminology of relational databases and design principles using the Entity Relationship model are presented. Students use SQL to create, modify and query a database. - See more at: http://www3.algonquincollege.com/sat/program/internet-applications-web-development/#courses",
                    WeeklyHours = 2
                },
                new Course
                {
                    CourseNumber = "ICT0005",
                    CourseName = "Achieving Success in Changing Environments",
                    CourseDescription =
                        "Rapid changes in technology have created personal and employment choices that challenge each of us to find our place as contributing citizens in the emerging society. Life in the 21st century presents significant opportunities, but it also creates potential hazards and ethical problems that demand responsible solutions. Students explore the possibilities ahead, assess their own aptitudes and strengths, and apply critical thinking and decision-making tools to help resolve some of the important issues in our complex society with its competing interests. - See more at: http://www3.algonquincollege.com/sat/program/internet-applications-web-development/#courses",
                    WeeklyHours = 4
                },
                new Course
                {
                    CourseNumber = "ICT0006",
                    CourseName = "Math Fundamentals",
                    CourseDescription =
                        "Students learn foundational mathematics required in many College technical programs. Students also solve measurement problems involving a variety of units and ratio and proportion problems. They manipulate algebraic expressions and solve equations. Students evaluate exponential and logarithmic expressions, study the trigonometry of right triangles and graph a variety of functions. - See more at: http://www3.algonquincollege.com/sat/program/internet-applications-web-development/#courses",
                    WeeklyHours = 4
                },
                new Course
                {
                    CourseNumber = "ICT0007",
                    CourseName = "Database Systems",
                    CourseDescription =
                        "Students acquire practical experience using Oracle, an object-relational database management system. Advanced topics in database design are covered. Students have hands-on use of SQL, SQL scripts, PL/SQL and embedded SQL in host programs. Database concepts covered include data storage and retrieval, administration data warehouse, data mining, decision support, business intelligence, security and transaction control. Students also explore the use of open source database software. - See more at: http://www3.algonquincollege.com/sat/program/internet-applications-web-development/#courses",
                    WeeklyHours = 6
                },
                new Course
                {
                    CourseNumber = "ICT0008",
                    CourseName = "Web Programming II",
                    CourseDescription =
                        "Through the study of C# and ASP.net, students learn the concepts of object-oriented programming as applied to the design, the development, and the debugging of ASP.net web. Object-oriented concepts, such as encapsulation, inheritance, abstraction and polymorphism are covered and reinforced with practical applications. The course also continues the development of Web Programming concepts by examining and using HTML form elements, HTML server controls and web server controls, the ASP.NET Page class, its inherent Page, Request, Response and Cookies objects. - See more at: http://www3.algonquincollege.com/sat/program/internet-applications-web-development/#courses",
                    WeeklyHours = 3
                },
                new Course
                {
                    CourseNumber = "ICT0009",
                    CourseName = "Network Operating Systems",
                    CourseDescription =
                        "Students are introduced to the concepts behind implementing the Windows server and the Linux operating systems in a multiple user, computer and Internet Protocol (IP) networked environment. Topics include managing and updating user accounts, access rights to files and directories, Transmission Control Protocol/Internet Protocol (TCP/IP) and TCP/IP services: Domain Name System (DNS), Hyper Text Transfer Protocol (HTTP) and File Transfer Protocol (FTP). The course reinforces theory with practical lab assignments to install and configure both operating systems and the services mentioned. - See more at: http://www3.algonquincollege.com/sat/program/internet-applications-web-development/#courses",
                    WeeklyHours = 4
                },
                new Course
                {
                    CourseNumber = "ICT0010",
                    CourseName = "Web Imaging and Animations",
                    CourseDescription =
                        "Students are introduced to basic concepts and techniques used to produce graphics, animations and video optimized for the World Wide Web. Students use Adobe software to create images and animations, build graphical user interfaces and author interactive applications. - See more at: http://www3.algonquincollege.com/sat/program/internet-applications-web-development/#courses",
                    WeeklyHours = 4
                },
                new Course
                {
                    CourseNumber = "ICT0011",
                    CourseName = "Communications I",
                    CourseDescription =
                        "Communication remains an essential skill sought by employers, regardless of discipline or field of study. Using a practical, vocation-oriented approach, students focus on meeting the requirements of effective communication. Through a combination of lectures, exercises, and independent learning, students practise writing, speaking, reading, listening, locating and documenting information, and using technology to communicate professionally. Students develop and strengthen communication skills that contribute to success in both educational and workplace environments. - See more at: http://www3.algonquincollege.com/sat/program/internet-applications-web-development/#courses",
                    WeeklyHours = 2
                },
                new Course
                {
                    CourseNumber = "ICT0012",
                    CourseName = "Web Programming Languages I",
                    CourseDescription =
                        "Emphasis is placed on ways of moving data between web pages and databases using the .NET platform: ASP, ADO, C#, and the .NET Framework. Heavy emphasis is placed on how web applications can interact with databases through ODBC or other technologies. Server-side methods and the advantages of multi-tiered applications are explored. The course concludes with a mini-project to develop a live web application that interacts with a database. - See more at: http://www3.algonquincollege.com/sat/program/internet-applications-web-development/#courses",
                    WeeklyHours = 6
                }
                );
        }