def submit_all(): result = askquestion(title="Confirmation", message= "Do you want to process?") if result == "yes": person = Person() person.lname = input_lastname.get(1.0, "end-1c") person.fname = input_firstname.get(1.0, "end-1c") person.birthday = datetime.date(birthYear.get(), months.index(birthMonth.get()) + 1, birthDay.get()) person.nationality = selected_nationality.get() person.gender = selected_gender.get() person.streetNumber = str(input_houseNo.get(1.0, "end-1c")) + str(input_houseNo2.get(1.0, "end-1c")) person.streetname = input_street.get(1.0, "end-1c") person.city = input_city.get(1.0, "end-1c") person.postalCode = str(input_postal.get(1.0, "end-1c")) + str(input_postal2.get(1.0, "end-1c")) person.phone = input_phoneNumber.get(1.0, "end-1c") person.email = input_email.get(1.0, "end-1c") person.insert() student = Student() student.personID = person.personID student.studentID = int(input_studentID.get(1.0, "end-1c")) student.startYear = datetime.date(startYear.get(), 1, 1) student.enrolled = selected_study.get() counseler_index = counsellornames.index(selected_counsellor.get()) student.studyCouncelor = counsellors[counseler_index].teacherID student.insert() person.userName = (person.lname + str(student.studentID)) person.userPass = "******" person.update() ui.AdminWindowStudents.admin_window_students(window, return_function) #avoid circular import
def generateStudent(): person = generatePerson() student = Student() student.startYear = datetime.date(random.randint(2012, 2024), 1, 1) student.studyCouncelor = random.choice(counselers).teacherID student.enrolled = random.choice(studies).studyname student.personID = person.personID student.insert() person.userName = (person.lname + str(student.studentID)) person.userPass = "******" person.update() for course in random.sample(courses, 4): student.enrollInCourse(course.courseID) return student