Exemple #1
0
        public ICommandResult Handle(EnrollmentInputRegister command)
        {
            var semester   = new Semester();
            var enrollment = new Enrollment(new Student(command.StudentId), semester.Begin, semester.End, EStatusEnrollment.PreEnrollment);

            foreach (var discipline in command.Disciplines)
            {
                enrollment.AddDiscipline(new Discipline(discipline));
            }
            var result = new StandardResult();

            result.AddRange(enrollment.Notifications);
            if (result.Notifications.Count == 0)
            {
                _EREP.Create(enrollment);
                result.Notifications.Add("Success", "A Matrícula foi efetuada e está aguardando confirmação.");
            }
            return(result);
        }
Exemple #2
0
        public void Init()
        {
            _SREP = new StudentRepository(new MSSQLDB(new DBConfiguration()));
            _EREP = new EnrollmentRepository(new MSSQLDB(new DBConfiguration()));
            _DREP = new Infra.CourseContext.DisciplineRepository(new MSSQLDB(new DBConfiguration()));
            _PREP = new Infra.ProfessorContext.ProfessorRepository(new MSSQLDB(new DBConfiguration()));
            var db = new SqlConnection(new DBConfiguration().StringConnection);

            // Create Course
            course = new Course(Guid.NewGuid());
            sql    = "INSERT INTO [Course] ([Id], [Name]) VALUES (@Id, 'LTP')";
            db.Execute(sql, param: new { Id = course.CourseId });

            // Create Student
            string CPF      = "117.400.002-34";
            string password = new Encryptor().Encrypt(CPF.Replace("-", "").Replace(".", ""), out string salt);

            student = new Entities.StudentContext.Entities.Student(course, DateTime.Now, "Abmael", "Araujo", CPF, "*****@*****.**", "1234-1234", "F", "França", "AraguainaSul", "Norte", password, salt);
            _SREP.Create(student);

            // Create Enrellment
            var _student = new Entities.EnrollmentContext.Entities.Student(student.Id);

            enrollment = new Enrollment(_student, Convert.ToDateTime("2000-08-01"), Convert.ToDateTime("2025-12-01"), EStatusEnrollment.Confirmed);
            _EREP.Create(enrollment);

            // Create Professor
            professor = new Professor("Thelmaryo", "Vieira Lima", "034.034.034-00", "*****@*****.**", "123", EDegree.Master, "123", "123");
            _PREP.Create(professor);

            // Create Discipline
            discipline = new Entities.CourseContext.Entities.Discipline("Psicologia", new Entities.CourseContext.Entities.Course(course.CourseId), new Entities.CourseContext.Entities.Professor(professor.Id), 20, 1, 0);
            _DREP.Create(discipline);

            // Create StudentDiscipline
            StudentDisciplineId = Guid.NewGuid();
            sql = "INSERT INTO [dbo].[StudentDiscipline] ([Id],[EnrollmentId],[DisciplineId],[Status]) VALUES(@Id, @EnrollmentId, @DisciplineId, @Status);";
            db.Execute(sql, param: new { Id = StudentDisciplineId, EnrollmentId = enrollment.Id, DisciplineId = discipline.Id, Status = 0 });
        }
Exemple #3
0
        public void Init()
        {
            _EREP = new EnrollmentRepository(new MSSQLDB(new DBConfiguration()));
            _SREP = new StudentRepository(new MSSQLDB(new DBConfiguration()));
            var db = new SqlConnection(new DBConfiguration().StringConnection);

            // Create Course
            course = new Entities.StudentContext.Entities.Course(Guid.NewGuid());
            sql    = "INSERT INTO [Course] ([Id], [Name]) VALUES (@Id, 'LTP')";
            db.Execute(sql, param: new { Id = course.CourseId });

            // Create Student
            string CPF      = "117.400.002-34";
            string password = new Encryptor().Encrypt(CPF.Replace("-", "").Replace(".", ""), out string salt);

            student = new Entities.StudentContext.Entities.Student(course, DateTime.Now, "Abmael", "Araujo", CPF, "*****@*****.**", "1234-1234", "F", "França", "AraguainaSul", "Norte", password, salt);
            _SREP.Create(student);
            var _student = new Student(student.Id, student.FirstName);

            // Create Enrollment
            enrollment = new Enrollment(_student, Convert.ToDateTime("2000-01-01"), Convert.ToDateTime("2025-01-01"), EStatusEnrollment.PreEnrollment);
            _EREP.Create(enrollment);
        }