本文整理汇总了Python中DatabaseController类的典型用法代码示例。如果您正苦于以下问题:Python DatabaseController类的具体用法?Python DatabaseController怎么用?Python DatabaseController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DatabaseController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: verifyIfTeacherIsFreeAtThisTime
def verifyIfTeacherIsFreeAtThisTime(teacherId, weekdayId, studentId, lessonStartTime, lessonEndTime, startHour, endHour, startMin, timetableStartHour):
allTeacherLessons = DatabaseController.getTeacherLessonsWithinTimeSlot(teacherId, weekdayId, studentId, startHour, endHour)
errorString = ""
for eachLesson in allTeacherLessons:
nextStartHour = int(eachLesson[0])
nextStartMin = int(eachLesson[1])
nextLessonLength = int(eachLesson[2])
nextStartTime = ((nextStartHour - timetableStartHour) * 60) + nextStartMin
nextEndTime = nextStartTime + nextLessonLength
lessonClash = checkIfLessonsAreCollidingInTimeFrame(lessonStartTime, lessonEndTime, nextStartTime, nextEndTime)
# If lessons collide - process the error message
if lessonClash == True:
currentErrorMessage = ""
weekdayNameRecord = DatabaseController.getWeekdayNameById(weekdayId)
weekdayName = weekdayNameRecord[0][0]
teacherNameRecord = DatabaseController.getPersonNameBasedOnTeacherId(teacherId)
teacherFirstName = teacherNameRecord[0][0]
teacherSurname = teacherNameRecord[0][1]
currentErrorMessage = "Cannot schedule " + teacherFirstName[0:1] + ". " + teacherSurname + " on " + weekdayName + " at "
if startHour < 10:
currentErrorMessage += "0" + str(startHour) + ":"
else:
currentErrorMessage += str(startHour) + ":"
if startMin < 10:
currentErrorMessage += "0" + str(startMin) + ".\n"
else:
currentErrorMessage += str(startMin) + ".\n"
currentErrorMessage += "This teacher has already been scheduled elsewhere during this lessons time frame.\n\n"
errorString += currentErrorMessage
return errorString
示例2: verifyIfLessonTimeIsUnique
def verifyIfLessonTimeIsUnique(schoolId, studentId, weekdayId, schoolLessonId, lessonStartTime, lessonEndTime, startHour, endHour, startMin, timetableStartHour):
allLessonsRecord = DatabaseController.getStudentLessonsWithinTimeSlot(schoolId, studentId, weekdayId, startHour, endHour)
errorString = ""
for eachLesson in allLessonsRecord:
nextStartHour = int(eachLesson[0])
nextStartMin = int(eachLesson[1])
nextLessonLength = int(eachLesson[2])
nextStartTime = ((nextStartHour - timetableStartHour) * 60) + nextStartMin
nextEndTime = nextStartTime + nextLessonLength
lessonClash = checkIfLessonsAreCollidingInTimeFrame(lessonStartTime, lessonEndTime, nextStartTime, nextEndTime)
# If lessons collide - process the error message
if lessonClash == True:
currentErrorMessage = ""
weekdayNameRecord = DatabaseController.getWeekdayNameById(weekdayId)
weekdayName = weekdayNameRecord[0][0]
lessonNameRecord = DatabaseController.getLessonAbbreviatedNameBasedOnSchoolLessonId(schoolLessonId)
lessonName = lessonNameRecord[0][0]
currentErrorMessage = "Cannot schedule lesson '" + lessonName + "' on " + weekdayName + " at "
if startHour < 10:
currentErrorMessage += "0" + str(startHour) + ":"
else:
currentErrorMessage += str(startHour) + ":"
if startMin < 10:
currentErrorMessage += "0" + str(startMin) + ".\n"
else:
currentErrorMessage += str(startMin) + ".\n"
currentErrorMessage += "This lessons duration clashes with another lesson scheduled to this student by another school.\n\n"
errorString += currentErrorMessage
return errorString
示例3: insertNewLocationRecord
def insertNewLocationRecord(schoolId, locationName, streetName1, streetName2, townOrCity, county, headLocation):
duplicateRecord = DatabaseController.countNumberOfDuplicateAddresses(streetName1, streetName2, townOrCity, county)
duplicateValue = int(duplicateRecord[0][0])
if duplicateValue == 0:
insertNewAddressRecord(streetName1, streetName2, townOrCity, county)
addressIdRecord = DatabaseController.getAddressId(streetName1, streetName2, townOrCity, county)
addressId = int(addressIdRecord[0][0])
DatabaseController.insertNewLocationRecord(locationName, schoolId, addressId, headLocation)
示例4: checkIfClassroomIsUnique
def checkIfClassroomIsUnique(locationId, roomName):
classroomIdRecord = DatabaseController.getClassroomIdFromRoomName(roomName)
if classroomIdRecord.__len__() == 0:
return True
classroomId = int(classroomIdRecord[0][0])
existingCountRecord = DatabaseController.countDuplicateClassroomLocationRecords(locationId, classroomId)
existingCount = int(existingCountRecord[0][0])
if existingCount == 0:
return True
else:
return False
示例5: getClassroomTimetable
def getClassroomTimetable(classroomLocationId):
listOfTimetabledLessons = []
listOfStoredRecords = DatabaseController.getClassroomLocationTimetable(classroomLocationId)
for eachRecord in listOfStoredRecords:
schoolLessonId = int(eachRecord[7])
abbreviatedNameRecord = DatabaseController.getLessonAbbreviatedNameBasedOnSchoolLessonId(schoolLessonId)
abbreviatedName = abbreviatedNameRecord[0][0]
currentLesson = ClassesList.TimetabledLesson(int(eachRecord[0]), int(eachRecord[1]), int(eachRecord[2]), int(eachRecord[3]), int(eachRecord[4]),
int(eachRecord[5]), int(eachRecord[6]), abbreviatedName, int(eachRecord[8]), int(eachRecord[9]),
eachRecord[10])
listOfTimetabledLessons.append(currentLesson)
return listOfTimetabledLessons
示例6: getStudentTimetable
def getStudentTimetable(schoolId, studentId):
listOfTimetabledLessons = []
listOfStoredRecords = DatabaseController.getStudentTimetable(schoolId, studentId)
for eachRecord in listOfStoredRecords:
classroomLocationId = int(eachRecord[10])
classroomIdRecord = DatabaseController.getClassroomIdFromClassroomLocationId(classroomLocationId)
classroomId = int(classroomIdRecord[0][0])
currentLesson = ClassesList.TimetabledLesson(int(eachRecord[0]), int(eachRecord[1]), int(eachRecord[2]), int(eachRecord[3]), int(eachRecord[4]),
int(eachRecord[5]), int(eachRecord[6]), int(eachRecord[7]), int(eachRecord[8]), int(eachRecord[9]),
classroomId)
listOfTimetabledLessons.append(currentLesson)
return listOfTimetabledLessons
示例7: getStudentAccountsList
def getStudentAccountsList(schoolId, firstName, surname):
listOfStudentAccounts = []
listOfStudentRecords = DatabaseController.getStudentAccountsList(schoolId, firstName, surname)
for eachRecord in listOfStudentRecords:
for index in range(0, eachRecord.__len__()):
listOfStudentAccounts.append(eachRecord[index])
currentPersonId = int(eachRecord[0])
accountPasswordRecord = DatabaseController.getAccountPasswordBasedOnPersonIdAndType(currentPersonId, accountTypes[2])
if accountPasswordRecord.__len__() > 0:
listOfStudentAccounts.append(accountPasswordRecord[0][0])
listOfStudentAccounts.append(True)
else:
listOfStudentAccounts.append("")
listOfStudentAccounts.append(False)
return listOfStudentAccounts
示例8: checkIfPersonEmailHasChanged
def checkIfPersonEmailHasChanged(personId, emailAddress):
oldEmailAddressRecord = DatabaseController.getPersonEmailAddressBasedOnId(personId)
oldEmailAddress = oldEmailAddressRecord[0][0]
if emailAddress == oldEmailAddress:
return False
else:
return True
示例9: checkIfPersonEmailIsDuplicate
def checkIfPersonEmailIsDuplicate(emailAddress):
countRecord = DatabaseController.countNumberOfDuplicatePersonEmailAddresses(emailAddress)
countValue = int(countRecord[0][0])
if countValue == 0:
return False
else:
return True
示例10: getListOfSchoolLocations
def getListOfSchoolLocations(schoolId):
listOfLocations = []
locationRecords = DatabaseController.getListOfSchoolLocations(schoolId)
for eachRecord in locationRecords:
currentLocation = ClassesList.Location(int(eachRecord[0]), eachRecord[1], int(eachRecord[2]), eachRecord[3], eachRecord[4], eachRecord[5], eachRecord[6])
listOfLocations.append(currentLocation)
return listOfLocations
示例11: getSchoolStudentsList
def getSchoolStudentsList(schoolId, firstName, surname):
listOfStudentNamesAndDetails = []
listOfStudentDetailsAndRecords = DatabaseController.getListOfStudentDetails(schoolId, firstName, surname)
for eachStudent in listOfStudentDetailsAndRecords:
for index in range(0, eachStudent.__len__()):
listOfStudentNamesAndDetails.append(eachStudent[index])
return listOfStudentNamesAndDetails
示例12: checkIfSchoolEmailIsDuplicate
def checkIfSchoolEmailIsDuplicate(emailAddress):
countRecord = DatabaseController.checkIfDuplicateSchoolEmail(emailAddress)
countValue = int(countRecord[0][0])
if countValue == 0:
return False
else:
return True
示例13: getSchoolFullLessonDetailsList
def getSchoolFullLessonDetailsList(schoolId):
listOfLessonDetails = []
listOfLessonDetailsRecords = DatabaseController.getListOfFullLessonDetails(schoolId)
for eachLesson in listOfLessonDetailsRecords:
currentLesson = ClassesList.FullLesson(int(eachLesson[0]), eachLesson[1], eachLesson[2], eachLesson[3])
listOfLessonDetails.append(currentLesson)
return listOfLessonDetails
示例14: getSchoolLessonsList
def getSchoolLessonsList(schoolId):
listOfLessonNames = []
listOfLessonNameRecords = DatabaseController.getListOfLessonNames(schoolId)
for eachLesson in listOfLessonNameRecords:
currentLessonName = ClassesList.LessonName(eachLesson[0])
listOfLessonNames.append(currentLessonName)
return listOfLessonNames
示例15: getLocationClassroomsList
def getLocationClassroomsList(locationId):
listOfClassrooms = []
listOfClassroomRecords = DatabaseController.getListOfClassrooms(locationId)
for eachRoom in listOfClassroomRecords:
for index in range(0, eachRoom.__len__()):
listOfClassrooms.append(eachRoom[index])
return listOfClassrooms