public void Init() { conection = new MSSQLDB(new DBConfiguration()); _SREP = new StudentRepository(conection); _encryptor = new Encryptor(); handler = new StudentQueryHandler(_SREP); var db = conection.GetCon(); // Create Course course = new Course(Guid.NewGuid(), "LTP5"); var sql = "INSERT INTO [Course] ([Id], [Name]) VALUES (@Id, @Name)"; db.Execute(sql, param: new { Id = course.CourseId, Name = course.Name }); var cpf = "964.377.278-02"; string password = cpf.Replace("-", "").Replace(".", ""); password = _encryptor.Encrypt(password, out string salt); student = new Student(course, DateTime.Now, "Abmael", "Araujo", cpf, "*****@*****.**", "(86) 2802-4826", "M", "Brasil", "Araguaina", "Centro", password, salt); _SREP.Create(student); commandGetById = new StudentInputGetById() { StudentId = student.Id }; commandList = new StudentInputList(); commandGetByCPF = new StudentInputGetByCPF() { StudentCPF = student.CPF.Number }; }
public void Clean() { var db = conection.GetCon(); // Delete Course var sql = "DELETE FROM [Professor] WHERE [Email] = @Email"; db.Execute(sql, param: new { Email = professor.Email.Address }); }
public void Init() { conection = new MSSQLDB(new DBConfiguration()); _SREP = new StudentRepository(conection); _encryptor = new Encryptor(); handler = new StudentCommandHandler(_SREP, _encryptor); var db = conection.GetCon(); // Create Course course = new Course(Guid.NewGuid(), "LTP5"); var sql = "INSERT INTO [Course] ([Id], [Name]) VALUES (@Id, @Name)"; db.Execute(sql, param: new { Id = course.CourseId, Name = course.Name }); var cpf = "964.377.278-02"; string password = cpf.Replace("-", "").Replace(".", ""); password = _encryptor.Encrypt(password, out string salt); student = new Student(course, DateTime.Now, "Abmael", "Araujo", cpf, "*****@*****.**", "(86) 2802-4826", "M", "Brasil", "Araguaina", "Centro", password, salt); _SREP.Create(student); commandRegister = new StudentInputRegister() { CourseId = course.CourseId, Birthdate = DateTime.Now, FirstName = "Ester", LastName = "Emily Oliveira", CPF = "494.035.320-68", Email = "*****@*****.**", Phone = "(45) 2509-8770", Gender = "M", Country = "Brasil", City = "Araguaina", Address = "Centro" }; commandUpdate = new StudentInputUpdate() { CourseId = course.CourseId, Birthdate = DateTime.Now, FirstName = "Iago", LastName = "Bernardo Nunes", Email = "*****@*****.**", Phone = "(65) 3544-9294", Gender = "M", Country = "França", City = "Budapeste", Address = "Norte", StudentId = student.Id }; }
public void Init() { conection = new MSSQLDB(new DBConfiguration()); _DREP = new DisciplineRepository(conection); _PREPProfessorContext = new Infra.ProfessorContext.ProfessorRepository(conection); _PREPCourseContext = new Infra.CourseContext.ProfessorRepository(conection); _encryptor = new Encryptor(); handler = new DisciplineCommandHandler(_DREP, _PREPCourseContext); var db = conection.GetCon(); var cpf = "357.034.413-40"; string password = cpf.Replace("-", "").Replace(".", ""); password = _encryptor.Encrypt(password, out string salt); professor = new Entities.ProfessorContext.Entities.Professor("Lívia", "Emanuelly Elisa", cpf, "*****@*****.**", "(21) 2682-8370", EDegree.Master, password, salt); _PREPProfessorContext.Create(professor); // Create Course course = new Course(Guid.NewGuid()); var sql = "INSERT INTO [Course] ([Id], [Name]) VALUES (@Id, 'LTP6')"; db.Execute(sql, param: new { Id = course.Id }); commandRegister = new DisciplineInputRegister() { Name = "Filosofia", CourseId = course.Id, ProfessorId = professor.Id, WeeklyWorkload = 1, Period = 1 }; discipline = new Discipline("Filosofia", course, new Professor(professor.Id), 1, 1, 0); _DREP.Create(discipline); commandUpdate = new DisciplineInputUpdate() { DisciplineId = discipline.Id, Name = "Matematica", CourseId = course.Id, ProfessorId = professor.Id, WeeklyWorkload = 2, Period = 2 }; commandDelete = new DisciplineInputDelete() { DisciplineId = discipline.Id }; }
public void Clean() { var db = conection.GetCon(); // Delete Course var sql = "DELETE FROM [Student] WHERE [Email] = @Email"; db.Execute(sql, param: new { Email = student.Email.Address }); // Delete Course sql = "DELETE FROM [Course] WHERE Id = @Id"; db.Execute(sql, param: new { Id = course.CourseId }); }
public void Clean() { var db = conection.GetCon(); // Delete Dicipline var sql = "DELETE FROM [Discipline] WHERE [CourseId] = @CourseId"; db.Execute(sql, param: new { CourseId = commandRegister.CourseId }); // Delete Dicipline sql = "DELETE FROM [Discipline] WHERE [Id] = @Id"; db.Execute(sql, param: new { Id = discipline.Id }); // Delete Professor sql = "DELETE FROM [Professor] WHERE [Email] = @Email"; db.Execute(sql, param: new { Email = professor.Email.Address }); // Delete Course sql = "DELETE FROM [Course] WHERE Id = @Id"; db.Execute(sql, param: new { Id = course.Id }); }
public void Init() { conection = new MSSQLDB(new DBConfiguration()); _PREP = new ProfessorRepository(conection); _encryptor = new Encryptor(); handler = new ProfessorQueryHandler(_PREP); var db = conection.GetCon(); var cpf = "357.034.413-40"; string password = cpf.Replace("-", "").Replace(".", ""); password = _encryptor.Encrypt(password, out string salt); professor = new Professor("Lívia", "Emanuelly Elisa", cpf, "*****@*****.**", "(21) 2682-8370", EDegree.Master, password, salt); _PREP.Create(professor); commandGet = new ProfessorInputGet() { ProfessorId = professor.Id }; }
public void Init() { conection = new MSSQLDB(new DBConfiguration()); _PREP = new ProfessorRepository(conection); _encryptor = new Encryptor(); handler = new ProfessorCommandHandler(_PREP, _encryptor); var db = conection.GetCon(); var cpf = "357.034.413-40"; string password = cpf.Replace("-", "").Replace(".", ""); password = _encryptor.Encrypt(password, out string salt); professor = new Professor("Lívia", "Emanuelly Elisa", cpf, "*****@*****.**", "(21) 2682-8370", EDegree.Master, password, salt); _PREP.Create(professor); commandRegister = new ProfessorInputRegister() { FirstName = "Lívia", LastName = "Emanuelly Elisa", CPF = cpf, Email = "*****@*****.**", Phone = "(21) 2682-8370", Degree = EDegree.Master }; commandUpdate = new ProfessorInputUpdate() { ProfessorId = professor.Id, FirstName = "Lívia", LastName = "Emanuelly Elisa", Email = "*****@*****.**", Phone = "(21) 2682-8370", Degree = EDegree.Master }; }