コード例 #1
0
        public void Init()
        {
            _AREPEC = new Infra.EvaluationContext.ActivityRepository(new MSSQLDB(new DBConfiguration()));
            _AREPAC = new Infra.ActivityContext.ActivityRepository(new MSSQLDB(new DBConfiguration()));
            _DREP   = new DisciplineRepository(new MSSQLDB(new DBConfiguration()));
            _PREP   = new Infra.ProfessorContext.ProfessorRepository(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 Professor
            professor = new Entities.ProfessorContext.Entities.Professor("Thelmaryo", "Vieira Lima", "034.034.034-00", "*****@*****.**", "123", EDegree.Master, "123", "123");
            _PREP.Create(professor);

            // Create Discipline
            disciplineCC = 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(disciplineCC);

            disciplineAC = new Entities.ActivityContext.Entities.Discipline(disciplineCC.Id, "Psicologia");

            // 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 Student
            string CPFEdit      = "344.245.132-97";
            string passwordEdit = new Encryptor().Encrypt(CPF.Replace("-", "").Replace(".", ""), out string saltEdit);

            studentEdit = new Entities.StudentContext.Entities.Student(course, DateTime.Now, "Abmael", "Araujo", CPFEdit, "*****@*****.**", "1234-1234", "F", "França", "AraguainaSul", "Norte", passwordEdit, saltEdit);
            _SREP.Create(studentEdit);

            // Create Activity
            activityAC = new Entities.ActivityContext.Entities.Activity(disciplineAC, "AtividadeTest", DateTime.Now, 10, 10, 15, Guid.NewGuid());
            _AREPAC.Create(activityAC);

            // Create Activity
            _student   = new Student(student.Id);
            activityEC = new Activity(activityAC.Id, _student, "AtividadeTest", DateTime.Now, 8, 10);
            _AREPEC.Create(activityEC);
        }
コード例 #2
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);
        }