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 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 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 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 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 LessonController(IConfiguration Configuration) { string dbCon = Configuration.GetConnectionString("DefaultConnection"); lessonStorage = new LessonStorage(dbCon); groupStorage = new GroupStorage(dbCon); courseStorage = new CourseStorage(dbCon); }
public UserController(IConfiguration Configuration) { string dbCon = Configuration.GetConnectionString("DefaultConnection"); userStorage = new UserStorage(dbCon); groupStorage = new GroupStorage(dbCon); userAttestationStorage = new UserAttestationStorage(dbCon); }
public void AddGroup(string name) { if (!Context.PersonId.HasValue) { throw new UnassignedUserException(); } BaseSecurity.IsDistrictAdmin(Context); // only admin can create group ... think do we need this for demo GroupStorage.Add(new Group { Name = name, OwnerRef = Context.PersonId.Value }); }
public Group EditGroup(int groupId, string name) { if (string.IsNullOrEmpty(name)) { throw new ChalkableException("Invalid name param. Name parameter is empty"); } var group = GroupStorage.GetById(groupId); EnsureInGroupModifyPermission(group); group.Name = name; GroupStorage.Update(group); return(group); }
public GroupService(GroupStorage groupStorage, GroupService groupService) { _groupStorage = groupStorage; _groupService = groupService; }
public void UnassignStudentsFromGroup(int groupId, IList <int> studentIds) { DemandStudentIdsParam(studentIds); EnsureInGroupModifyPermission(GroupStorage.GetById(groupId)); StudentGroupStorage.Delete(BuildStudentGroups(groupId, studentIds)); }
public void DeleteGroup(int groupId) { EnsureInGroupModifyPermission(GroupStorage.GetById(groupId)); GroupStorage.Delete(groupId); }
public GroupController(IConfiguration Configuration) { string dbCon = Configuration.GetConnectionString("DefaultConnection"); groupStorage = new GroupStorage(dbCon); }