public async Task TeacherGroupTest() { using IDbConnection connection = new SqlConnection(DBConnection.connString); connection.Open(); IDbTransaction transaction = connection.BeginTransaction(); courseStorage = new CourseStorage(connection, transaction); dictionaryStorage = new DictionaryStorage(connection, transaction); userStorage = new UserStorage(connection, transaction); groupStorage = new GroupStorage(connection, transaction); try { await Setup(); await TestSelects(); foreach (TeacherGroup teacherGroupToDelete in listTeacherGroup) { await TestEntityDelete(teacherGroupToDelete); } transaction.Commit(); } catch { transaction.Rollback(); throw new Exception(); } }
public async Task CourseProgramSkillTest() { IDbConnection connection = new SqlConnection(DBConnection.connString); connection.Open(); IDbTransaction transaction = connection.BeginTransaction(); courseStorage = new CourseStorage(connection, transaction); try { await Setup(); await TestSelects(); foreach (CourseProgramSkill CourseProgramSkillToDelete in listCourseProgramSkill) { await CourseProgramSkillTestDelete(CourseProgramSkillToDelete); } } catch (Exception ex) { throw new Exception(ex.Message); } finally { transaction.Rollback(); } }
public void StudentGroupTest() { using IDbConnection connection = new SqlConnection(DBConnection.connString); connection.Open(); IDbTransaction transaction = connection.BeginTransaction(); courseStorage = new CourseStorage(connection, transaction); dictionaryStorage = new DictionaryStorage(connection, transaction); userStorage = new UserStorage(connection, transaction); groupStorage = new GroupStorage(connection, transaction); try { Setup(); TestSelects(); foreach (StudentGroup studentGroupToDelete in listStudentGroup) { TestEntityDelete(studentGroupToDelete); } ClearTest(); transaction.Commit(); } catch { transaction.Rollback(); throw new Exception(); } }
public async Task LessonTopicTest() { using IDbConnection connection = new SqlConnection(DBConnection.connString); connection.Open(); IDbTransaction transaction = connection.BeginTransaction(); courseStorage = new CourseStorage(connection, transaction); groupStorage = new GroupStorage(connection, transaction); lessonStorage = new LessonStorage(connection, transaction); try { await Setup(); await TestSelects(); foreach (LessonTopic lessonTopicToDelete in listLessonTopic) { await TestEntityDelete(lessonTopicToDelete); } } catch { throw new Exception(); } finally { transaction.Rollback(); } }
public async Task JournalTest() { using IDbConnection connection = new SqlConnection(DBConnection.connString); connection.Open(); IDbTransaction transaction = connection.BeginTransaction(); courseStorage = new CourseStorage(connection, transaction); groupStorage = new GroupStorage(connection, transaction); dictionaryStorage = new DictionaryStorage(connection, transaction); userStorage = new UserStorage(connection, transaction); lessonStorage = new LessonStorage(connection, transaction); try { await Setup(); await TestSelects(); await TestUpdate(); foreach (Journal journalToDelete in listJournal) { await TestEntityDelete(journalToDelete); } } catch (Exception ex) { throw new Exception(ex.Message); } finally { transaction.Rollback(); } }
public void GeneralTest() { using IDbConnection connection = new SqlConnection(DBConnection.connString); connection.Open(); IDbTransaction transaction = connection.BeginTransaction(); courseStorage = new CourseStorage(connection, transaction); try { Setup(); TestSelects(); TestUpdate(); foreach (ThemeDetails ThemeDetailsToDelete in themeDetailsList) { TestEntityDelete(ThemeDetailsToDelete); } transaction.Commit(); } catch { transaction.Rollback(); throw new System.Exception(); } }
public void TimeTableTest() { using IDbConnection connection = new SqlConnection(DBConnection.connString); connection.Open(); IDbTransaction transaction = connection.BeginTransaction(); groupStorage = new GroupStorage(connection, transaction); lessonStorage = new LessonStorage(connection, transaction); courseStorage = new CourseStorage(connection, transaction); try { Setup(); TestSelects(); TestUpdate(); foreach (TimeTable timeTableToDelete in listTimetable) { TestEntityDelete(timeTableToDelete); } ClearAllMocks(); transaction.Commit(); } catch { transaction.Rollback(); throw new Exception(); } }
public LessonController(IConfiguration Configuration) { string dbCon = Configuration.GetConnectionString("DefaultConnection"); lessonStorage = new LessonStorage(dbCon); groupStorage = new GroupStorage(dbCon); courseStorage = new CourseStorage(dbCon); }
}// add check for authorization public void Delete(Course course) { if (CheckOwnership(course.Id) != OwnershipType.None) { CourseStorage.Delete(course); } else { throw new AccessViolationException(); } }// add check for authorization
public SearchResultList GetSearchResults(string searchString, SearchMode type, ref SearchResultList resultList) { try { SearchResultList result = CourseStorage.Search(searchString, type, ref resultList); return(result); } catch (KeyNotFoundException) { return(null); } }
public Course Add(Course course) { if (CheckOwnership(course.Id) != OwnershipType.None) { if (course.Title == null || course.Author == null) { return(null); } Course result = CourseStorage.Add(course); return(result); } else { throw new AccessViolationException(); } }// add check for authorization
public void User_SkillTest() { using IDbConnection connection = new SqlConnection(DBConnection.connString); connection.Open(); IDbTransaction transaction = connection.BeginTransaction(); dictionaryStorage = new DictionaryStorage(connection, transaction); userStorage = new UserStorage(connection, transaction); courseStorage = new CourseStorage(connection, transaction); try { Setup(); TestSelects(); TestDelete(); //TestUpdate(); //foreach (Journal journalToDelete in listJournal) //{ // TestEntityDelete(journalToDelete); //} ClearShit(); transaction.Commit(); } catch { transaction.Rollback(); throw new Exception(); } }
public Course GetById(string id) { if (CheckOwnership(id) != OwnershipType.None) { try { return(CourseStorage.GetCourse(id)); } catch (ArgumentOutOfRangeException) { return(null); } } else { throw new AccessViolationException(); } }
}// add check for authorization public Course Edit(Course course)// add check for authorization { if (CheckOwnership(course.Id) != OwnershipType.None) { try { Course result = CourseStorage.Edit(course); return(result); } catch (ArgumentOutOfRangeException) { return(null); } } else { throw new AccessViolationException(); } }
public CourseInfo GetCourseInfo(string id) { try { Course result = GetById(id); if (result != null) { return(CourseStorage.GetCourseInfo(result)); } else { return(null); } } catch (ArgumentOutOfRangeException) { return(null); } }
public void ProgramDetailsTest() { using IDbConnection connection = new SqlConnection(DBConnection.connString); connection.Open(); IDbTransaction transaction = connection.BeginTransaction(); courseStorage = new CourseStorage(connection, transaction); try { Setup(); TestSelects(); TestUpdate(); TestDeleteProgramDetails(listProgramDetails); transaction.Commit(); } catch { transaction.Rollback(); throw new System.Exception(); } }
public async Task GeneralTest() { IDbConnection connection = new SqlConnection(DBConnection.connString); connection.Open(); IDbTransaction transaction = connection.BeginTransaction(); storage = new CourseStorage(connection, transaction); try { await CreateCourseProgram(); await UpdateCourseProgram(); } catch (Exception ex) { throw new Exception(ex.Message); } finally { transaction.Rollback(); } }
public async Task CourseTest() { using IDbConnection connection = new SqlConnection(DBConnection.connString); connection.Open(); IDbTransaction transaction = connection.BeginTransaction(); courseStorage = new CourseStorage(connection, transaction); try { await Setup(); await TestSelects(); await TestUpdate(); await TestDeleteCourse(listCourse); } catch (Exception ex) { throw new Exception(ex.Message); } finally { transaction.Rollback(); } }
public CourseController(IConfiguration Configuration) { string dbCon = Configuration.GetConnectionString("DefaultConnection"); courseStorage = new CourseStorage(dbCon); }