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()

			teacher = Teacher()
			teacher.personID = person.personID
			teacher.salary = input_salary.get(1.0, "end-1c")

			person.userName = (person.lname + str(teacher.teacherID))
			person.userPass = "******"
			person.update()

			get_counsellor = selected_counsellor.get()
			if (get_counsellor == "Yes"):
				teacher.studycouncelor = 'Y'
			else:
				teacher.studycouncelor = 'N'

			teacher.insert()

			ui.AdminWindowTeachers.admin_window_teachers(window, return_function) #avoid circular import
Example #2
0
	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 generatePerson():
    person = Person()
    person.gender = random.choice(['M', 'F', 'O'])
    if (person.gender == 'F'):
        person.fname = random.choice(female_name)
    else:
        person.fname = random.choice(male_name)
    person.lname = random.choice(last_name)
    domain = ["gmail.com", "hotmail.com", "yahoo.com"]
    person.email = person.lname + "_" + person.fname + "@" + random.choice(
        domain)
    person.phone = "0" + str(random.randint(600000000, 699999999))
    person.birthday = getRandomDate(1980, 2004)
    person.nationality = random.choice(nationality)
    alphabets = [
        "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n",
        "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
    ]
    person.streetname = ''.join(random.choice(alphabets) for _ in range(6))
    person.streetNumber = random.randint(1, 99)
    person.city = random.choice(city_name)
    person.postalCode = str(random.randint(1111, 9999)) + str(''.join(
        random.choice(alphabets) for _ in range(2))).upper()
    person.insert()
    return person
def generatePerson(first_names, last_names, gender, stu_nationality, city,
                   stu):
    person = Person()
    person.fname = random.choice(first_names)
    person.lname = random.choice(last_names)
    person.gender = gender
    domain = ["gmail.com", "hotmail.com", "yahoo.com"]
    person.email = person.lname + "_" + person.fname + "@" + random.choice(
        domain)
    person.full_name = (person.fname, person.lname)
    person.phone_number = "0" + str(random.randint(600000000, 699999999))
    start_birthday = datetime.date(1980, 1, 1)
    end_birthday = datetime.date(2004, 1, 1)
    time_between_dates = end_birthday - start_birthday
    days_between_dates = time_between_dates.days
    random_number_of_days = random.randrange(days_between_dates)
    date_of_birth = start_birthday + datetime.timedelta(
        days=random_number_of_days)

    person.date_of_birth = date_of_birth.strftime('%Y/%m/%d')
    person.dob_password = date_of_birth.strftime("%Y%m%d")
    person.nationality = random.choice(stu_nationality)
    alphabets = [
        "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n",
        "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
    ]
    person.street_name = ''.join(random.choice(alphabets) for _ in range(6))
    person.number = random.randint(100000, 200000)
    person.city = random.choice(city)
    person.postal_code = str(random.randint(1111, 9999)) + str(''.join(
        random.choice(alphabets) for _ in range(2)))
    person.stu_program = random.choice(stu)
    person.start_year = random.randint(2015, 2020)
    #counselor = ["L. Broglie","M. Planck","L. de Broglie","Planck","B. de Wit"]
    #person.counselor = random.choice(counselor)
    password = person.fname + person.dob_password
    person.password = password
    return person